Skip to content
  • noel.gordon@gmail.com's avatar
    [chromium] Use WEBPImportPictureRGBX|BGRX to import picture data · 171c4b27
    noel.gordon@gmail.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@119787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    171c4b27