Title: [148748] trunk/Source
Revision
148748
Author
[email protected]
Date
2013-04-19 09:01:25 -0700 (Fri, 19 Apr 2013)

Log Message

[Texmap] Implementation for pattern compositing
https://bugs.webkit.org/show_bug.cgi?id=109588

Patch by Noam Rosenthal <[email protected]> on 2013-04-19
Reviewed by Allan Sandfeld Jensen.

Source/WebCore:

Enable pattern compositing (background images) for CoordinatedGraphics/TextureMapperGL.
Use the existing patternTransform shader uniform, multiplying it by a matrix calculated
using the contentsRect, tileSize and tilePhase.

Covered by existing tests in compositing/patterns.

* platform/graphics/GraphicsLayer.h:
(GraphicsLayer):
    Conditionally enable pattern compositing for coordinated graphics.

* platform/graphics/texmap/TextureMapper.cpp:
(WebCore::TextureMapper::TextureMapper):
* platform/graphics/texmap/TextureMapper.h:
(WebCore::TextureMapper::setPatternTransform):
(WebCore::TextureMapper::setWrapMode):
(WebCore::TextureMapper::wrapMode):
(WebCore::TextureMapper::patternTransform):
    Add wrapMode and patternTransform properties to the TextureMapper state.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
    Paint with GL_REPEAT and a pattern transform when needed.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::computePatternTransformIfNeeded):
(WebCore):
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::setContentsRect):
(WebCore::TextureMapperLayer::setContentsTileSize):
(WebCore::TextureMapperLayer::setContentsTilePhase):
    Apply the patternTransform from the tile size/phase.

* platform/graphics/texmap/TextureMapperLayer.h:
(WebCore::TextureMapperLayer::TextureMapperLayer):
(TextureMapperLayer):
(WebCore::TextureMapperLayer::setShouldMapBackingStoreToContentsRect):
(State):
(WebCore::TextureMapperLayer::State::State):
    Allow the client to configure whether a layer uses its bounds or its
    contents rect to paint the backing store.
    This is needed now since layers with background images, unlike layers
    with regular images, may have bounds that are greater than the contents
    rect.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
(WebCore):
(WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
(WebCore::CoordinatedGraphicsLayer::setShouldSupportContentsTiling):
(WebCore::GraphicsLayer::supportsContentsTiling):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
(CoordinatedGraphicsLayer):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
(WebCore::CoordinatedGraphicsScene::setLayerState):
(WebCore::CoordinatedGraphicsScene::assignImageBackingToLayer):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
(CoordinatedGraphicsLayerState):
    Logic to pass the tileSize/tilePhase from CoordinatedGraphicsLayer
    to TextureMapperLayer.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
    Don't reset the layer's image contents when this is a directly composited image.

Source/WebKit2:

Serialize the two new properties from CoordinatedGraphicsLayer to CoordinatedGraphicsScene.

* Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
    Encode/decode the new tiling properties.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
    Enable pattern compositing for coordinated graphics.
    This is needed since we don't want to enable pattern compositing for
    WebKit1 yet.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148747 => 148748)


--- trunk/Source/WebCore/ChangeLog	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/ChangeLog	2013-04-19 16:01:25 UTC (rev 148748)
@@ -1,3 +1,74 @@
+2013-04-19  Noam Rosenthal  <[email protected]>
+
+        [Texmap] Implementation for pattern compositing
+        https://bugs.webkit.org/show_bug.cgi?id=109588
+
+        Reviewed by Allan Sandfeld Jensen.
+
+        Enable pattern compositing (background images) for CoordinatedGraphics/TextureMapperGL.
+        Use the existing patternTransform shader uniform, multiplying it by a matrix calculated
+        using the contentsRect, tileSize and tilePhase.
+
+        Covered by existing tests in compositing/patterns.
+
+        * platform/graphics/GraphicsLayer.h:
+        (GraphicsLayer):
+            Conditionally enable pattern compositing for coordinated graphics.
+
+        * platform/graphics/texmap/TextureMapper.cpp:
+        (WebCore::TextureMapper::TextureMapper):
+        * platform/graphics/texmap/TextureMapper.h:
+        (WebCore::TextureMapper::setPatternTransform):
+        (WebCore::TextureMapper::setWrapMode):
+        (WebCore::TextureMapper::wrapMode):
+        (WebCore::TextureMapper::patternTransform):
+            Add wrapMode and patternTransform properties to the TextureMapper state.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
+            Paint with GL_REPEAT and a pattern transform when needed.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::computePatternTransformIfNeeded):
+        (WebCore):
+        (WebCore::TextureMapperLayer::paintSelf):
+        (WebCore::TextureMapperLayer::setContentsRect):
+        (WebCore::TextureMapperLayer::setContentsTileSize):
+        (WebCore::TextureMapperLayer::setContentsTilePhase):
+            Apply the patternTransform from the tile size/phase.
+
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        (WebCore::TextureMapperLayer::TextureMapperLayer):
+        (TextureMapperLayer):
+        (WebCore::TextureMapperLayer::setShouldMapBackingStoreToContentsRect):
+        (State):
+        (WebCore::TextureMapperLayer::State::State):
+            Allow the client to configure whether a layer uses its bounds or its
+            contents rect to paint the backing store.
+            This is needed now since layers with background images, unlike layers
+            with regular images, may have bounds that are greater than the contents
+            rect.
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
+        (WebCore):
+        (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
+        (WebCore::CoordinatedGraphicsLayer::setShouldSupportContentsTiling):
+        (WebCore::GraphicsLayer::supportsContentsTiling):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+        (CoordinatedGraphicsLayer):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp:
+        (WebCore::CoordinatedGraphicsScene::setLayerState):
+        (WebCore::CoordinatedGraphicsScene::assignImageBackingToLayer):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
+        (CoordinatedGraphicsLayerState):
+            Logic to pass the tileSize/tilePhase from CoordinatedGraphicsLayer
+            to TextureMapperLayer.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage):
+            Don't reset the layer's image contents when this is a directly composited image.
+
 2013-04-19  ChangSeok Oh  <[email protected]>
 
         [GTK][AC] Manage actor's children by using clutter's own way.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2013-04-19 16:01:25 UTC (rev 148748)
@@ -443,11 +443,15 @@
 #endif
     }
 
+#if USE(COORDINATED_GRAPHICS)
+    static bool supportsContentsTiling();
+#else
     static bool supportsContentsTiling()
     {
         // FIXME: Enable the feature on different ports.
         return false;
     }
+#endif
 
     void updateDebugIndicators();
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -143,6 +143,7 @@
     , m_texturePool(adoptPtr(new BitmapTexturePool()))
     , m_accelerationMode(accelerationMode)
     , m_isMaskMode(false)
+    , m_wrapMode(StretchWrap)
 { }
 
 TextureMapper::~TextureMapper()

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h	2013-04-19 16:01:25 UTC (rev 148748)
@@ -115,6 +115,12 @@
     enum PaintFlag {
         PaintingMirrored = 1 << 0,
     };
+
+    enum WrapMode {
+        StretchWrap,
+        RepeatWrap
+    };
+
     typedef unsigned PaintFlags;
 
     static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode);
@@ -163,12 +169,17 @@
     virtual void removeCachedCustomFilterProgram(CustomFilterProgram*) { }
 #endif
 
+    void setPatternTransform(const TransformationMatrix& p) { m_patternTransform = p; }
+    void setWrapMode(WrapMode m) { m_wrapMode = m; }
+
 protected:
     explicit TextureMapper(AccelerationMode);
 
     GraphicsContext* m_context;
 
     bool isInMaskMode() const { return m_isMaskMode; }
+    WrapMode wrapMode() const { return m_wrapMode; }
+    const TransformationMatrix& patternTransform() const { return m_patternTransform; }
 
 private:
 #if USE(TEXTURE_MAPPER_GL)
@@ -184,6 +195,8 @@
     OwnPtr<BitmapTexturePool> m_texturePool;
     AccelerationMode m_accelerationMode;
     bool m_isMaskMode;
+    TransformationMatrix m_patternTransform;
+    WrapMode m_wrapMode;
 };
 
 }

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


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -548,8 +548,12 @@
     GC3Denum target = flags & ShouldUseARBTextureRect ? GC3Denum(Extensions3D::TEXTURE_RECTANGLE_ARB) : GC3Denum(GraphicsContext3D::TEXTURE_2D);
     m_context3D->bindTexture(target, texture);
     m_context3D->uniform1i(program->samplerLocation(), 0);
+    if (wrapMode() == RepeatWrap) {
+        m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::REPEAT);
+        m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::REPEAT);
+    }
 
-    TransformationMatrix patternTransform;
+    TransformationMatrix patternTransform = this->patternTransform();
     if (flags & ShouldFlipTexture)
         patternTransform.flipY();
     if (flags & ShouldUseARBTextureRect)
@@ -564,6 +568,8 @@
         flags |= ShouldBlend;
 
     draw(rect, modelViewMatrix, program, GraphicsContext3D::TRIANGLE_FAN, flags);
+    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE);
+    m_context3D->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE);
 }
 
 BitmapTextureGL::BitmapTextureGL(TextureMapperGL* textureMapper)

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -99,6 +99,17 @@
     return Color(colorWithOverrideAlpha(rgba, effectiveAlpha));
 }
 
+void TextureMapperLayer::computePatternTransformIfNeeded()
+{
+    if (!m_patternTransformDirty)
+        return;
+
+    m_patternTransformDirty = false;
+    m_patternTransform =
+        TransformationMatrix::rectToRect(FloatRect(FloatPoint::zero(), m_state.contentsTileSize), m_state.contentsRect)
+        .multiply(TransformationMatrix().translate(m_state.contentsTilePhase.x() / m_state.contentsRect.width(), m_state.contentsTilePhase.y() / m_state.contentsRect.height()));
+}
+
 void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
 {
     if (!m_state.visible || !m_state.contentsVisible)
@@ -110,30 +121,41 @@
     transform.multiply(options.transform);
     transform.multiply(m_currentTransform.combined());
 
-    if (m_state.solidColor.isValid() && !m_state.contentsRect.isEmpty()) {
+    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));
         if (m_state.showDebugBorders)
             options.textureMapper->drawBorder(m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
         return;
     }
 
+    options.textureMapper->setWrapMode(TextureMapper::StretchWrap);
+    options.textureMapper->setPatternTransform(TransformationMatrix());
+
+    if (!m_state.contentsTileSize.isEmpty()) {
+        computePatternTransformIfNeeded();
+        options.textureMapper->setWrapMode(TextureMapper::RepeatWrap);
+        options.textureMapper->setPatternTransform(m_patternTransform);
+    }
+
     if (m_backingStore) {
         ASSERT(m_state.drawsContent && m_state.contentsVisible && !m_state.size.isEmpty());
-        ASSERT(!layerRect().isEmpty());
-        m_backingStore->paintToTextureMapper(options.textureMapper, layerRect(), transform, options.opacity);
+        FloatRect targetRect = m_state.shouldMapBackingStoreToContentsRect ? m_state.contentsRect : layerRect();
+        ASSERT(!targetRect.isEmpty());
+        m_backingStore->paintToTextureMapper(options.textureMapper, targetRect, transform, options.opacity);
         if (m_state.showDebugBorders)
-            m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, layerRect(), transform);
+            m_backingStore->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, targetRect, transform);
         // Only draw repaint count for the main backing store.
         if (m_state.showRepaintCounter)
-            m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, layerRect(), transform);
+            m_backingStore->drawRepaintCounter(options.textureMapper, m_state.repaintCount, m_state.debugBorderColor, targetRect, transform);
     }
 
-    if (m_contentsLayer) {
-        ASSERT(!layerRect().isEmpty());
-        m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity);
-        if (m_state.showDebugBorders)
-            m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
-    }
+    if (!m_contentsLayer)
+        return;
+
+    ASSERT(!layerRect().isEmpty());
+    m_contentsLayer->paintToTextureMapper(options.textureMapper, m_state.contentsRect, transform, options.opacity);
+    if (m_state.showDebugBorders)
+        m_contentsLayer->drawBorder(options.textureMapper, m_state.debugBorderColor, m_state.debugBorderWidth, m_state.contentsRect, transform);
 }
 
 int TextureMapperLayer::compareGraphicsLayersZValue(const void* a, const void* b)
@@ -551,9 +573,28 @@
 
 void TextureMapperLayer::setContentsRect(const IntRect& contentsRect)
 {
+    if (contentsRect == m_state.contentsRect)
+        return;
     m_state.contentsRect = contentsRect;
+    m_patternTransformDirty = true;
 }
 
+void TextureMapperLayer::setContentsTileSize(const IntSize& size)
+{
+    if (size == m_state.contentsTileSize)
+        return;
+    m_state.contentsTileSize = size;
+    m_patternTransformDirty = true;
+}
+
+void TextureMapperLayer::setContentsTilePhase(const IntPoint& phase)
+{
+    if (phase == m_state.contentsTilePhase)
+        return;
+    m_state.contentsTilePhase = phase;
+    m_patternTransformDirty = true;
+}
+
 void TextureMapperLayer::setMasksToBounds(bool masksToBounds)
 {
     m_state.masksToBounds = masksToBounds;

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-04-19 16:01:25 UTC (rev 148748)
@@ -56,6 +56,7 @@
         , m_id(0)
         , m_scrollClient(0)
         , m_isScrollable(false)
+        , m_patternTransformDirty(false)
     { }
 
     virtual ~TextureMapperLayer();
@@ -98,6 +99,8 @@
     void setBackfaceVisibility(bool);
     void setOpacity(float);
     void setSolidColor(const Color&);
+    void setContentsTileSize(const IntSize&);
+    void setContentsTilePhase(const IntPoint&);
 #if ENABLE(CSS_FILTERS)
     void setFilters(const FilterOperations&);
 #endif
@@ -119,6 +122,7 @@
     void setFixedToViewport(bool);
     bool fixedToViewport() const { return m_fixedToViewport; }
     void setBackingStore(PassRefPtr<TextureMapperBackingStore>);
+    void setShouldMapBackingStoreToContentsRect(bool m) { m_state.shouldMapBackingStoreToContentsRect = m; }
 
     void syncAnimations();
     bool descendantsOrSelfHaveRunningAnimations() const;
@@ -158,6 +162,7 @@
     void paintSelfAndChildren(const TextureMapperPaintOptions&);
     void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
     void applyMask(const TextureMapperPaintOptions&);
+    void computePatternTransformIfNeeded();
 
     // GraphicsLayerAnimation::Client
     virtual void setAnimatedTransform(const TransformationMatrix&) OVERRIDE;
@@ -206,6 +211,8 @@
         TransformationMatrix childrenTransform;
         float opacity;
         FloatRect contentsRect;
+        IntSize contentsTileSize;
+        IntPoint contentsTilePhase;
         TextureMapperLayer* maskLayer;
         TextureMapperLayer* replicaLayer;
         Color solidColor;
@@ -225,6 +232,7 @@
         bool visible : 1;
         bool showDebugBorders : 1;
         bool showRepaintCounter : 1;
+        bool shouldMapBackingStoreToContentsRect : 1;
 
         State()
             : opacity(1)
@@ -241,6 +249,7 @@
             , visible(true)
             , showDebugBorders(false)
             , showRepaintCounter(false)
+            , shouldMapBackingStoreToContentsRect(false)
         {
         }
     };
@@ -255,6 +264,8 @@
     bool m_isScrollable;
     FloatSize m_userScrollOffset;
     FloatSize m_accumulatedScrollOffsetFractionalPart;
+    TransformationMatrix m_patternTransform;
+    bool m_patternTransformDirty;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -340,6 +340,40 @@
     didChangeLayerState();
 }
 
+void CoordinatedGraphicsLayer::setContentsTileSize(const IntSize& s)
+{
+    if (contentsTileSize() == s)
+        return;
+
+    GraphicsLayer::setContentsTileSize(s);
+    m_layerState.contentsTileSize = s;
+    m_layerState.contentsTilingChanged = true;
+    didChangeLayerState();
+}
+
+void CoordinatedGraphicsLayer::setContentsTilePhase(const IntPoint& p)
+{
+    if (contentsTilePhase() == p)
+        return;
+
+    GraphicsLayer::setContentsTilePhase(p);
+    m_layerState.contentsTilePhase = p;
+    m_layerState.contentsTilingChanged = true;
+    didChangeLayerState();
+}
+
+static bool s_shouldSupportContentsTiling = false;
+
+void CoordinatedGraphicsLayer::setShouldSupportContentsTiling(bool s)
+{
+    s_shouldSupportContentsTiling = s;
+}
+
+bool GraphicsLayer::supportsContentsTiling()
+{
+    return s_shouldSupportContentsTiling;
+}
+
 void CoordinatedGraphicsLayer::setContentsNeedsDisplay()
 {
 #if USE(GRAPHICS_SURFACE)

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2013-04-19 16:01:25 UTC (rev 148748)
@@ -86,6 +86,8 @@
     virtual void setBackfaceVisibility(bool) OVERRIDE;
     virtual void setOpacity(float) OVERRIDE;
     virtual void setContentsRect(const IntRect&) OVERRIDE;
+    virtual void setContentsTilePhase(const IntPoint&) OVERRIDE;
+    virtual void setContentsTileSize(const IntSize&) OVERRIDE;
     virtual void setContentsToImage(Image*) OVERRIDE;
     virtual void setContentsToSolidColor(const Color&) OVERRIDE;
     virtual void setShowDebugBorder(bool) OVERRIDE;
@@ -145,6 +147,8 @@
     void purgeBackingStores();
     bool hasPendingVisibleChanges();
 
+    static void setShouldSupportContentsTiling(bool);
+
 private:
 #if USE(GRAPHICS_SURFACE)
     enum PendingCanvasOperation {

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -323,6 +323,11 @@
     if (layerState.contentsRectChanged)
         layer->setContentsRect(layerState.contentsRect);
 
+    if (layerState.contentsTilingChanged) {
+        layer->setContentsTilePhase(layerState.contentsTilePhase);
+        layer->setContentsTileSize(layerState.contentsTileSize);
+    }
+
     if (layerState.opacityChanged)
         layer->setOpacity(layerState.opacity);
 
@@ -579,11 +584,14 @@
 
     if (imageID == InvalidCoordinatedImageBackingID) {
         layer->setBackingStore(0);
+        layer->setShouldMapBackingStoreToContentsRect(false);
         return;
     }
+
     ImageBackingMap::iterator it = m_imageBackings.find(imageID);
     ASSERT(it != m_imageBackings.end());
     layer->setBackingStore(it->value.get());
+    layer->setShouldMapBackingStoreToContentsRect(true);
 }
 
 void CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded()

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h (148747 => 148748)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h	2013-04-19 16:01:25 UTC (rev 148748)
@@ -93,6 +93,7 @@
             bool canvasShouldSwapBuffers: 1;
             bool isScrollableChanged: 1;
             bool committedScrollOffsetChanged: 1;
+            bool contentsTilingChanged: 1;
         };
         unsigned changeMask;
     };
@@ -141,6 +142,8 @@
     TransformationMatrix transform;
     TransformationMatrix childrenTransform;
     IntRect contentsRect;
+    IntPoint contentsTilePhase;
+    IntSize contentsTileSize;
     float opacity;
     Color solidColor;
     Color debugBorderColor;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (148747 => 148748)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -1446,6 +1446,9 @@
     if (!GraphicsLayer::supportsContentsTiling())
         return;
 
+    if (isDirectlyCompositedImage())
+        return;
+
     const RenderStyle* style = renderer()->style();
 
     if (!isSimpleContainer || !style->hasBackgroundImage()) {

Modified: trunk/Source/WebKit2/ChangeLog (148747 => 148748)


--- trunk/Source/WebKit2/ChangeLog	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebKit2/ChangeLog	2013-04-19 16:01:25 UTC (rev 148748)
@@ -1,3 +1,23 @@
+2013-04-19  Noam Rosenthal  <[email protected]>
+
+        [Texmap] Implementation for pattern compositing
+        https://bugs.webkit.org/show_bug.cgi?id=109588
+
+        Reviewed by Allan Sandfeld Jensen.
+
+        Serialize the two new properties from CoordinatedGraphicsLayer to CoordinatedGraphicsScene.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
+        (CoreIPC::::encode):
+        (CoreIPC::::decode):
+            Encode/decode the new tiling properties.
+
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+            Enable pattern compositing for coordinated graphics.
+            This is needed since we don't want to enable pattern compositing for
+            WebKit1 yet.
+
 2013-04-18  Tim Horton  <[email protected]>
 
         PDFPlugin: Update PDFLayerController's scale factors earlier

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp (148747 => 148748)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -849,6 +849,11 @@
     if (state.contentsRectChanged)
         encoder << state.contentsRect;
 
+    if (state.contentsTilingChanged) {
+        encoder << state.contentsTileSize;
+        encoder << state.contentsTilePhase;
+    }
+
     if (state.opacityChanged)
         encoder << state.opacity;
 
@@ -928,6 +933,13 @@
     if (state.contentsRectChanged && !decoder.decode(state.contentsRect))
         return false;
 
+    if (state.contentsTilingChanged) {
+        if (!decoder.decode(state.contentsTileSize))
+            return false;
+        if (!decoder.decode(state.contentsTilePhase))
+            return false;
+    }
+
     if (state.opacityChanged && !decoder.decode(state.opacity))
         return false;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (148747 => 148748)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-04-19 15:34:53 UTC (rev 148747)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-04-19 16:01:25 UTC (rev 148748)
@@ -121,6 +121,10 @@
 
     CoordinatedSurface::setFactory(createCoordinatedSurface);
 
+    // This is a temporary way to enable this only in the GL case, until TextureMapperImageBuffer is removed.
+    // See https://bugs.webkit.org/show_bug.cgi?id=114869
+    CoordinatedGraphicsLayer::setShouldSupportContentsTiling(true);
+
     if (m_webPage->hasPageOverlay())
         createPageOverlayLayer();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to