Title: [95939] trunk/Source/WebCore
Revision
95939
Author
noam.rosent...@nokia.com
Date
2011-09-26 03:51:59 -0700 (Mon, 26 Sep 2011)

Log Message

[Texmap][Qt] Enable TextureMapperGL in platforms where BGRA is not present
https://bugs.webkit.org/show_bug.cgi?id=65473

Reviewed by Andreas Kling.

For now, swap RGBA->BGRA in software if we're in OpenGL ES 2.
We do that by iterating on the pixels and manually swapping each pixel's red and blue
values. This can be done faster with shaders, but for now this is a working solution
for platforms without BGRA support.

No new tests. Existing layout tests cover this.

* platform/graphics/opengl/TextureMapperGL.cpp:
(WebCore::BitmapTextureGL::endPaint):
* platform/graphics/opengl/TextureMapperGL.h:
* platform/graphics/qt/TextureMapperQt.cpp:
(WebCore::RGBA32PremultimpliedBufferQt::swapRGB):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95938 => 95939)


--- trunk/Source/WebCore/ChangeLog	2011-09-26 09:05:02 UTC (rev 95938)
+++ trunk/Source/WebCore/ChangeLog	2011-09-26 10:51:59 UTC (rev 95939)
@@ -1,3 +1,23 @@
+2011-09-26  No'am Rosenthal  <noam.rosent...@nokia.com>
+
+        [Texmap][Qt] Enable TextureMapperGL in platforms where BGRA is not present
+        https://bugs.webkit.org/show_bug.cgi?id=65473
+
+        Reviewed by Andreas Kling.
+
+        For now, swap RGBA->BGRA in software if we're in OpenGL ES 2.
+        We do that by iterating on the pixels and manually swapping each pixel's red and blue
+        values. This can be done faster with shaders, but for now this is a working solution
+        for platforms without BGRA support.
+
+        No new tests. Existing layout tests cover this.
+
+        * platform/graphics/opengl/TextureMapperGL.cpp:
+        (WebCore::BitmapTextureGL::endPaint):
+        * platform/graphics/opengl/TextureMapperGL.h:
+        * platform/graphics/qt/TextureMapperQt.cpp:
+        (WebCore::RGBA32PremultimpliedBufferQt::swapRGB):
+
 2011-09-26  Sergio Villar Senin  <svil...@igalia.com>
 
         [GTK] Fix coding style bits in ResourceHandleSoup.cpp

Modified: trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp (95938 => 95939)


--- trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2011-09-26 09:05:02 UTC (rev 95938)
+++ trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp	2011-09-26 10:51:59 UTC (rev 95939)
@@ -534,7 +534,13 @@
         return;
     m_buffer->endPaint();
     GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id))
+#ifdef TEXMAP_OPENGL_ES_2
+    // FIXME: use shaders for RGBA->BGRA swap if this becomes a performance issue.
+    m_buffer->swapRGB();
+    GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirtyRect.x(), m_dirtyRect.y(), m_dirtyRect.width(), m_dirtyRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, m_buffer->data()))
+#else
     GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirtyRect.x(), m_dirtyRect.y(), m_dirtyRect.width(), m_dirtyRect.height(), GL_BGRA, GL_UNSIGNED_BYTE, m_buffer->data()))
+#endif
     m_buffer.clear();
 }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h (95938 => 95939)


--- trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h	2011-09-26 09:05:02 UTC (rev 95938)
+++ trunk/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h	2011-09-26 10:51:59 UTC (rev 95939)
@@ -67,6 +67,7 @@
 public:
     virtual ~RGBA32PremultimpliedBuffer() {}
     virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque) = 0;
+    virtual void swapRGB() = 0;
     virtual void endPaint() = 0;
     virtual const void* data() const = 0;
     static PassRefPtr<RGBA32PremultimpliedBuffer> create();

Modified: trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp (95938 => 95939)


--- trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp	2011-09-26 09:05:02 UTC (rev 95938)
+++ trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp	2011-09-26 10:51:59 UTC (rev 95939)
@@ -228,6 +228,11 @@
         return &m_painter;
     }
 
+    void swapRGB()
+    {
+        m_image = m_image.rgbSwapped();
+    }
+
     virtual void endPaint() { m_painter.end(); }
     virtual const void* data() const { return m_image.constBits(); }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to