[TexMap] Remove GraphicsLayer in TextureMapperLayer.
[WebKit-https.git] / Source / WebCore / platform / graphics / texmap / TextureMapperLayer.cpp
index 4ab2508..edfe320 100644 (file)
@@ -22,8 +22,6 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#include "GraphicsLayerTextureMapper.h"
-
 namespace WebCore {
 
 class TextureMapperPaintOptions {
@@ -40,11 +38,6 @@ public:
     { }
 };
 
-TextureMapperLayer* toTextureMapperLayer(GraphicsLayer* layer)
-{
-    return layer ? toGraphicsLayerTextureMapper(layer)->layer() : 0;
-}
-
 const TextureMapperLayer* TextureMapperLayer::rootLayer() const
 {
     if (m_effectTarget)
@@ -392,93 +385,11 @@ TextureMapper* TextureMapperLayer::textureMapper() const
     return rootLayer()->m_textureMapper;
 }
 
-void TextureMapperLayer::flushCompositingStateForThisLayerOnly(GraphicsLayerTextureMapper* graphicsLayer)
-{
-    ASSERT(graphicsLayer);
-    int changeMask = graphicsLayer->changeMask();
-
-    if (changeMask == NoChanges && graphicsLayer->m_animations.isEmpty())
-        return;
-
-    if (changeMask & ChildrenChange)
-        setChildren(graphicsLayer->children());
-
-    if (changeMask & MaskLayerChange) {
-       if (TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer->maskLayer()))
-           layer->m_effectTarget = this;
-    }
-
-    if (changeMask & ReplicaLayerChange) {
-       if (TextureMapperLayer* layer = toTextureMapperLayer(graphicsLayer->replicaLayer()))
-           layer->m_effectTarget = this;
-    }
-
-    if (changeMask & AnimationChange)
-        m_animations = graphicsLayer->m_animations;
-    
-    if (changeMask & TransformChange)
-        m_shouldUpdateCurrentTransformFromGraphicsLayer = true;
-
-    if (changeMask & OpacityChange)
-        m_shouldUpdateCurrentOpacityFromGraphicsLayer = true;
-
-#if ENABLE(CSS_FILTERS)
-    if (changeMask & FilterChange)
-        m_shouldUpdateCurrentFiltersFromGraphicsLayer = true;
-#endif
-
-    if (changeMask & BackingStoreChange)
-        m_backingStore = graphicsLayer->m_backingStore;
-
-    if (changeMask & RepaintCountChange)
-        m_state.repaintCount = graphicsLayer->repaintCount();
-
-    m_state.maskLayer = toTextureMapperLayer(graphicsLayer->maskLayer());
-    m_state.replicaLayer = toTextureMapperLayer(graphicsLayer->replicaLayer());
-    m_state.pos = graphicsLayer->position();
-    m_state.anchorPoint = graphicsLayer->anchorPoint();
-    m_state.size = graphicsLayer->size();
-    m_state.transform = graphicsLayer->transform();
-    m_state.contentsRect = graphicsLayer->contentsRect();
-    m_state.preserves3D = graphicsLayer->preserves3D();
-    m_state.masksToBounds = graphicsLayer->masksToBounds();
-    m_state.drawsContent = graphicsLayer->drawsContent();
-    m_state.contentsVisible = graphicsLayer->contentsAreVisible();
-    m_state.contentsOpaque = graphicsLayer->contentsOpaque();
-    m_state.backfaceVisibility = graphicsLayer->backfaceVisibility();
-    m_state.childrenTransform = graphicsLayer->childrenTransform();
-    m_state.opacity = graphicsLayer->opacity();
-    m_state.solidColor = graphicsLayer->solidColor();
-#if ENABLE(CSS_FILTERS)
-    if (changeMask & FilterChange)
-        m_state.filters = graphicsLayer->filters();
-#endif
-    m_fixedToViewport = graphicsLayer->fixedToViewport();
-
-    m_state.showDebugBorders = graphicsLayer->isShowingDebugBorder();
-    m_state.debugBorderColor = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderColor();
-    m_state.debugBorderWidth = toGraphicsLayerTextureMapper(graphicsLayer)->debugBorderWidth();
-    m_state.showRepaintCounter = graphicsLayer->isShowingRepaintCounter();
-
-    m_contentsLayer = graphicsLayer->platformLayer();
-
-    m_currentTransform.setPosition(adjustedPosition());
-    m_currentTransform.setAnchorPoint(m_state.anchorPoint);
-    m_currentTransform.setSize(m_state.size);
-    m_currentTransform.setFlattening(!m_state.preserves3D);
-    m_currentTransform.setChildrenTransform(m_state.childrenTransform);
-
-    syncAnimations();
-}
-
-void TextureMapperLayer::setChildren(const Vector<GraphicsLayer*>& newChildren)
+void TextureMapperLayer::setChildren(const Vector<TextureMapperLayer*>& newChildren)
 {
     removeAllChildren();
-    for (size_t i = 0; i < newChildren.size(); ++i) {
-        TextureMapperLayer* child = toTextureMapperLayer(newChildren[i]);
-        ASSERT(child);
-        addChild(child);
-    }
+    for (size_t i = 0; i < newChildren.size(); ++i)
+        addChild(newChildren[i]);
 }
 
 void TextureMapperLayer::addChild(TextureMapperLayer* childLayer)
@@ -516,6 +427,135 @@ void TextureMapperLayer::removeAllChildren()
     }
 }
 
+void TextureMapperLayer::setMaskLayer(TextureMapperLayer* maskLayer)
+{
+    if (maskLayer)
+        maskLayer->m_effectTarget = this;
+    m_state.maskLayer = maskLayer;
+}
+
+void TextureMapperLayer::setReplicaLayer(TextureMapperLayer* replicaLayer)
+{
+    if (replicaLayer)
+        replicaLayer->m_effectTarget = this;
+    m_state.replicaLayer = replicaLayer;
+}
+
+void TextureMapperLayer::setPosition(const FloatPoint& position)
+{
+    m_state.pos = position;
+    m_currentTransform.setPosition(adjustedPosition());
+}
+
+void TextureMapperLayer::setSize(const FloatSize& size)
+{
+    m_state.size = size;
+    m_currentTransform.setSize(size);
+}
+
+void TextureMapperLayer::setAnchorPoint(const FloatPoint3D& anchorPoint)
+{
+    m_state.anchorPoint = anchorPoint;
+    m_currentTransform.setAnchorPoint(anchorPoint);
+}
+
+void TextureMapperLayer::setPreserves3D(bool preserves3D)
+{
+    m_state.preserves3D = preserves3D;
+    m_currentTransform.setFlattening(!preserves3D);
+}
+
+void TextureMapperLayer::setTransform(const TransformationMatrix& transform)
+{
+    m_state.transform = transform;
+    m_currentTransform.setLocalTransform(transform);
+}
+
+void TextureMapperLayer::setChildrenTransform(const TransformationMatrix& childrenTransform)
+{
+    m_state.childrenTransform = childrenTransform;
+    m_currentTransform.setChildrenTransform(childrenTransform);
+}
+
+void TextureMapperLayer::setContentsRect(const IntRect& contentsRect)
+{
+    m_state.contentsRect = contentsRect;
+}
+
+void TextureMapperLayer::setMasksToBounds(bool masksToBounds)
+{
+    m_state.masksToBounds = masksToBounds;
+}
+
+void TextureMapperLayer::setDrawsContent(bool drawsContent)
+{
+    m_state.drawsContent = drawsContent;
+}
+
+void TextureMapperLayer::setContentsVisible(bool contentsVisible)
+{
+    m_state.contentsVisible = contentsVisible;
+}
+
+void TextureMapperLayer::setContentsOpaque(bool contentsOpaque)
+{
+    m_state.contentsOpaque = contentsOpaque;
+}
+
+void TextureMapperLayer::setBackfaceVisibility(bool backfaceVisibility)
+{
+    m_state.backfaceVisibility = backfaceVisibility;
+}
+
+void TextureMapperLayer::setOpacity(float opacity)
+{
+    m_state.opacity = opacity;
+}
+
+void TextureMapperLayer::setSolidColor(const Color& color)
+{
+    m_state.solidColor = color;
+}
+
+#if ENABLE(CSS_FILTERS)
+void TextureMapperLayer::setFilters(const FilterOperations& filters)
+{
+    m_state.filters = filters;
+}
+#endif
+
+void TextureMapperLayer::setDebugVisuals(bool showDebugBorders, const Color& debugBorderColor, float debugBorderWidth, bool showRepaintCounter)
+{
+    m_state.showDebugBorders = showDebugBorders;
+    m_state.debugBorderColor = debugBorderColor;
+    m_state.debugBorderWidth = debugBorderWidth;
+    m_state.showRepaintCounter = showRepaintCounter;
+}
+
+void TextureMapperLayer::setRepaintCount(int repaintCount)
+{
+    m_state.repaintCount = repaintCount;
+}
+
+void TextureMapperLayer::setContentsLayer(TextureMapperPlatformLayer* platformLayer)
+{
+    m_contentsLayer = platformLayer;
+}
+
+void TextureMapperLayer::setAnimations(const GraphicsLayerAnimations& animations)
+{
+    m_animations = animations;
+}
+
+void TextureMapperLayer::setFixedToViewport(bool fixedToViewport)
+{
+    m_fixedToViewport = fixedToViewport;
+}
+
+void TextureMapperLayer::setBackingStore(PassRefPtr<TextureMapperBackingStore> backingStore)
+{
+    m_backingStore = backingStore;
+}
 
 bool TextureMapperLayer::descendantsOrSelfHaveRunningAnimations() const
 {