[TexMap] Operate with a reference to the TextureMapper wherever possible
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2015 11:54:13 +0000 (11:54 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2015 11:54:13 +0000 (11:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152118

Reviewed by Martin Robinson.

Source/WebCore:

In most cases where used, the pointer to the TextureMapper is non-null, so it
should really be a reference. The pointer is still used for the
TextureMapperLayer member variable which is null until the TextureMapper object
is created and set on the root layer.

* platform/graphics/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
* platform/graphics/GraphicsContext3DPrivate.h:
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBufferData::paintToTextureMapper):
* platform/graphics/cairo/ImageBufferDataCairo.h:
* platform/graphics/efl/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
* platform/graphics/efl/GraphicsContext3DPrivate.h:
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/surfaces/GraphicsSurface.cpp:
(WebCore::GraphicsSurface::paintToTextureMapper):
* platform/graphics/surfaces/GraphicsSurface.h:
* platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp:
(WebCore::GraphicsSurface::platformPaintToTextureMapper):
* platform/graphics/texmap/BitmapTexture.cpp:
(WebCore::BitmapTexture::updateContents):
* platform/graphics/texmap/BitmapTexture.h:
(WebCore::BitmapTexture::applyFilters):
* platform/graphics/texmap/BitmapTextureGL.cpp:
(WebCore::BitmapTextureGL::applyFilters):
* platform/graphics/texmap/BitmapTextureGL.h:
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
* platform/graphics/texmap/TextureMapperBackingStore.h:
(WebCore::TextureMapperBackingStore::drawRepaintCounter):
* platform/graphics/texmap/TextureMapperFPSCounter.cpp:
(WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
* platform/graphics/texmap/TextureMapperFPSCounter.h:
* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperPaintOptions::TextureMapperPaintOptions):
(WebCore::TextureMapperLayer::paint):
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::paintSelfAndChildren):
(WebCore::TextureMapperLayer::paintUsingOverlapRegions):
(WebCore::TextureMapperLayer::applyMask):
(WebCore::TextureMapperLayer::paintIntoSurface):
(WebCore::commitSurface):
(WebCore::TextureMapperLayer::paintWithIntermediateSurface):
* platform/graphics/texmap/TextureMapperPlatformLayer.h:
(WebCore::TextureMapperPlatformLayer::drawBorder):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
* platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp:
(WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper):
* platform/graphics/texmap/TextureMapperSurfaceBackingStore.h:
* platform/graphics/texmap/TextureMapperTile.cpp:
(WebCore::TextureMapperTile::updateContents):
(WebCore::TextureMapperTile::paint):
* platform/graphics/texmap/TextureMapperTile.h:
* platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
(WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
(WebCore::TextureMapperTiledBackingStore::paintToTextureMapper):
(WebCore::TextureMapperTiledBackingStore::drawBorder):
(WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
(WebCore::TextureMapperTiledBackingStore::updateContents):
* platform/graphics/texmap/TextureMapperTiledBackingStore.h:

Source/WebKit/win:

* WebCoreSupport/AcceleratedCompositingContext.cpp:
(AcceleratedCompositingContext::compositeLayersToContext): TextureMapper object
is now operated with through a reference.

Source/WebKit2:

Replace pointers to the TextureMapper object with references.

* Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
(WebKit::CoordinatedBackingStoreTile::swapBuffers):
(WebKit::CoordinatedBackingStore::paintTilesToTextureMapper):
(WebKit::CoordinatedBackingStore::paintToTextureMapper):
(WebKit::CoordinatedBackingStore::drawBorder):
(WebKit::CoordinatedBackingStore::drawRepaintCounter):
(WebKit::CoordinatedBackingStore::commitTileOperations):
* Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
(WebKit::CoordinatedGraphicsScene::paintToGraphicsContext):
(WebKit::CoordinatedGraphicsScene::commitPendingBackingStoreOperations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194103 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp
Source/WebCore/platform/graphics/GraphicsContext3DPrivate.h
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp
Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h
Source/WebCore/platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp
Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp
Source/WebCore/platform/graphics/texmap/BitmapTexture.h
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp
Source/WebCore/platform/graphics/texmap/BitmapTextureGL.h
Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperFPSCounter.h
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h
Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperSurfaceBackingStore.h
Source/WebCore/platform/graphics/texmap/TextureMapperTile.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperTile.h
Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperTiledBackingStore.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/AcceleratedCompositingContext.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.h
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

index d656d13..b78938f 100644 (file)
@@ -1,3 +1,76 @@
+2015-12-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [TexMap] Operate with a reference to the TextureMapper wherever possible
+        https://bugs.webkit.org/show_bug.cgi?id=152118
+
+        Reviewed by Martin Robinson.
+
+        In most cases where used, the pointer to the TextureMapper is non-null, so it
+        should really be a reference. The pointer is still used for the
+        TextureMapperLayer member variable which is null until the TextureMapper object
+        is created and set on the root layer.
+
+        * platform/graphics/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
+        * platform/graphics/GraphicsContext3DPrivate.h:
+        * platform/graphics/cairo/ImageBufferCairo.cpp:
+        (WebCore::ImageBufferData::paintToTextureMapper):
+        * platform/graphics/cairo/ImageBufferDataCairo.h:
+        * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::paintToTextureMapper):
+        * platform/graphics/efl/GraphicsContext3DPrivate.h:
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+        (WebCore::MediaPlayerPrivateGStreamerBase::paintToTextureMapper):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+        * platform/graphics/surfaces/GraphicsSurface.cpp:
+        (WebCore::GraphicsSurface::paintToTextureMapper):
+        * platform/graphics/surfaces/GraphicsSurface.h:
+        * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp:
+        (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+        * platform/graphics/texmap/BitmapTexture.cpp:
+        (WebCore::BitmapTexture::updateContents):
+        * platform/graphics/texmap/BitmapTexture.h:
+        (WebCore::BitmapTexture::applyFilters):
+        * platform/graphics/texmap/BitmapTextureGL.cpp:
+        (WebCore::BitmapTextureGL::applyFilters):
+        * platform/graphics/texmap/BitmapTextureGL.h:
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
+        * platform/graphics/texmap/TextureMapperBackingStore.h:
+        (WebCore::TextureMapperBackingStore::drawRepaintCounter):
+        * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
+        (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay):
+        * platform/graphics/texmap/TextureMapperFPSCounter.h:
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperPaintOptions::TextureMapperPaintOptions):
+        (WebCore::TextureMapperLayer::paint):
+        (WebCore::TextureMapperLayer::paintSelf):
+        (WebCore::TextureMapperLayer::paintSelfAndChildren):
+        (WebCore::TextureMapperLayer::paintUsingOverlapRegions):
+        (WebCore::TextureMapperLayer::applyMask):
+        (WebCore::TextureMapperLayer::paintIntoSurface):
+        (WebCore::commitSurface):
+        (WebCore::TextureMapperLayer::paintWithIntermediateSurface):
+        * platform/graphics/texmap/TextureMapperPlatformLayer.h:
+        (WebCore::TextureMapperPlatformLayer::drawBorder):
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
+        (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
+        * platform/graphics/texmap/TextureMapperSurfaceBackingStore.cpp:
+        (WebCore::TextureMapperSurfaceBackingStore::paintToTextureMapper):
+        * platform/graphics/texmap/TextureMapperSurfaceBackingStore.h:
+        * platform/graphics/texmap/TextureMapperTile.cpp:
+        (WebCore::TextureMapperTile::updateContents):
+        (WebCore::TextureMapperTile::paint):
+        * platform/graphics/texmap/TextureMapperTile.h:
+        * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
+        (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
+        (WebCore::TextureMapperTiledBackingStore::paintToTextureMapper):
+        (WebCore::TextureMapperTiledBackingStore::drawBorder):
+        (WebCore::TextureMapperTiledBackingStore::drawRepaintCounter):
+        (WebCore::TextureMapperTiledBackingStore::updateContents):
+        * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
+
 2015-12-15  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         WebIDL generator should support the possibility for C++ classes to have a JS Builtin constructor
index 55b335f..b134f5a 100644 (file)
@@ -112,7 +112,7 @@ void GraphicsContext3DPrivate::swapBuffersIfNeeded()
     m_context->markLayerComposited();
 }
 #elif USE(TEXTURE_MAPPER) && !USE(COORDINATED_GRAPHICS_THREADED)
-void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
+void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
 {
     if (!m_glContext)
         return;
@@ -134,10 +134,10 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper
             previousActiveContext->makeContextCurrent();
     }
 
-    TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper);
+    TextureMapperGL& texmapGL = static_cast<TextureMapperGL&>(textureMapper);
     TextureMapperGL::Flags flags = TextureMapperGL::ShouldFlipTexture | (m_context->m_attrs.alpha ? TextureMapperGL::ShouldBlend : 0);
     IntSize textureSize(m_context->m_currentWidth, m_context->m_currentHeight);
-    texmapGL->drawTexture(m_context->m_texture, flags, textureSize, targetRect, matrix, opacity);
+    texmapGL.drawTexture(m_context->m_texture, flags, textureSize, targetRect, matrix, opacity);
 #endif // USE(TEXTURE_MAPPER_GL)
 }
 #endif // USE(TEXTURE_MAPPER)
index 8564d83..8918d38 100644 (file)
@@ -51,7 +51,7 @@ public:
     virtual RefPtr<TextureMapperPlatformLayerProxy> proxy() const override;
     virtual void swapBuffersIfNeeded() override;
 #elif USE(TEXTURE_MAPPER)
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity);
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect& target, const TransformationMatrix&, float opacity);
 #endif
 
 private:
index 2372bd7..6fb0806 100644 (file)
@@ -468,7 +468,7 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*, CoordinateS
 #endif
 
 #if ENABLE(ACCELERATED_2D_CANVAS) && !USE(COORDINATED_GRAPHICS_THREADED)
-void ImageBufferData::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
+void ImageBufferData::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
 {
     ASSERT(m_texture);
 
@@ -477,7 +477,7 @@ void ImageBufferData::paintToTextureMapper(TextureMapper* textureMapper, const F
     cairo_surface_flush(m_surface.get());
     previousActiveContext->makeContextCurrent();
 
-    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(m_texture, TextureMapperGL::ShouldBlend, m_size, targetRect, matrix, opacity);
+    static_cast<TextureMapperGL&>(textureMapper).drawTexture(m_texture, TextureMapperGL::ShouldBlend, m_size, targetRect, matrix, opacity);
 }
 #endif
 
index 1e58685..832e40d 100644 (file)
@@ -74,7 +74,7 @@ public:
     uint32_t m_compositorTexture;
     RefPtr<cairo_t> m_compositorCr;
 #else
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity);
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect& target, const TransformationMatrix&, float opacity);
 #endif
     uint32_t m_texture;
 #endif
index 16627f4..72ec32c 100644 (file)
@@ -159,7 +159,7 @@ bool GraphicsContext3DPrivate::prepareBuffer() const
     return true;
 }
 
-void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper*, const FloatRect& /* target */, const TransformationMatrix&, float /* opacity */)
+void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper&, const FloatRect& /* target */, const TransformationMatrix&, float /* opacity */)
 {
     notImplemented();
 }
index c8c934a..5789bf9 100644 (file)
@@ -36,7 +36,7 @@ public:
 
     PlatformGraphicsContext3D platformGraphicsContext3D() const;
     void setContextLostCallback(std::unique_ptr<GraphicsContext3D::ContextLostCallback>);
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float) override;
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float) override;
     virtual IntSize platformLayerSize() const override;
     virtual uint32_t copyToGraphicsSurface() override;
     virtual GraphicsSurfaceToken graphicsSurfaceToken() const override;
index ab2fdcc..f5a41fe 100644 (file)
@@ -626,7 +626,7 @@ void MediaPlayerPrivateGStreamerBase::paint(GraphicsContext& context, const Floa
 }
 
 #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
-void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
+void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity)
 {
     if (!m_player->visible())
         return;
@@ -649,10 +649,10 @@ void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper* textur
                 return;
 
             IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
-            texture = textureMapper->acquireTextureFromPool(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
+            texture = textureMapper.acquireTextureFromPool(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
             updateTexture(static_cast<BitmapTextureGL&>(*texture), videoInfo);
         }
-        textureMapper->drawTexture(*texture, targetRect, matrix, opacity);
+        textureMapper.drawTexture(*texture, targetRect, matrix, opacity);
         return;
     }
 
@@ -678,8 +678,8 @@ void MediaPlayerPrivateGStreamerBase::paintToTextureMapper(TextureMapper* textur
     TextureMapperGL::Flags flags = GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? TextureMapperGL::ShouldBlend : 0;
 
     IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
-    TextureMapperGL* textureMapperGL = reinterpret_cast<TextureMapperGL*>(textureMapper);
-    textureMapperGL->drawTexture(textureID, flags, size, targetRect, matrix, opacity);
+    TextureMapperGL& textureMapperGL = reinterpret_cast<TextureMapperGL&>(textureMapper);
+    textureMapperGL.drawTexture(textureID, flags, size, targetRect, matrix, opacity);
     gst_video_frame_unmap(&videoFrame);
 #endif
 }
index 6c9fb9a..5f241a8 100644 (file)
@@ -110,7 +110,7 @@ public:
 #else
     virtual bool supportsAcceleratedRendering() const override { return true; }
 #endif
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float) override;
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float) override;
 #endif
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
index 2442e37..8fa5ab5 100644 (file)
@@ -63,7 +63,7 @@ void GraphicsSurface::copyFromTexture(uint32_t texture, const IntRect& sourceRec
     platformCopyFromTexture(texture, sourceRect);
 }
 
-void GraphicsSurface::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
+void GraphicsSurface::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
 {
     platformPaintToTextureMapper(textureMapper, targetRect, transform, opacity);
 }
index 5bb812c..74d8f15 100644 (file)
@@ -77,7 +77,7 @@ public:
     static PassRefPtr<GraphicsSurface> create(const IntSize&, Flags, const GraphicsSurfaceToken&);
     void copyToGLTexture(uint32_t target, uint32_t texture, const IntRect& targetRect, const IntPoint& sourceOffset);
     void copyFromTexture(uint32_t texture, const IntRect& sourceRect);
-    void paintToTextureMapper(TextureMapper*, const FloatRect& targetRect, const TransformationMatrix&, float opacity);
+    void paintToTextureMapper(TextureMapper&, const FloatRect& targetRect, const TransformationMatrix&, float opacity);
     uint32_t frontBuffer();
     uint32_t swapBuffers();
     GraphicsSurfaceToken exportToken();
@@ -97,7 +97,7 @@ protected:
     void platformUnlock();
     void platformCopyToGLTexture(uint32_t target, uint32_t texture, const IntRect&, const IntPoint&);
     void platformCopyFromTexture(uint32_t texture, const IntRect& sourceRect);
-    void platformPaintToTextureMapper(TextureMapper*, const FloatRect& targetRect, const TransformationMatrix&, float opacity);
+    void platformPaintToTextureMapper(TextureMapper&, const FloatRect& targetRect, const TransformationMatrix&, float opacity);
     uint32_t platformFrontBuffer() const;
     uint32_t platformSwapBuffers();
     IntSize platformSize() const;
index e06a128..ec13040 100644 (file)
@@ -175,7 +175,7 @@ void GraphicsSurface::platformCopyFromTexture(uint32_t textureId, const IntRect&
     m_private->copyFromTexture(textureId);
 }
 
-void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
+void GraphicsSurface::platformPaintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
 {
     uint32_t texture = platformGetTextureID();
     if (!texture)
@@ -183,7 +183,7 @@ void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper,
 
     TransformationMatrix adjustedTransform = transform;
     adjustedTransform.multiply(TransformationMatrix::rectToRect(m_private->rect(), targetRect));
-    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(texture, m_private->flags(), m_private->size(), m_private->rect(), adjustedTransform, opacity);
+    static_cast<TextureMapperGL&>(textureMapper).drawTexture(texture, m_private->flags(), m_private->size(), m_private->rect(), adjustedTransform, opacity);
 }
 
 uint32_t GraphicsSurface::platformFrontBuffer() const
index f99e9c1..552d1c6 100644 (file)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-void BitmapTexture::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag, float scale)
+void BitmapTexture::updateContents(TextureMapper& textureMapper, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag, float scale)
 {
     // Making an unconditionally unaccelerated buffer here is OK because this code
     // isn't used by any platforms that respect the accelerated bit.
@@ -43,8 +43,8 @@ void BitmapTexture::updateContents(TextureMapper* textureMapper, GraphicsLayer*
         return;
 
     GraphicsContext& context = imageBuffer->context();
-    context.setImageInterpolationQuality(textureMapper->imageInterpolationQuality());
-    context.setTextDrawingMode(textureMapper->textDrawingMode());
+    context.setImageInterpolationQuality(textureMapper.imageInterpolationQuality());
+    context.setTextDrawingMode(textureMapper.textDrawingMode());
 
     IntRect sourceRect(targetRect);
     sourceRect.setLocation(offset);
index adf9e58..e9c7d06 100644 (file)
@@ -65,7 +65,7 @@ public:
 
     virtual IntSize size() const = 0;
     virtual void updateContents(Image*, const IntRect&, const IntPoint& offset, UpdateContentsFlag) = 0;
-    virtual void updateContents(TextureMapper*, GraphicsLayer*, const IntRect& target, const IntPoint& offset, UpdateContentsFlag, float scale = 1);
+    virtual void updateContents(TextureMapper&, GraphicsLayer*, const IntRect& target, const IntPoint& offset, UpdateContentsFlag, float scale = 1);
     virtual void updateContents(const void*, const IntRect& target, const IntPoint& offset, int bytesPerLine, UpdateContentsFlag) = 0;
     virtual bool isValid() const = 0;
     inline Flags flags() const { return m_flags; }
@@ -83,7 +83,7 @@ public:
     inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; }
     inline bool isOpaque() const { return !(m_flags & SupportsAlpha); }
 
-    virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const FilterOperations&) { return this; }
+    virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper&, const FilterOperations&) { return this; }
 
 protected:
     IntSize m_contentSize;
index 82436c4..2a9fb85 100644 (file)
@@ -221,13 +221,13 @@ static unsigned getPassesRequiredForFilter(FilterOperation::OperationType type)
     }
 }
 
-PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper* textureMapper, const FilterOperations& filters)
+PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper& textureMapper, const FilterOperations& filters)
 {
     if (filters.isEmpty())
         return this;
 
-    TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper);
-    RefPtr<BitmapTexture> previousSurface = texmapGL->currentSurface();
+    TextureMapperGL& texmapGL = static_cast<TextureMapperGL&>(textureMapper);
+    RefPtr<BitmapTexture> previousSurface = texmapGL.currentSurface();
     RefPtr<BitmapTexture> resultSurface = this;
     RefPtr<BitmapTexture> intermediateSurface;
     RefPtr<BitmapTexture> spareSurface;
@@ -243,8 +243,8 @@ PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper* textureMa
             bool last = (i == filters.size() - 1) && (j == numPasses - 1);
             if (!last) {
                 if (!intermediateSurface)
-                    intermediateSurface = texmapGL->acquireTextureFromPool(contentSize());
-                texmapGL->bindSurface(intermediateSurface.get());
+                    intermediateSurface = texmapGL.acquireTextureFromPool(contentSize());
+                texmapGL.bindSurface(intermediateSurface.get());
             }
 
             if (last) {
@@ -252,7 +252,7 @@ PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper* textureMa
                 break;
             }
 
-            texmapGL->drawFiltered(*resultSurface.get(), spareSurface.get(), *filter, j);
+            texmapGL.drawFiltered(*resultSurface.get(), spareSurface.get(), *filter, j);
             if (!j && filter->type() == FilterOperation::DROP_SHADOW) {
                 spareSurface = resultSurface;
                 resultSurface = nullptr;
@@ -261,7 +261,7 @@ PassRefPtr<BitmapTexture> BitmapTextureGL::applyFilters(TextureMapper* textureMa
         }
     }
 
-    texmapGL->bindSurface(previousSurface.get());
+    texmapGL.bindSurface(previousSurface.get());
     return resultSurface;
 }
 
index d5d6738..27114bb 100644 (file)
@@ -54,7 +54,7 @@ public:
     void updateContentsNoSwizzle(const void*, const IntRect& target, const IntPoint& sourceOffset, int bytesPerLine, unsigned bytesPerPixel = 4, Platform3DObject glFormat = GraphicsContext3D::RGBA);
     virtual bool isBackedByOpenGL() const override { return true; }
 
-    virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper*, const FilterOperations&) override;
+    virtual PassRefPtr<BitmapTexture> applyFilters(TextureMapper&, const FilterOperations&) override;
     struct FilterInfo {
         RefPtr<FilterOperation> filter;
         unsigned pass;
index ceda82d..c154929 100644 (file)
@@ -549,7 +549,7 @@ void GraphicsLayerTextureMapper::updateBackingStoreIfNeeded()
     backingStore->updateContentsScale(pageScaleFactor() * deviceScaleFactor());
 
     dirtyRect.scale(pageScaleFactor() * deviceScaleFactor());
-    backingStore->updateContents(textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
+    backingStore->updateContents(*textureMapper, this, m_size, dirtyRect, BitmapTexture::UpdateCanModifyOriginalImageData);
 
     m_needsDisplay = false;
     m_needsDisplayRect = IntRect();
index 076d01b..3135ca0 100644 (file)
@@ -39,8 +39,8 @@ class GraphicsLayer;
 class TextureMapperBackingStore : public TextureMapperPlatformLayer, public RefCounted<TextureMapperBackingStore> {
 public:
     virtual RefPtr<BitmapTexture> texture() const = 0;
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float) = 0;
-    virtual void drawRepaintCounter(TextureMapper*, int /* repaintCount */, const Color&, const FloatRect&, const TransformationMatrix&) { }
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float) = 0;
+    virtual void drawRepaintCounter(TextureMapper&, int /* repaintCount */, const Color&, const FloatRect&, const TransformationMatrix&) { }
     virtual ~TextureMapperBackingStore() { }
 
 protected:
index 2d333af..bc72256 100644 (file)
@@ -46,7 +46,7 @@ TextureMapperFPSCounter::TextureMapperFPSCounter()
     }
 }
 
-void TextureMapperFPSCounter::updateFPSAndDisplay(TextureMapper* textureMapper, const FloatPoint& location, const TransformationMatrix& matrix)
+void TextureMapperFPSCounter::updateFPSAndDisplay(TextureMapper& textureMapper, const FloatPoint& location, const TransformationMatrix& matrix)
 {
     if (!m_isShowingFPS)
         return;
@@ -59,7 +59,7 @@ void TextureMapperFPSCounter::updateFPSAndDisplay(TextureMapper* textureMapper,
         m_fpsTimestamp += delta;
     }
 
-    textureMapper->drawNumber(m_lastFPS, Color::black, location, matrix);
+    textureMapper.drawNumber(m_lastFPS, Color::black, location, matrix);
 }
 
 } // namespace WebCore
index 649989c..5abfd9d 100644 (file)
@@ -35,7 +35,7 @@ class TextureMapperFPSCounter {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     TextureMapperFPSCounter();
-    void updateFPSAndDisplay(TextureMapper*, const FloatPoint& = FloatPoint::zero(), const TransformationMatrix& = TransformationMatrix());
+    void updateFPSAndDisplay(TextureMapper&, const FloatPoint& = FloatPoint::zero(), const TransformationMatrix& = TransformationMatrix());
 
 private:
     bool m_isShowingFPS;
index fc77106..6bde40a 100644 (file)
@@ -31,15 +31,15 @@ namespace WebCore {
 
 class TextureMapperPaintOptions {
 public:
-    RefPtr<BitmapTexture> surface;
-    float opacity;
+    TextureMapperPaintOptions(TextureMapper& textureMapper)
+        : textureMapper(textureMapper)
+    { }
+
+    TextureMapper& textureMapper;
     TransformationMatrix transform;
+    RefPtr<BitmapTexture> surface;
+    float opacity { 1 };
     IntSize offset;
-    TextureMapper* textureMapper;
-    TextureMapperPaintOptions()
-        : opacity(1)
-        , textureMapper(0)
-    { }
 };
 
 void TextureMapperLayer::computeTransformsRecursive()
@@ -78,9 +78,10 @@ void TextureMapperLayer::paint()
 {
     computeTransformsRecursive();
 
-    TextureMapperPaintOptions options;
-    options.textureMapper = m_textureMapper;
-    options.textureMapper->bindSurface(0);
+    ASSERT(m_textureMapper);
+    TextureMapperPaintOptions options(*m_textureMapper);
+    options.textureMapper.bindSurface(0);
+
     paintRecursive(options);
 }
 
@@ -116,14 +117,14 @@ void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
     transform.multiply(m_currentTransform.combined());
 
     if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty() && m_state.solidColor.alpha()) {
-        options.textureMapper->drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, options.opacity));
+        options.textureMapper.drawSolidColor(m_state.contentsRect, transform, blendWithOpacity(m_state.solidColor, options.opacity));
         if (m_state.showDebugBorders)
-            options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
+            options.textureMapper.drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
         return;
     }
 
-    options.textureMapper->setWrapMode(TextureMapper::StretchWrap);
-    options.textureMapper->setPatternTransform(TransformationMatrix());
+    options.textureMapper.setWrapMode(TextureMapper::StretchWrap);
+    options.textureMapper.setPatternTransform(TransformationMatrix());
 
     if (m_backingStore) {
         FloatRect targetRect = layerRect();
@@ -141,8 +142,8 @@ void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
 
     if (!m_state.contentsTileSize.isEmpty()) {
         computePatternTransformIfNeeded();
-        options.textureMapper->setWrapMode(TextureMapper::RepeatWrap);
-        options.textureMapper->setPatternTransform(m_patternTransform);
+        options.textureMapper.setWrapMode(TextureMapper::RepeatWrap);
+        options.textureMapper.setPatternTransform(m_patternTransform);
     }
 
     ASSERT(!layerRect().isEmpty());
@@ -172,14 +173,14 @@ void TextureMapperLayer::paintSelfAndChildren(const TextureMapperPaintOptions& o
         clipTransform.translate(options.offset.width(), options.offset.height());
         clipTransform.multiply(options.transform);
         clipTransform.multiply(m_currentTransform.combined());
-        options.textureMapper->beginClip(clipTransform, layerRect());
+        options.textureMapper.beginClip(clipTransform, layerRect());
     }
 
     for (auto* child : m_children)
         child->paintRecursive(options);
 
     if (shouldClip)
-        options.textureMapper->endClip();
+        options.textureMapper.endClip();
 }
 
 bool TextureMapperLayer::shouldBlend() const
@@ -328,12 +329,12 @@ void TextureMapperLayer::paintUsingOverlapRegions(const TextureMapperPaintOption
     Vector<IntRect> rects = nonOverlapRegion.rects();
 
     for (auto& rect : rects) {
-        if (!rect.intersects(options.textureMapper->clipBounds()))
+        if (!rect.intersects(options.textureMapper.clipBounds()))
             continue;
 
-        options.textureMapper->beginClip(TransformationMatrix(), rect);
+        options.textureMapper.beginClip(TransformationMatrix(), rect);
         paintSelfAndChildrenWithReplica(options);
-        options.textureMapper->endClip();
+        options.textureMapper.endClip();
     }
 
     rects = overlapRegion.rects();
@@ -343,8 +344,8 @@ void TextureMapperLayer::paintUsingOverlapRegions(const TextureMapperPaintOption
         rects.append(overlapRegion.bounds());
     }
 
-    IntSize maxTextureSize = options.textureMapper->maxTextureSize();
-    IntRect adjustedClipBounds(options.textureMapper->clipBounds());
+    IntSize maxTextureSize = options.textureMapper.maxTextureSize();
+    IntRect adjustedClipBounds(options.textureMapper.clipBounds());
     adjustedClipBounds.move(-options.offset);
     for (auto& rect : rects) {
         for (int x = rect.x(); x < rect.maxX(); x += maxTextureSize.width()) {
@@ -362,32 +363,32 @@ void TextureMapperLayer::paintUsingOverlapRegions(const TextureMapperPaintOption
 
 void TextureMapperLayer::applyMask(const TextureMapperPaintOptions& options)
 {
-    options.textureMapper->setMaskMode(true);
+    options.textureMapper.setMaskMode(true);
     paintSelf(options);
-    options.textureMapper->setMaskMode(false);
+    options.textureMapper.setMaskMode(false);
 }
 
 PassRefPtr<BitmapTexture> TextureMapperLayer::paintIntoSurface(const TextureMapperPaintOptions& options, const IntSize& size)
 {
-    RefPtr<BitmapTexture> surface = options.textureMapper->acquireTextureFromPool(size);
+    RefPtr<BitmapTexture> surface = options.textureMapper.acquireTextureFromPool(size);
     TextureMapperPaintOptions paintOptions(options);
     paintOptions.surface = surface;
-    options.textureMapper->bindSurface(surface.get());
+    options.textureMapper.bindSurface(surface.get());
     paintSelfAndChildren(paintOptions);
     if (m_state.maskLayer)
         m_state.maskLayer->applyMask(options);
     surface = surface->applyFilters(options.textureMapper, m_currentFilters);
-    options.textureMapper->bindSurface(surface.get());
+    options.textureMapper.bindSurface(surface.get());
     return surface.release();
 }
 
 static void commitSurface(const TextureMapperPaintOptions& options, PassRefPtr<BitmapTexture> surface, const IntRect& rect, float opacity)
 {
-    options.textureMapper->bindSurface(options.surface.get());
+    options.textureMapper.bindSurface(options.surface.get());
     TransformationMatrix targetTransform;
     targetTransform.translate(options.offset.width(), options.offset.height());
     targetTransform.multiply(options.transform);
-    options.textureMapper->drawTexture(*surface.get(), rect, targetTransform, opacity);
+    options.textureMapper.drawTexture(*surface.get(), rect, targetTransform, opacity);
 }
 
 void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOptions& options, const IntRect& rect)
@@ -413,8 +414,8 @@ void TextureMapperLayer::paintWithIntermediateSurface(const TextureMapperPaintOp
 
     mainSurface = paintIntoSurface(paintOptions, rect.size());
     if (replicaSurface) {
-        options.textureMapper->bindSurface(replicaSurface.get());
-        options.textureMapper->drawTexture(*mainSurface.get(), FloatRect(FloatPoint::zero(), rect.size()));
+        options.textureMapper.bindSurface(replicaSurface.get());
+        options.textureMapper.drawTexture(*mainSurface.get(), FloatRect(FloatPoint::zero(), rect.size()));
         mainSurface = replicaSurface;
     }
 
index 2482e0e..9f3f45a 100644 (file)
@@ -39,11 +39,11 @@ public:
 
     TextureMapperPlatformLayer() : m_client(0) { }
     virtual ~TextureMapperPlatformLayer() { }
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0) = 0;
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0) = 0;
     virtual void swapBuffers() { }
-    virtual void drawBorder(TextureMapper* textureMapper, const Color& color, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
+    virtual void drawBorder(TextureMapper& textureMapper, const Color& color, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
     {
-        textureMapper->drawBorder(color, borderWidth, targetRect, transform);
+        textureMapper.drawBorder(color, borderWidth, targetRect, transform);
     }
     void setClient(TextureMapperPlatformLayer::Client* client)
     {
index b2d688b..6bc6862 100644 (file)
@@ -49,17 +49,17 @@ bool TextureMapperPlatformLayerBuffer::canReuseWithoutReset(const IntSize& size,
     return m_texture && (m_texture->size() == size) && (static_cast<BitmapTextureGL*>(m_texture.get())->internalFormat() == internalFormat || internalFormat == GraphicsContext3D::DONT_CARE);
 }
 
-void TextureMapperPlatformLayerBuffer::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity)
+void TextureMapperPlatformLayerBuffer::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& modelViewMatrix, float opacity)
 {
     if (m_hasManagedTexture) {
         ASSERT(m_texture);
-        textureMapper->drawTexture(*m_texture, targetRect, modelViewMatrix, opacity);
+        textureMapper.drawTexture(*m_texture, targetRect, modelViewMatrix, opacity);
         return;
     }
 
     ASSERT(m_textureID);
-    TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper);
-    texmapGL->drawTexture(m_textureID, m_extraFlags, m_size, targetRect, modelViewMatrix, opacity);
+    TextureMapperGL& texmapGL = static_cast<TextureMapperGL&>(textureMapper);
+    texmapGL.drawTexture(m_textureID, m_extraFlags, m_size, targetRect, modelViewMatrix, opacity);
 }
 
 } // namespace WebCore
index 657d283..84ce5ec 100644 (file)
@@ -42,7 +42,7 @@ public:
 
     virtual ~TextureMapperPlatformLayerBuffer() = default;
 
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0) final;
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0) final;
 
     bool canReuseWithoutReset(const IntSize&, GC3Dint internalFormat);
     BitmapTextureGL& textureGL() { return static_cast<BitmapTextureGL&>(*m_texture); }
index e97fcd8..12e8f48 100644 (file)
@@ -44,7 +44,7 @@ RefPtr<BitmapTexture> TextureMapperSurfaceBackingStore::texture() const
     return emptyTexture;
 }
 
-void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
+void TextureMapperSurfaceBackingStore::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
 {
     if (m_graphicsSurface)
         m_graphicsSurface->paintToTextureMapper(textureMapper, targetRect, transform, opacity);
index 224b806..9931db7 100644 (file)
@@ -37,7 +37,7 @@ public:
     void setGraphicsSurface(PassRefPtr<GraphicsSurface>);
     void swapBuffersIfNeeded(uint32_t frontBuffer);
     virtual RefPtr<BitmapTexture> texture() const;
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float);
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float);
     virtual ~TextureMapperSurfaceBackingStore() { }
 
 private:
index 1bb0a4f..3697196 100644 (file)
@@ -29,7 +29,7 @@ namespace WebCore {
 
 class GraphicsLayer;
 
-void TextureMapperTile::updateContents(TextureMapper* textureMapper, Image* image, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
+void TextureMapperTile::updateContents(TextureMapper& textureMapper, Image* image, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
 {
     IntRect targetRect = enclosingIntRect(m_rect);
     targetRect.intersect(dirtyRect);
@@ -43,14 +43,14 @@ void TextureMapperTile::updateContents(TextureMapper* textureMapper, Image* imag
     // Normalize targetRect to the texture's coordinates.
     targetRect.move(-m_rect.x(), -m_rect.y());
     if (!m_texture) {
-        m_texture = textureMapper->createTexture();
+        m_texture = textureMapper.createTexture();
         m_texture->reset(targetRect.size(), image->currentFrameKnownToBeOpaque() ? 0 : BitmapTexture::SupportsAlpha);
     }
 
     m_texture->updateContents(image, targetRect, sourceOffset, updateContentsFlag);
 }
 
-void TextureMapperTile::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag, float scale)
+void TextureMapperTile::updateContents(TextureMapper& textureMapper, GraphicsLayer* sourceLayer, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag, float scale)
 {
     IntRect targetRect = enclosingIntRect(m_rect);
     targetRect.intersect(dirtyRect);
@@ -62,17 +62,17 @@ void TextureMapperTile::updateContents(TextureMapper* textureMapper, GraphicsLay
     targetRect.move(-m_rect.x(), -m_rect.y());
 
     if (!m_texture) {
-        m_texture = textureMapper->createTexture();
+        m_texture = textureMapper.createTexture();
         m_texture->reset(targetRect.size(), BitmapTexture::SupportsAlpha);
     }
 
     m_texture->updateContents(textureMapper, sourceLayer, targetRect, sourceOffset, updateContentsFlag, scale);
 }
 
-void TextureMapperTile::paint(TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, const unsigned exposedEdges)
+void TextureMapperTile::paint(TextureMapper& textureMapper, const TransformationMatrix& transform, float opacity, const unsigned exposedEdges)
 {
     if (texture().get())
-        textureMapper->drawTexture(*texture().get(), rect(), transform, opacity, exposedEdges);
+        textureMapper.drawTexture(*texture().get(), rect(), transform, opacity, exposedEdges);
 }
 
 } // namespace WebCore
index 79d73ee..6e76210 100644 (file)
@@ -39,9 +39,9 @@ public:
     inline void setTexture(BitmapTexture* texture) { m_texture = texture; }
     inline void setRect(const FloatRect& rect) { m_rect = rect; }
 
-    void updateContents(TextureMapper*, Image*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData);
-    void updateContents(TextureMapper*, GraphicsLayer*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData, float scale = 1);
-    virtual void paint(TextureMapper*, const TransformationMatrix&, float, const unsigned exposedEdges);
+    void updateContents(TextureMapper&, Image*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData);
+    void updateContents(TextureMapper&, GraphicsLayer*, const IntRect&, BitmapTexture::UpdateContentsFlag UpdateCanModifyOriginalImageData, float scale = 1);
+    virtual void paint(TextureMapper&, const TransformationMatrix&, float, const unsigned exposedEdges);
     virtual ~TextureMapperTile() { }
 
     explicit TextureMapperTile(const FloatRect& rect)
index 34e1ee5..990ca76 100644 (file)
@@ -30,7 +30,7 @@ namespace WebCore {
 
 class GraphicsLayer;
 
-void TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded(TextureMapper* textureMapper)
+void TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded(TextureMapper& textureMapper)
 {
     if (!m_image)
         return;
@@ -47,7 +47,7 @@ TransformationMatrix TextureMapperTiledBackingStore::adjustedTransformForRect(co
     return TransformationMatrix::rectToRect(rect(), targetRect);
 }
 
-void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
+void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
 {
     updateContentsFromImageIfNeeded(textureMapper);
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
@@ -55,18 +55,18 @@ void TextureMapperTiledBackingStore::paintToTextureMapper(TextureMapper* texture
         tile.paint(textureMapper, adjustedTransform, opacity, calculateExposedTileEdges(rect(), tile.rect()));
 }
 
-void TextureMapperTiledBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
+void TextureMapperTiledBackingStore::drawBorder(TextureMapper& textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
 {
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     for (auto& tile : m_tiles)
-        textureMapper->drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
+        textureMapper.drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
 }
 
-void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
+void TextureMapperTiledBackingStore::drawRepaintCounter(TextureMapper& textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
 {
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     for (auto& tile : m_tiles)
-        textureMapper->drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
+        textureMapper.drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
 }
 
 void TextureMapperTiledBackingStore::updateContentsScale(float scale)
@@ -150,16 +150,16 @@ void TextureMapperTiledBackingStore::createOrDestroyTilesIfNeeded(const FloatSiz
     }
 }
 
-void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, Image* image, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
+void TextureMapperTiledBackingStore::updateContents(TextureMapper& textureMapper, Image* image, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
 {
-    createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), !image->currentFrameKnownToBeOpaque());
+    createOrDestroyTilesIfNeeded(totalSize, textureMapper.maxTextureSize(), !image->currentFrameKnownToBeOpaque());
     for (auto& tile : m_tiles)
         tile.updateContents(textureMapper, image, dirtyRect, updateContentsFlag);
 }
 
-void TextureMapperTiledBackingStore::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
+void TextureMapperTiledBackingStore::updateContents(TextureMapper& textureMapper, GraphicsLayer* sourceLayer, const FloatSize& totalSize, const IntRect& dirtyRect, BitmapTexture::UpdateContentsFlag updateContentsFlag)
 {
-    createOrDestroyTilesIfNeeded(totalSize, textureMapper->maxTextureSize(), true);
+    createOrDestroyTilesIfNeeded(totalSize, textureMapper.maxTextureSize(), true);
     for (auto& tile : m_tiles)
         tile.updateContents(textureMapper, sourceLayer, dirtyRect, updateContentsFlag, m_contentsScale);
 }
index 4be2149..b45b508 100644 (file)
@@ -38,13 +38,13 @@ public:
     virtual ~TextureMapperTiledBackingStore() { }
 
     virtual RefPtr<BitmapTexture> texture() const override;
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float) override;
-    virtual void drawBorder(TextureMapper*, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) override;
-    virtual void drawRepaintCounter(TextureMapper*, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) override;
+    virtual void paintToTextureMapper(TextureMapper&, const FloatRect&, const TransformationMatrix&, float) override;
+    virtual void drawBorder(TextureMapper&, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) override;
+    virtual void drawRepaintCounter(TextureMapper&, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) override;
 
     void updateContentsScale(float);
-    void updateContents(TextureMapper*, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
-    void updateContents(TextureMapper*, GraphicsLayer*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
+    void updateContents(TextureMapper&, Image*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
+    void updateContents(TextureMapper&, GraphicsLayer*, const FloatSize&, const IntRect&, BitmapTexture::UpdateContentsFlag);
 
     void setContentsToImage(Image* image) { m_image = image; }
 
@@ -52,7 +52,7 @@ private:
     TextureMapperTiledBackingStore() { }
 
     void createOrDestroyTilesIfNeeded(const FloatSize& backingStoreSize, const IntSize& tileSize, bool hasAlpha);
-    void updateContentsFromImageIfNeeded(TextureMapper*);
+    void updateContentsFromImageIfNeeded(TextureMapper&);
     TransformationMatrix adjustedTransformForRect(const FloatRect&);
     inline FloatRect rect() const
     {
index 8b36393..d296f15 100644 (file)
@@ -1,3 +1,14 @@
+2015-12-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [TexMap] Operate with a reference to the TextureMapper wherever possible
+        https://bugs.webkit.org/show_bug.cgi?id=152118
+
+        Reviewed by Martin Robinson.
+
+        * WebCoreSupport/AcceleratedCompositingContext.cpp:
+        (AcceleratedCompositingContext::compositeLayersToContext): TextureMapper object
+        is now operated with through a reference.
+
 2015-12-01  Darin Adler  <darin@apple.com>
 
         Fix anomaly where isMouseEvent returns false for wheel events
index 2f088a5..9a26d92 100644 (file)
@@ -187,7 +187,7 @@ void AcceleratedCompositingContext::compositeLayersToContext(CompositePurpose pu
 
     m_textureMapper->beginPainting();
     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().paint();
-    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get());
+    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper);
     m_textureMapper->endPainting();
 
     m_context->swapBuffers();
index cea2fa0..d623bb9 100644 (file)
@@ -1,3 +1,25 @@
+2015-12-15  Zan Dobersek  <zdobersek@igalia.com>
+
+        [TexMap] Operate with a reference to the TextureMapper wherever possible
+        https://bugs.webkit.org/show_bug.cgi?id=152118
+
+        Reviewed by Martin Robinson.
+
+        Replace pointers to the TextureMapper object with references.
+
+        * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
+        (WebKit::CoordinatedBackingStoreTile::swapBuffers):
+        (WebKit::CoordinatedBackingStore::paintTilesToTextureMapper):
+        (WebKit::CoordinatedBackingStore::paintToTextureMapper):
+        (WebKit::CoordinatedBackingStore::drawBorder):
+        (WebKit::CoordinatedBackingStore::drawRepaintCounter):
+        (WebKit::CoordinatedBackingStore::commitTileOperations):
+        * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
+        (WebKit::CoordinatedGraphicsScene::paintToGraphicsContext):
+        (WebKit::CoordinatedGraphicsScene::commitPendingBackingStoreOperations):
+
 2015-12-14  YongGeol Jung  <yg48.jung@samsung.com>
 
         [Coordinated Graphics] CSS transition effect is not shown when transformed with "%" unit.
index 51db08c..45df1a7 100644 (file)
@@ -30,7 +30,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-void CoordinatedBackingStoreTile::swapBuffers(TextureMapper* textureMapper)
+void CoordinatedBackingStoreTile::swapBuffers(TextureMapper& textureMapper)
 {
     if (!m_surface)
         return;
@@ -44,13 +44,13 @@ void CoordinatedBackingStoreTile::swapBuffers(TextureMapper* textureMapper)
     }
     RefPtr<BitmapTexture> texture = this->texture();
     if (!texture) {
-        texture = textureMapper->createTexture();
+        texture = textureMapper.createTexture();
         setTexture(texture.get());
         shouldReset = true;
     }
 
-    ASSERT(textureMapper->maxTextureSize().width() >= m_tileRect.size().width());
-    ASSERT(textureMapper->maxTextureSize().height() >= m_tileRect.size().height());
+    ASSERT(textureMapper.maxTextureSize().width() >= m_tileRect.size().width());
+    ASSERT(textureMapper.maxTextureSize().height() >= m_tileRect.size().height());
     if (shouldReset)
         texture->reset(m_tileRect.size(), m_surface->supportsAlpha());
 
@@ -107,7 +107,7 @@ void CoordinatedBackingStore::setSize(const FloatSize& size)
     m_pendingSize = size;
 }
 
-void CoordinatedBackingStore::paintTilesToTextureMapper(Vector<TextureMapperTile*>& tiles, TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, const FloatRect& rect)
+void CoordinatedBackingStore::paintTilesToTextureMapper(Vector<TextureMapperTile*>& tiles, TextureMapper& textureMapper, const TransformationMatrix& transform, float opacity, const FloatRect& rect)
 {
     for (auto& tile : tiles)
         tile->paint(textureMapper, transform, opacity, calculateExposedTileEdges(rect, tile->rect()));
@@ -118,7 +118,7 @@ TransformationMatrix CoordinatedBackingStore::adjustedTransformForRect(const Flo
     return TransformationMatrix::rectToRect(rect(), targetRect);
 }
 
-void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
+void CoordinatedBackingStore::paintToTextureMapper(TextureMapper& textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity)
 {
     if (m_tiles.isEmpty())
         return;
@@ -155,21 +155,21 @@ void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper,
     paintTilesToTextureMapper(tilesToPaint, textureMapper, adjustedTransform, opacity, rect());
 }
 
-void CoordinatedBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
+void CoordinatedBackingStore::drawBorder(TextureMapper& textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform)
 {
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     for (auto& tile : m_tiles.values())
-        textureMapper->drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
+        textureMapper.drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
 }
 
-void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
+void CoordinatedBackingStore::drawRepaintCounter(TextureMapper& textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform)
 {
     TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
     for (auto& tile : m_tiles.values())
-        textureMapper->drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
+        textureMapper.drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
 }
 
-void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper)
+void CoordinatedBackingStore::commitTileOperations(TextureMapper& textureMapper)
 {
     if (!m_pendingSize.isZero()) {
         m_size = m_pendingSize;
index bb63651..9802626 100644 (file)
@@ -44,7 +44,7 @@ public:
     }
 
     inline float scale() const { return m_scale; }
-    void swapBuffers(WebCore::TextureMapper*);
+    void swapBuffers(WebCore::TextureMapper&);
     void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<WebCore::CoordinatedSurface> buffer, const WebCore::IntPoint&);
 
 private:
@@ -62,18 +62,18 @@ public:
     void removeAllTiles();
     void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<WebCore::CoordinatedSurface>, const WebCore::IntPoint&);
     static Ref<CoordinatedBackingStore> create() { return adoptRef(*new CoordinatedBackingStore); }
-    void commitTileOperations(WebCore::TextureMapper*);
+    void commitTileOperations(WebCore::TextureMapper&);
     RefPtr<WebCore::BitmapTexture> texture() const override;
     void setSize(const WebCore::FloatSize&);
-    virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&, const WebCore::TransformationMatrix&, float) override;
-    virtual void drawBorder(WebCore::TextureMapper*, const WebCore::Color&, float borderWidth, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) override;
-    virtual void drawRepaintCounter(WebCore::TextureMapper*, int repaintCount, const WebCore::Color&, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) override;
+    virtual void paintToTextureMapper(WebCore::TextureMapper&, const WebCore::FloatRect&, const WebCore::TransformationMatrix&, float) override;
+    virtual void drawBorder(WebCore::TextureMapper&, const WebCore::Color&, float borderWidth, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) override;
+    virtual void drawRepaintCounter(WebCore::TextureMapper&, int repaintCount, const WebCore::Color&, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) override;
 
 private:
     CoordinatedBackingStore()
         : m_scale(1.)
     { }
-    void paintTilesToTextureMapper(Vector<WebCore::TextureMapperTile*>&, WebCore::TextureMapper*, const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&);
+    void paintTilesToTextureMapper(Vector<WebCore::TextureMapperTile*>&, WebCore::TextureMapper&, const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&);
     WebCore::TransformationMatrix adjustedTransformForRect(const WebCore::FloatRect&);
     WebCore::FloatRect rect() const { return WebCore::FloatRect(WebCore::FloatPoint::zero(), m_size); }
 
index e1500d6..0f7e1f2 100644 (file)
@@ -110,7 +110,7 @@ void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatri
     }
 
     currentRootLayer->paint();
-    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location(), matrix);
+    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper, clipRect.location(), matrix);
     m_textureMapper->endClip();
     m_textureMapper->endPainting();
 
@@ -143,7 +143,7 @@ void CoordinatedGraphicsScene::paintToGraphicsContext(PlatformGraphicsContext* p
         m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), m_viewBackgroundColor);
 
     layer->paint();
-    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location());
+    m_fpsCounter.updateFPSAndDisplay(*m_textureMapper, clipRect.location());
     m_textureMapper->endPainting();
     m_textureMapper->setGraphicsContext(0);
 }
@@ -584,7 +584,7 @@ void CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded()
 void CoordinatedGraphicsScene::commitPendingBackingStoreOperations()
 {
     for (auto& backingStore : m_backingStoresWithPendingBuffers)
-        backingStore->commitTileOperations(m_textureMapper.get());
+        backingStore->commitTileOperations(*m_textureMapper);
 
     m_backingStoresWithPendingBuffers.clear();
 }