Title: [123702] trunk/Source/WebCore
Revision
123702
Author
[email protected]
Date
2012-07-25 19:52:45 -0700 (Wed, 25 Jul 2012)

Log Message

[BlackBerry] GraphicsContext3D::paintToCanvas should not swap 0th and 2nd components of color
https://bugs.webkit.org/show_bug.cgi?id=92314

Patch by Joshua Netterfield <[email protected]> on 2012-07-25
Reviewed by Rob Buis.

No new tests, because it corrects existing functionality, but it makes BlackBerry
pass canvas-text.html and others.

* platform/graphics/GraphicsContext3D.h:
* platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
(WebCore::GraphicsContext3D::paintToCanvas):
* platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
(WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123701 => 123702)


--- trunk/Source/WebCore/ChangeLog	2012-07-26 02:46:37 UTC (rev 123701)
+++ trunk/Source/WebCore/ChangeLog	2012-07-26 02:52:45 UTC (rev 123702)
@@ -1,5 +1,21 @@
 2012-07-25  Joshua Netterfield  <[email protected]>
 
+        [BlackBerry] GraphicsContext3D::paintToCanvas should not swap 0th and 2nd components of color
+        https://bugs.webkit.org/show_bug.cgi?id=92314
+
+        Reviewed by Rob Buis.
+
+        No new tests, because it corrects existing functionality, but it makes BlackBerry
+        pass canvas-text.html and others.
+
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
+        (WebCore::GraphicsContext3D::paintToCanvas):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+        (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
+
+2012-07-25  Joshua Netterfield  <[email protected]>
+
         [BlackBerry] GraphicsContext3D::reshapeFBOs does not report when bound FBOs should be restored
         https://bugs.webkit.org/show_bug.cgi?id=92304
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (123701 => 123702)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-07-26 02:46:37 UTC (rev 123701)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h	2012-07-26 02:52:45 UTC (rev 123702)
@@ -805,6 +805,9 @@
 #elif PLATFORM(QT)
     void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
                        int canvasWidth, int canvasHeight, QPainter* context);
+#elif PLATFORM(BLACKBERRY)
+    void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
+                       int canvasWidth, int canvasHeight, GraphicsContext*);
 #endif
 
     void markContextChanged();

Modified: trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp (123701 => 123702)


--- trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp	2012-07-26 02:46:37 UTC (rev 123701)
+++ trunk/Source/WebCore/platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp	2012-07-26 02:52:45 UTC (rev 123702)
@@ -359,29 +359,16 @@
 #endif
 
 void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight,
-       GraphicsContext* context, bool flipY)
+       GraphicsContext* context)
 {
-    // Reorder pixels into BGRA format.
     unsigned char* tempPixels = new unsigned char[imageWidth * imageHeight * 4];
 
-    if (flipY) {
-        for (int y = 0; y < imageHeight; y++) {
-            const unsigned char *srcRow = imagePixels + (imageWidth * 4 * y);
-            unsigned char *destRow = tempPixels + (imageWidth * 4 * (imageHeight - y - 1));
-            for (int i = 0; i < imageWidth * 4; i += 4) {
-                destRow[i + 0] = srcRow[i + 2];
-                destRow[i + 1] = srcRow[i + 1];
-                destRow[i + 2] = srcRow[i + 0];
-                destRow[i + 3] = srcRow[i + 3];
-            }
-        }
-    } else {
-        for (int i = 0; i < imageWidth * imageHeight * 4; i += 4) {
-            tempPixels[i + 0] = imagePixels[i + 2];
-            tempPixels[i + 1] = imagePixels[i + 1];
-            tempPixels[i + 2] = imagePixels[i + 0];
-            tempPixels[i + 3] = imagePixels[i + 3];
-        }
+    // 3D images have already been converted to BGRA. Don't do it twice!!
+    for (int y = 0; y < imageHeight; y++) {
+        const unsigned char *srcRow = imagePixels + (imageWidth * 4 * y);
+        unsigned char *destRow = tempPixels + (imageWidth * 4 * (imageHeight - y - 1));
+        for (int i = 0; i < imageWidth * 4; i += 4)
+            memcpy(destRow + i, srcRow + i, 4);
     }
 
     SkBitmap canvasBitmap;

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (123701 => 123702)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2012-07-26 02:46:37 UTC (rev 123701)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp	2012-07-26 02:52:45 UTC (rev 123702)
@@ -122,7 +122,7 @@
 
 #if PLATFORM(BLACKBERRY)
     paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight,
-                  imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context(), true);
+                  imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context());
 #else
     paintToCanvas(pixels.get(), m_currentWidth, m_currentHeight,
                   imageBuffer->internalSize().width(), imageBuffer->internalSize().height(), imageBuffer->context()->platformContext());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to