Title: [121462] trunk/Source/WebCore
Revision
121462
Author
[email protected]
Date
2012-06-28 13:33:59 -0700 (Thu, 28 Jun 2012)

Log Message

[Qt] Fix TextureMapper rendering of GraphicsSurface on Mac
https://bugs.webkit.org/show_bug.cgi?id=90154

Patch by Jocelyn Turcotte <[email protected]> on 2012-06-28
Reviewed by Noam Rosenthal.

Fix a regression introduced in r120608.
texture2DRect takes texel coordinates, unlike texture2D which needs normalized coordinates.

Pass an additional textureSize uniform and multiply it by the normalized coordinates.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTextureRectangleARB):
* platform/graphics/texmap/TextureMapperShaderManager.cpp:
(WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
(WebCore::TextureMapperShaderProgramRectSimple::TextureMapperShaderProgramRectSimple):
* platform/graphics/texmap/TextureMapperShaderManager.h:
(WebCore::TextureMapperShaderProgram::textureSizeLocation):
(TextureMapperShaderProgram):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121461 => 121462)


--- trunk/Source/WebCore/ChangeLog	2012-06-28 20:28:42 UTC (rev 121461)
+++ trunk/Source/WebCore/ChangeLog	2012-06-28 20:33:59 UTC (rev 121462)
@@ -1,3 +1,24 @@
+2012-06-28  Jocelyn Turcotte  <[email protected]>
+
+        [Qt] Fix TextureMapper rendering of GraphicsSurface on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=90154
+
+        Reviewed by Noam Rosenthal.
+
+        Fix a regression introduced in r120608.
+        texture2DRect takes texel coordinates, unlike texture2D which needs normalized coordinates.
+
+        Pass an additional textureSize uniform and multiply it by the normalized coordinates.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawTextureRectangleARB):
+        * platform/graphics/texmap/TextureMapperShaderManager.cpp:
+        (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
+        (WebCore::TextureMapperShaderProgramRectSimple::TextureMapperShaderProgramRectSimple):
+        * platform/graphics/texmap/TextureMapperShaderManager.h:
+        (WebCore::TextureMapperShaderProgram::textureSizeLocation):
+        (TextureMapperShaderProgram):
+
 2012-06-28  Simon Fraser  <[email protected]>
 
         Improve compositing logging output

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (121461 => 121462)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-06-28 20:28:42 UTC (rev 121461)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-06-28 20:33:59 UTC (rev 121462)
@@ -382,6 +382,7 @@
     GL_CMD(glUniform1i(program->sourceTextureLocation(), 0));
 
     GL_CMD(glUniform1f(program->flipLocation(), !!(flags & ShouldFlipTexture)));
+    GL_CMD(glUniform2f(program->textureSizeLocation(), textureSize.width(), textureSize.height()));
 
     if (TextureMapperShaderProgram::isValidUniformLocation(program->opacityLocation()))
         GL_CMD(glUniform1f(program->opacityLocation(), opacity));

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp (121461 => 121462)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp	2012-06-28 20:28:42 UTC (rev 121461)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.cpp	2012-06-28 20:33:59 UTC (rev 121462)
@@ -108,11 +108,12 @@
 static const char* fragmentShaderSourceRectSimple =
     FRAGMENT_SHADER(
         uniform sampler2DRect s_source;
+        uniform lowp vec2 u_textureSize;
         uniform lowp float u_opacity;
         varying highp vec2 v_sourceTexCoord;
         void main(void)
         {
-            lowp vec4 color = texture2DRect(s_source, v_sourceTexCoord);
+            lowp vec4 color = texture2DRect(s_source, u_textureSize * v_sourceTexCoord);
             gl_FragColor = vec4(color.rgb * u_opacity, color.a * u_opacity);
         }
     );
@@ -195,6 +196,7 @@
     , m_fragmentShader(0)
     , m_matrixLocation(-1)
     , m_flipLocation(-1)
+    , m_textureSizeLocation(-1)
     , m_sourceTextureLocation(-1)
     , m_opacityLocation(-1)
     , m_maskTextureLocation(-1)
@@ -265,8 +267,9 @@
     : TextureMapperShaderProgram(vertexShaderSourceSimple, fragmentShaderSourceRectSimple)
 {
     initializeProgram();
+    getUniformLocation(m_matrixLocation, "u_matrix");
     getUniformLocation(m_flipLocation, "u_flip");
-    getUniformLocation(m_matrixLocation, "u_matrix");
+    getUniformLocation(m_textureSizeLocation, "u_textureSize");
     getUniformLocation(m_sourceTextureLocation, "s_source");
     getUniformLocation(m_opacityLocation, "u_opacity");
 }

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h (121461 => 121462)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h	2012-06-28 20:28:42 UTC (rev 121461)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h	2012-06-28 20:33:59 UTC (rev 121462)
@@ -53,6 +53,7 @@
     virtual void prepare(float opacity, const BitmapTexture*) { }
     GLint matrixLocation() const { return m_matrixLocation; }
     GLint flipLocation() const { return m_flipLocation; }
+    GLint textureSizeLocation() const { return m_textureSizeLocation; }
     GLint sourceTextureLocation() const { return m_sourceTextureLocation; }
     GLint maskTextureLocation() const { return m_maskTextureLocation; }
     GLint opacityLocation() const { return m_opacityLocation; }
@@ -72,6 +73,7 @@
     GLuint m_fragmentShader;
     GLint m_matrixLocation;
     GLint m_flipLocation;
+    GLint m_textureSizeLocation;
     GLint m_sourceTextureLocation;
     GLint m_opacityLocation;
     GLint m_maskTextureLocation;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to