[chromium] Use WEBPImportPictureRGBX|BGRX to import picture data
authornoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 02:57:27 +0000 (02:57 +0000)
committernoel.gordon@gmail.com <noel.gordon@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 02:57:27 +0000 (02:57 +0000)
commit4120c23a1e4e5ee85b137c1a6b2ede89dc7c5d05
treeb9b6244709ca3f42c220bb8a0a7d30ad4741baf2
parent67760c9425cb0d6d0ee378710e09d81d316eefdd
[chromium] Use WEBPImportPictureRGBX|BGRX to import picture data
https://bugs.webkit.org/show_bug.cgi?id=88218

Reviewed by Kent Tamura.

Source/WebCore:

Stop using the RGBA and RGBA variants of the picture import routines (since
these will import alpha channel data in a future libwebp). Use the RGBX and
BGRX variants to import picture data for encoding to make it clear that the
alpha channel is (and must be) ignored.

Test: fast/canvas/canvas-toDataURL-webp.html

* platform/image-encoders/skia/WEBPImageEncoder.cpp:
(WebCore::rgbPictureImport):
(WebCore::importPictureBGRX): Use WEBPImportPictureBGRX for picture imports
that must ignore the alpha channel. Change the template parameter to be the
premultiplied alpha state of the input image data.
(WebCore::importPictureRGBX): Use WEBPImportPictureRGBX, ditto.
(WebCore::encodePixels): Invert the sense of the template parameter to make
it now indicate the premultiplied alpha state of the input image data.

LayoutTests:

The test image (html5.png) has an alpha 255 background. The background should
be rendered black when a <canvas>.toDataURL('image/webp') is used as an <img>
element src attribute for example, since WEBP does not support alpha.

* fast/canvas/canvas-toDataURL-webp-expected.txt:
* fast/canvas/canvas-toDataURL-webp.html: Change the test to encode the added
html5.png test image as an image/webp data url.
* fast/canvas/resources/html5.png: Added.
* platform/chromium-mac-snowleopard/fast/canvas/canvas-toDataURL-webp-expected.png: Added.
* platform/chromium/TestExpectations: Requires WIN, LINUX rebaselines.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@119787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-toDataURL-webp-expected.txt
LayoutTests/fast/canvas/canvas-toDataURL-webp.html
LayoutTests/fast/canvas/resources/html5.png [new file with mode: 0644]
LayoutTests/platform/chromium-mac-snowleopard/fast/canvas/canvas-toDataURL-webp-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/image-encoders/skia/WEBPImageEncoder.cpp