Title: [132518] trunk/Source/WebKit/chromium
Revision
132518
Author
commit-qu...@webkit.org
Date
2012-10-25 13:01:04 -0700 (Thu, 25 Oct 2012)

Log 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 <skyos...@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):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (132517 => 132518)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-10-25 19:58:04 UTC (rev 132517)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-10-25 20:01:04 UTC (rev 132518)
@@ -1,3 +1,21 @@
+2012-10-25  Sami Kyostila  <skyos...@chromium.org>
+
+        Composited/HW content have the red and blue channels inverted in DRT on Chromium Android
+        https://bugs.webkit.org/show_bug.cgi?id=98647
+
+        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):
+
 2012-10-25  Dominic Mazzoni  <dmazz...@google.com>
 
         AX: Notification should be sent when accessibilityIsIgnored changes

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (132517 => 132518)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-10-25 19:58:04 UTC (rev 132517)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-10-25 20:01:04 UTC (rev 132518)
@@ -1769,6 +1769,14 @@
     target.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height(), rect.width() * 4);
     target.allocPixels();
     m_layerTreeView->compositeAndReadback(target.getPixels(), rect);
+#if (!SK_R32_SHIFT && SK_B32_SHIFT == 16)
+    // The compositor readback always gives back pixels in BGRA order, but for
+    // example Android's Skia uses RGBA ordering so the red and blue channels
+    // need to be swapped.
+    uint8_t* pixels = reinterpret_cast<uint8_t*>(target.getPixels());
+    for (size_t i = 0; i < target.getSize(); i += 4)
+        std::swap(pixels[i], pixels[i + 2]);
+#endif
     canvas->writePixels(target, rect.x(), rect.y());
 }
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to