Fix nonpremultiplied webgl toDataURL to jpeg
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 22:07:33 +0000 (22:07 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 22:07:33 +0000 (22:07 +0000)
commita1a0605599e6ef5957dda6156bb49e8586dd0e49
treec83642df276f5ab67aa0ec092a75bafdfee62fa3
parent6efc060b701f751266dcaba3e5c2cedd9d1d9379
Fix nonpremultiplied webgl toDataURL to jpeg
https://bugs.webkit.org/show_bug.cgi?id=68366

Source/WebCore:

The canvas spec says that toDataURL to formats without an alpha must
be "composited onto a solid black background using the source-over
operator." Do that.

Patch by John Bauman <jbauman@chromium.org> on 2011-09-26
Reviewed by Kenneth Russell.

* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::CGImageToDataURL):
(WebCore::ImageBuffer::toDataURL):
(WebCore::ImageDataToDataURL):
* platform/image-encoders/skia/JPEGImageEncoder.cpp:
(WebCore::RGBAtoRGB):

LayoutTests:

Update the premultiplyalpha-test from the WebGL conformance tests.
Also use the correct expected result for toDataURL.jpeg.alpha.html.

Patch by John Bauman <jbauman@chromium.org> on 2011-09-26
Reviewed by Kenneth Russell.

* fast/canvas/webgl/premultiplyalpha-test-expected.txt:
* fast/canvas/webgl/premultiplyalpha-test.html:
* platform/mac/canvas/philip/tests/toDataURL.jpeg.alpha-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96000 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/premultiplyalpha-test-expected.txt
LayoutTests/fast/canvas/webgl/premultiplyalpha-test.html
LayoutTests/platform/mac/canvas/philip/tests/toDataURL.jpeg.alpha-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp