Title: [145027] trunk/Source
Revision
145027
Author
[email protected]
Date
2013-03-06 19:46:27 -0800 (Wed, 06 Mar 2013)

Log Message

[Chromium] Fix byte ordering bugs reading back WebGL canvases' content on Android
https://bugs.webkit.org/show_bug.cgi?id=111661

Reviewed by James Robinson.

Source/Platform:

* chromium/public/WebGraphicsContext3D.h:
(WebGraphicsContext3D):
    Better documented contract of readBackFrameBuffer.

Source/WebCore:

No new tests; covered by existing tests. Ran WebGL conformance
tests on Android and desktop Linux to verify fix.

* platform/chromium/support/GraphicsContext3DChromium.cpp:
(WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
    Avoid incorrect byte swap on Android and other OSs which don't
    swizzle R and B channels.

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (145026 => 145027)


--- trunk/Source/Platform/ChangeLog	2013-03-07 03:43:11 UTC (rev 145026)
+++ trunk/Source/Platform/ChangeLog	2013-03-07 03:46:27 UTC (rev 145027)
@@ -1,3 +1,14 @@
+2013-03-06  Kenneth Russell  <[email protected]>
+
+        [Chromium] Fix byte ordering bugs reading back WebGL canvases' content on Android
+        https://bugs.webkit.org/show_bug.cgi?id=111661
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebGraphicsContext3D.h:
+        (WebGraphicsContext3D):
+            Better documented contract of readBackFrameBuffer.
+
 2013-03-06  Dana Jansens  <[email protected]>
 
         [chromium] Remove WebSharedGraphicsContext3D class

Modified: trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h (145026 => 145027)


--- trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2013-03-07 03:43:11 UTC (rev 145026)
+++ trunk/Source/Platform/chromium/public/WebGraphicsContext3D.h	2013-03-07 03:46:27 UTC (rev 145027)
@@ -185,7 +185,8 @@
     // Helper for software compositing path. Reads back the frame buffer into
     // the memory region pointed to by "pixels" with size "bufferSize". It is
     // expected that the storage for "pixels" covers (4 * width * height) bytes.
-    // Returns true on success.
+    // The RGBA channels are packed into "pixels" using SkBitmap's byte
+    // ordering. Returns true on success.
     virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, WebGLId framebuffer, int width, int height) = 0;
 
     // Returns the id of the texture which is used for storing the contents of

Modified: trunk/Source/WebCore/ChangeLog (145026 => 145027)


--- trunk/Source/WebCore/ChangeLog	2013-03-07 03:43:11 UTC (rev 145026)
+++ trunk/Source/WebCore/ChangeLog	2013-03-07 03:46:27 UTC (rev 145027)
@@ -1,3 +1,18 @@
+2013-03-06  Kenneth Russell  <[email protected]>
+
+        [Chromium] Fix byte ordering bugs reading back WebGL canvases' content on Android
+        https://bugs.webkit.org/show_bug.cgi?id=111661
+
+        Reviewed by James Robinson.
+
+        No new tests; covered by existing tests. Ran WebGL conformance
+        tests on Android and desktop Linux to verify fix.
+
+        * platform/chromium/support/GraphicsContext3DChromium.cpp:
+        (WebCore::GraphicsContext3D::paintRenderingResultsToImageData):
+            Avoid incorrect byte swap on Android and other OSs which don't
+            swizzle R and B channels.
+
 2013-03-06  Gyuyoung Kim  <[email protected]>
 
         [EFL] Improve warning messages when input value is out of range.

Modified: trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DChromium.cpp (145026 => 145027)


--- trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DChromium.cpp	2013-03-07 03:43:11 UTC (rev 145026)
+++ trunk/Source/WebCore/platform/chromium/support/GraphicsContext3DChromium.cpp	2013-03-07 03:46:27 UTC (rev 145027)
@@ -36,6 +36,7 @@
 #include "GraphicsContext3DPrivate.h"
 #include "ImageBuffer.h"
 #include "ImageData.h"
+#include "SkTypes.h"
 #include <public/Platform.h>
 #include <public/WebGraphicsContext3D.h>
 #include <wtf/text/CString.h>
@@ -529,8 +530,11 @@
 
     m_private->webContext()->readBackFramebuffer(pixels, bufferSize, framebufferId, width, height);
 
+#if (SK_R32_SHIFT == 16) && !SK_B32_SHIFT
+    // If the implementation swapped the red and blue channels, un-swap them.
     for (size_t i = 0; i < bufferSize; i += 4)
         std::swap(pixels[i], pixels[i + 2]);
+#endif
 
     return imageData.release();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to