Title: [126759] trunk/Source/WebCore
Revision
126759
Author
[email protected]
Date
2012-08-27 07:20:46 -0700 (Mon, 27 Aug 2012)

Log Message

Implement GraphicsSurface::paintToTextureMapper.
https://bugs.webkit.org/show_bug.cgi?id=95077

Forward paintToTextureMapper call directly into
GraphicsSurface. This allows getting rid of platform
specific code in TextureMapperSurfaceBackingStore.

Reviewed by Noam Rosenthal.

* platform/graphics/surfaces/GraphicsSurface.cpp:
(WebCore::GraphicsSurface::paintToTextureMapper):
(WebCore):
* platform/graphics/surfaces/GraphicsSurface.h:
(WebCore):
(GraphicsSurface):
* platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
(WebCore::GraphicsSurface::platformPaintToTextureMapper):
(WebCore):
* platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp:
(WebCore):
(WebCore::GraphicsSurface::platformPaintToTextureMapper):
* platform/graphics/texmap/TextureMapperBackingStore.cpp:
(WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126758 => 126759)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 14:20:46 UTC (rev 126759)
@@ -1,3 +1,29 @@
+2012-08-27  Zeno Albisser  <[email protected]>
+
+        Implement GraphicsSurface::paintToTextureMapper.
+        https://bugs.webkit.org/show_bug.cgi?id=95077
+
+        Forward paintToTextureMapper call directly into
+        GraphicsSurface. This allows getting rid of platform
+        specific code in TextureMapperSurfaceBackingStore.
+
+        Reviewed by Noam Rosenthal.
+
+        * platform/graphics/surfaces/GraphicsSurface.cpp:
+        (WebCore::GraphicsSurface::paintToTextureMapper):
+        (WebCore):
+        * platform/graphics/surfaces/GraphicsSurface.h:
+        (WebCore):
+        (GraphicsSurface):
+        * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp:
+        (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+        (WebCore):
+        * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp:
+        (WebCore):
+        (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+        * platform/graphics/texmap/TextureMapperBackingStore.cpp:
+        (WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper):
+
 2012-08-27  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: filter out weak references from retainers tree

Modified: trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp (126758 => 126759)


--- trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp	2012-08-27 14:20:46 UTC (rev 126759)
@@ -63,6 +63,11 @@
     platformCopyFromFramebuffer(fbo, sourceRect);
 }
 
+void GraphicsSurface::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
+{
+    platformPaintToTextureMapper(textureMapper, targetRect, transform, opacity, mask);
+}
+
 uint32_t GraphicsSurface::frontBuffer()
 {
     return platformFrontBuffer();

Modified: trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h (126758 => 126759)


--- trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h	2012-08-27 14:20:46 UTC (rev 126759)
@@ -38,6 +38,8 @@
 
 namespace WebCore {
 
+class BitmapTexture;
+class TextureMapper;
 struct GraphicsSurfacePrivate;
 
 class GraphicsSurface : public RefCounted<GraphicsSurface> {
@@ -70,6 +72,7 @@
     static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags, uint64_t token);
     void copyToGLTexture(uint32_t target, uint32_t texture, const IntRect& targetRect, const IntPoint& sourceOffset);
     void copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRect);
+    void paintToTextureMapper(TextureMapper*, const FloatRect& targetRect, const TransformationMatrix&, float opacity, BitmapTexture* mask);
     uint32_t frontBuffer();
     uint32_t swapBuffers();
     uint64_t exportToken();
@@ -89,6 +92,7 @@
     void platformUnlock();
     void platformCopyToGLTexture(uint32_t target, uint32_t texture, const IntRect&, const IntPoint&);
     void platformCopyFromFramebuffer(uint32_t fbo, const IntRect& sourceRect);
+    void platformPaintToTextureMapper(TextureMapper*, const FloatRect& targetRect, const TransformationMatrix&, float opacity, BitmapTexture* mask);
     uint32_t platformFrontBuffer() const;
     uint32_t platformSwapBuffers();
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp (126758 => 126759)


--- trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp	2012-08-27 14:20:46 UTC (rev 126759)
@@ -21,6 +21,7 @@
 #include "GraphicsSurface.h"
 
 #if USE(GRAPHICS_SURFACE) && OS(DARWIN)
+#include "TextureMapperGL.h"
 #include <CFNumber.h>
 #include <CGLContext.h>
 #include <CGLCurrent.h>
@@ -241,6 +242,13 @@
     glFlush();
 }
 
+void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
+{
+    TransformationMatrix adjustedTransform = transform;
+    adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_size), targetRect));
+    static_cast<TextureMapperGL*>(textureMapper)->drawTextureRectangleARB(m_private->frontBufferTextureID(), 0, m_size, targetRect, adjustedTransform, opacity, mask);
+}
+
 uint32_t GraphicsSurface::platformFrontBuffer() const
 {
     return IOSurfaceGetID(m_private->frontBuffer());

Modified: trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp (126758 => 126759)


--- trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp	2012-08-27 14:20:46 UTC (rev 126759)
@@ -22,6 +22,7 @@
 
 #if USE(GRAPHICS_SURFACE)
 
+#include "TextureMapperGL.h"
 // Qt headers must be included before glx headers.
 #include <QCoreApplication>
 #include <QOpenGLContext>
@@ -277,6 +278,14 @@
     glPopAttrib();
 }
 
+
+void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
+{
+    TransformationMatrix adjustedTransform = transform;
+    adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_size), targetRect));
+    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(platformGetTextureID(), 0, m_size, targetRect, adjustedTransform, opacity, mask);
+}
+
 uint32_t GraphicsSurface::platformFrontBuffer() const
 {
     return 0;

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp (126758 => 126759)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp	2012-08-27 14:15:13 UTC (rev 126758)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp	2012-08-27 14:20:46 UTC (rev 126759)
@@ -58,14 +58,7 @@
 
 void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask)
 {
-    TransformationMatrix adjustedTransform = transform;
-    adjustedTransform.multiply(TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_graphicsSurfaceSize), targetRect));
-#if OS(DARWIN)
-    // This is specific to the Mac implementation of GraphicsSurface. IOSurface requires GL_TEXTURE_RECTANGLE_ARB to be used.
-    static_cast<TextureMapperGL*>(textureMapper)->drawTextureRectangleARB(m_graphicsSurface->getTextureID(), 0, m_graphicsSurfaceSize, targetRect, adjustedTransform, opacity, mask);
-#else
-    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(m_graphicsSurface->getTextureID(), 0, m_graphicsSurfaceSize, targetRect, adjustedTransform, opacity, mask);
-#endif
+    m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity, mask);
 }
 
 void TextureMapperSurfaceBackingStore::setSurface(PassRefPtr<GraphicsSurface> surface)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to