[Webkit-unassigned] [Bug 137793] Calling glReadPixels with BGRA format on an NVIDIA machine with an opaque context returns the wrong alpha values.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 17 17:14:34 PDT 2014


https://bugs.webkit.org/show_bug.cgi?id=137793

Dean Jackson <dino at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #240053|review?                     |review+
              Flags|                            |

--- Comment #14 from Dean Jackson <dino at apple.com> ---
Comment on attachment 240053
  --> https://bugs.webkit.org/attachment.cgi?id=240053
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=240053&action=review

> Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:89
> +    // NVIDIA drivers have a bug where calling readPixels in BGRA can return the wrong values for the alpha channel when the alpha is off for the context.
> +    if (!m_attrs.alpha && getExtensions()->isNVIDIA()) {
> +        ::glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
> +        vImage_Buffer src;
> +        src.height = height;
> +        src.width = width;
> +        src.rowBytes = width*4;
> +        src.data = pixels;
> +
> +        vImage_Buffer dest;
> +        dest.height = height;
> +        dest.width = width;
> +        dest.rowBytes = width*4;
> +        dest.data = pixels;
> +
> +        // Swap pixel channels from BGRA to RGBA.
> +        const uint8_t map[4] = { 2, 1, 0, 3 };
> +        vImagePermuteChannels_ARGB8888(&src, &dest, map, kvImageNoFlags);

Won't you need the USE(ACCELERATE) around this too? Other ports won't work.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20141018/cc8f1e13/attachment-0002.html>


More information about the webkit-unassigned mailing list