RESOLVED FIXED 32188
texImage2D pixel junk for transparency
https://bugs.webkit.org/show_bug.cgi?id=32188
Summary texImage2D pixel junk for transparency
Keith Bauer
Reported 2009-12-05 20:57:36 PST
When using texImage2D with an Image or Canvas as the source of the data, WebKit draws the underlying CGImage to a CGBitmapContext to get access to the pixels. The context is created with memory from fastMalloc(), and therefore undefined. When the CGImage being drawn contains transparency, this undefined data shows through, causing pixel junk in the resulting WebGL texture image. There is no workaround for this; there is no way to affect the pixels of that CGBitmapContext in such a way that the pixel junk is cleared without also making the resulting texture opaque. The patch is trivial (using calloc, or adding a memset, or CGClearRect, or similar to zero the bitmap context's data before drawing the image in imageToTexture() in WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp. I'm having trouble building WebKit though so I can't offer a tested patch.
Attachments
Patch (1.59 KB, patch)
2009-12-06 03:30 PST, Oliver Hunt
mjs: review+
Oliver Hunt
Comment 1 2009-12-06 02:47:31 PST
This problem can be fixed by forcing the blend mode to kCGBlendCopy. Have a patch in my tree, but haven't yet worked out how to make a testcase.
Oliver Hunt
Comment 2 2009-12-06 03:30:19 PST
Maciej Stachowiak
Comment 3 2009-12-06 03:33:37 PST
Comment on attachment 44359 [details] Patch r=me
Oliver Hunt
Comment 4 2009-12-06 03:38:11 PST
Committed r51740
Note You need to log in before you can comment on or make changes to this bug.