Changeset 132518 in webkit


Ignore:
Timestamp:
Oct 25, 2012, 1:01:04 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Composited/HW content have the red and blue channels inverted in DRT on Chromium Android
https://bugs.webkit.org/show_bug.cgi?id=98647

Patch by Sami Kyostila <skyostil@chromium.org> on 2012-10-25
Reviewed by James Robinson.

WebLayerTreeView::compositeAndReadback() always gives back data in BGRA
ordering (i.e., the first byte in memory is blue). This matches Skia's
SkBitmap::kARGB_8888_Config ordering on all platforms except Android,
where Skia's native format is RGBA (i.e., red comes first in memory).

This mismatch causes layout test pixel comparison failures. This patch
fixes the problem by reordering the channels right after readback.

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::doPixelReadbackToCanvas):

Location:
trunk/Source/WebKit/chromium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r132514 r132518  
     12012-10-25  Sami Kyostila  <skyostil@chromium.org>
     2
     3        Composited/HW content have the red and blue channels inverted in DRT on Chromium Android
     4        https://bugs.webkit.org/show_bug.cgi?id=98647
     5
     6        Reviewed by James Robinson.
     7
     8        WebLayerTreeView::compositeAndReadback() always gives back data in BGRA
     9        ordering (i.e., the first byte in memory is blue). This matches Skia's
     10        SkBitmap::kARGB_8888_Config ordering on all platforms except Android,
     11        where Skia's native format is RGBA (i.e., red comes first in memory).
     12
     13        This mismatch causes layout test pixel comparison failures. This patch
     14        fixes the problem by reordering the channels right after readback.
     15
     16        * src/WebViewImpl.cpp:
     17        (WebKit::WebViewImpl::doPixelReadbackToCanvas):
     18
    1192012-10-25  Dominic Mazzoni  <dmazzoni@google.com>
    220
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r132283 r132518  
    17701770    target.allocPixels();
    17711771    m_layerTreeView->compositeAndReadback(target.getPixels(), rect);
     1772#if (!SK_R32_SHIFT && SK_B32_SHIFT == 16)
     1773    // The compositor readback always gives back pixels in BGRA order, but for
     1774    // example Android's Skia uses RGBA ordering so the red and blue channels
     1775    // need to be swapped.
     1776    uint8_t* pixels = reinterpret_cast<uint8_t*>(target.getPixels());
     1777    for (size_t i = 0; i < target.getSize(); i += 4)
     1778        std::swap(pixels[i], pixels[i + 2]);
     1779#endif
    17721780    canvas->writePixels(target, rect.x(), rect.y());
    17731781}
Note: See TracChangeset for help on using the changeset viewer.