[Texmap] Code cleanup: remove unused boundingRect/visibleRect calculations
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 16:38:19 +0000 (16:38 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Sep 2011 16:38:19 +0000 (16:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68897

Reviewed by Andreas Kling.

No new functionality so no new tests.

* platform/graphics/texmap/TextureMapperNode.cpp:
(WebCore::TextureMapperNode::computeAllTransforms):
(WebCore::TextureMapperNode::computeTiles):
(WebCore::TextureMapperNode::syncCompositingState):
* platform/graphics/texmap/TextureMapperNode.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperNode.h

index 135726b..e8fb14d 100644 (file)
@@ -1,5 +1,20 @@
 2011-09-27  No'am Rosenthal  <noam.rosenthal@nokia.com>
 
+        [Texmap] Code cleanup: remove unused boundingRect/visibleRect calculations
+        https://bugs.webkit.org/show_bug.cgi?id=68897
+
+        Reviewed by Andreas Kling.
+
+        No new functionality so no new tests.
+
+        * platform/graphics/texmap/TextureMapperNode.cpp:
+        (WebCore::TextureMapperNode::computeAllTransforms):
+        (WebCore::TextureMapperNode::computeTiles):
+        (WebCore::TextureMapperNode::syncCompositingState):
+        * platform/graphics/texmap/TextureMapperNode.h:
+
+2011-09-27  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
         [Texmap][Qt] Refactor texture-upload to allow direct chunk update
         https://bugs.webkit.org/show_bug.cgi?id=68808
 
index b370f48..54ba3b3 100644 (file)
@@ -136,20 +136,6 @@ void TextureMapperNode::computeLocalTransformIfNeeded()
         .translate3d(-originX, -originY, -m_state.anchorPoint.z());
 }
 
-bool TextureMapperNode::needsToComputeBoundingRect() const
-{
-    if (m_size.width() > gTileDimension || m_size.height() > gTileDimension)
-        return true;
-    if (!m_state.masksToBounds)
-        return false;
-
-    for (size_t i = 0; i < m_children.size(); ++i)
-        if (m_children[i]->needsToComputeBoundingRect())
-            return true;
-
-    return false;
-}
-
 void TextureMapperNode::computeAllTransforms()
 {
     if (m_size.isEmpty() && m_state.masksToBounds)
@@ -160,7 +146,6 @@ void TextureMapperNode::computeAllTransforms()
     computePerspectiveTransformIfNeeded();
 
     m_transforms.target = TransformationMatrix(m_parent ? m_parent->m_transforms.forDescendants : TransformationMatrix()).multiply(m_transforms.local);
-    m_transforms.targetBoundingRect = FloatRect(m_transforms.target.mapRect(targetRect()));
 
     m_state.visible = m_state.backfaceVisibility || m_transforms.target.inverse().m33() >= 0;
     if (!m_state.visible)
@@ -186,28 +171,6 @@ void TextureMapperNode::computeAllTransforms()
     m_transforms.forDescendants.multiply(m_transforms.perspective);
 }
 
-void TextureMapperNode::computeBoundingRectFromRootIfNeeded()
-{
-    if (!needsToComputeBoundingRect())
-        return;
-    if (!m_parent) {
-        m_transforms.boundingRectFromRoot = m_transforms.boundingRectFromRootForDescendants = IntRect(0, 0, -1, -1);
-        return;
-    }
-
-    const FloatRect targetRectInRootCoordinates = m_transforms.target.mapRect(targetRect());
-
-    const FloatRect parentBoundingRect = m_parent->m_transforms.boundingRectFromRootForDescendants;
-    if (parentBoundingRect.width() < 0)
-        m_transforms.boundingRectFromRoot = targetRectInRootCoordinates;
-    else {
-        m_transforms.boundingRectFromRootForDescendants = m_transforms.boundingRectFromRoot = parentBoundingRect;
-        m_transforms.boundingRectFromRoot.intersect(targetRectInRootCoordinates);
-    }
-    if (m_state.masksToBounds)
-        m_transforms.boundingRectFromRootForDescendants.intersect(m_transforms.boundingRectFromRoot);
-}
-
 void TextureMapperNode::computeTiles()
 {
     if (m_currentContent.contentType == HTMLContentType && !m_state.drawsContent) {
@@ -227,10 +190,7 @@ void TextureMapperNode::computeTiles()
             FloatRect tileRectInRootCoordinates = tileRect;
             tileRectInRootCoordinates.scale(1.0 / m_state.contentScale);
             tileRectInRootCoordinates = m_transforms.target.mapRect(tileRectInRootCoordinates);
-            static bool sDiscardHiddenTiles = false;
-            // FIXME: discard hidden tiles.
-            if (!sDiscardHiddenTiles || !needsToComputeBoundingRect() || tileRectInRootCoordinates.intersects(m_state.visibleRect))
-                tilesToAdd.append(tileRect);
+            tilesToAdd.append(tileRect);
         }
     }
 
@@ -271,21 +231,6 @@ void TextureMapperNode::computeTiles()
         m_tiles.remove(tilesToRemove[i]);
 }
 
-void TextureMapperNode::computeVisibleRectIfNeeded()
-{
-    if (!needsToComputeBoundingRect())
-        return;
-    FloatRect rootVisibleRect;
-    if (!m_parent)
-        rootVisibleRect = m_state.rootVisibleRect;
-    else if (m_parent)
-        rootVisibleRect = m_parent->m_state.rootVisibleRect;
-
-    m_state.rootVisibleRect = rootVisibleRect;
-    m_state.visibleRect = m_state.rootVisibleRect;
-    m_state.visibleRect.intersect(m_transforms.boundingRectFromRoot);
-}
-
 void TextureMapperNode::renderContent(TextureMapper* textureMapper, GraphicsLayer* layer)
 {
     if (m_size.isEmpty() || !layer || (!m_state.drawsContent && m_currentContent.contentType == HTMLContentType)) {
@@ -567,11 +512,6 @@ TextureMapperNode::~TextureMapperNode()
         m_parent->m_children.remove(m_parent->m_children.find(this));
 }
 
-void TextureMapperNode::setVisibleRect(const IntRect& rect)
-{
-    m_state.rootVisibleRect = m_state.visibleRect = rect;
-}
-
 void TextureMapperNode::syncCompositingState(GraphicsLayerTextureMapper* graphicsLayer, int options)
 {
     syncCompositingState(graphicsLayer, rootLayer()->m_textureMapper, options);
@@ -895,7 +835,6 @@ void TextureMapperNode::syncCompositingState(GraphicsLayerTextureMapper* graphic
     syncAnimations(graphicsLayer);
 
     computeAllTransforms();
-    computeBoundingRectFromRootIfNeeded();
     computePerspectiveTransformIfNeeded();
     computeTiles();
     computeOverlapsIfNeeded();
index 766d99b..c299d6b 100644 (file)
@@ -135,7 +135,6 @@ public:
     IntSize size() const { return IntSize(m_size.width() + .5, m_size.height() + .5); }
     void setTransform(const TransformationMatrix&);
     void setOpacity(float value) { m_opacity = value; }
-    void setVisibleRect(const IntRect&);
     void setTextureMapper(TextureMapper* texmap) { m_textureMapper = texmap; }
     bool descendantsOrSelfHaveRunningAnimations() const;
 
@@ -148,7 +147,6 @@ public:
 private:
     TextureMapperNode* rootLayer();
     void computeAllTransforms();
-    void computeVisibleRectIfNeeded();
     void computePerspectiveTransformIfNeeded();
     void computeReplicaTransformIfNeeded();
     void computeOverlapsIfNeeded();