[chromium] Remove non-ephemeral data from RenderSurface as it duplicates data from...
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 21:30:28 +0000 (21:30 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Jul 2012 21:30:28 +0000 (21:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91418

Reviewed by Adrienne Walker.

This removes the filters and masks from render surfaces, and makes them
used directly from the owning layer. Also removes skipsDraw from
surfaces as it was just not used at all.

Covered by existing tests.

* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::filters):
(WebCore::LayerChromium::backgroundFilters):
(WebCore::LayerChromium::hasMask):
(WebCore::LayerChromium::hasReplica):
(WebCore::LayerChromium::replicaHasMask):
(LayerChromium):
* platform/graphics/chromium/RenderSurfaceChromium.cpp:
(WebCore::RenderSurfaceChromium::RenderSurfaceChromium):
* platform/graphics/chromium/RenderSurfaceChromium.h:
(RenderSurfaceChromium):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(WebCore::CCLayerImpl::hasMask):
(WebCore::CCLayerImpl::hasReplica):
(WebCore::CCLayerImpl::replicaHasMask):
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::calculateMemoryForRenderSurfaces):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsInternal):
* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::::finishedRenderTarget):
(WebCore::reduceOcclusionBelowSurface):
(WebCore::::leaveToRenderTarget):
* platform/graphics/chromium/cc/CCRenderPass.cpp:
(WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
(WebCore::CCRenderSurface::drawableContentRect):
(WebCore::CCRenderSurface::appendQuads):
* platform/graphics/chromium/cc/CCRenderSurface.h:
(CCRenderSurface):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp
Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h

index d70c7ab..7392fc4 100644 (file)
@@ -1,3 +1,48 @@
+2012-07-16  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Remove non-ephemeral data from RenderSurface as it duplicates data from the owning layer
+        https://bugs.webkit.org/show_bug.cgi?id=91418
+
+        Reviewed by Adrienne Walker.
+
+        This removes the filters and masks from render surfaces, and makes them
+        used directly from the owning layer. Also removes skipsDraw from
+        surfaces as it was just not used at all.
+
+        Covered by existing tests.
+
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::filters):
+        (WebCore::LayerChromium::backgroundFilters):
+        (WebCore::LayerChromium::hasMask):
+        (WebCore::LayerChromium::hasReplica):
+        (WebCore::LayerChromium::replicaHasMask):
+        (LayerChromium):
+        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
+        (WebCore::RenderSurfaceChromium::RenderSurfaceChromium):
+        * platform/graphics/chromium/RenderSurfaceChromium.h:
+        (RenderSurfaceChromium):
+        * platform/graphics/chromium/cc/CCLayerImpl.h:
+        (WebCore::CCLayerImpl::hasMask):
+        (WebCore::CCLayerImpl::hasReplica):
+        (WebCore::CCLayerImpl::replicaHasMask):
+        (CCLayerImpl):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::calculateMemoryForRenderSurfaces):
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::calculateDrawTransformsInternal):
+        * platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
+        (WebCore::::finishedRenderTarget):
+        (WebCore::reduceOcclusionBelowSurface):
+        (WebCore::::leaveToRenderTarget):
+        * platform/graphics/chromium/cc/CCRenderPass.cpp:
+        (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer):
+        * platform/graphics/chromium/cc/CCRenderSurface.cpp:
+        (WebCore::CCRenderSurface::drawableContentRect):
+        (WebCore::CCRenderSurface::appendQuads):
+        * platform/graphics/chromium/cc/CCRenderSurface.h:
+        (CCRenderSurface):
+
 2012-07-16  Beth Dakin  <bdakin@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=91299
index e6ba98a..83058e6 100644 (file)
@@ -129,12 +129,12 @@ public:
     bool opacityIsAnimating() const;
 
     void setFilters(const WebKit::WebFilterOperations&);
-    const WebKit::WebFilterOperations& filters() { return m_filters; }
+    const WebKit::WebFilterOperations& filters() const { return m_filters; }
 
     // Background filters are filters applied to what is behind this layer, when they are viewed through non-opaque
     // regions in this layer. They are used through the WebLayer interface, and are not exposed to HTML.
     void setBackgroundFilters(const WebKit::WebFilterOperations&);
-    const WebKit::WebFilterOperations& backgroundFilters() { return m_backgroundFilters; }
+    const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
 
     virtual void setOpaque(bool);
     bool opaque() const { return m_opaque; }
@@ -208,6 +208,10 @@ public:
     void setReplicaLayer(LayerChromium*);
     LayerChromium* replicaLayer() const { return m_replicaLayer.get(); }
 
+    bool hasMask() const { return m_maskLayer; }
+    bool hasReplica() const { return m_replicaLayer; }
+    bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
+
     // These methods typically need to be overwritten by derived classes.
     virtual bool drawsContent() const { return m_isDrawable; }
     virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) { }
index 0bb9d9b..f7aebee 100644 (file)
@@ -40,8 +40,6 @@ namespace WebCore {
 
 RenderSurfaceChromium::RenderSurfaceChromium(LayerChromium* owningLayer)
     : m_owningLayer(owningLayer)
-    , m_maskLayer(0)
-    , m_skipsDraw(false)
     , m_drawOpacity(1)
     , m_drawOpacityIsAnimating(false)
     , m_targetSurfaceTransformsAreAnimating(false)
@@ -65,21 +63,6 @@ FloatRect RenderSurfaceChromium::drawableContentRect() const
     return drawableContentRect;
 }
 
-bool RenderSurfaceChromium::hasReplica() const
-{
-    return m_owningLayer->replicaLayer();
-}
-
-bool RenderSurfaceChromium::hasMask() const
-{
-    return m_maskLayer;
-}
-
-bool RenderSurfaceChromium::replicaHasMask() const
-{
-    return hasReplica() && (m_maskLayer || m_owningLayer->replicaLayer()->maskLayer());
-}
-
 FloatRect RenderSurfaceChromium::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const
 {
     WebTransformationMatrix inverseScreenSpaceTransform = m_screenSpaceTransform.inverse();
index cd9de8d..1681c5b 100644 (file)
 
 #include "FloatRect.h"
 #include "IntRect.h"
-#include <public/WebFilterOperations.h>
 #include <public/WebTransformationMatrix.h>
 #include <wtf/Noncopyable.h>
 
 namespace WebCore {
 
-class FilterOperations;
 class LayerChromium;
 class LayerRendererChromium;
 
@@ -90,36 +88,18 @@ public:
     const IntRect& scissorRect() const { return m_scissorRect; }
     void setScissorRect(const IntRect& scissorRect) { m_scissorRect = scissorRect; }
 
-    void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
-    const WebKit::WebFilterOperations& filters() const { return m_filters; }
-
-    void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
-    const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
-
-    bool skipsDraw() const { return m_skipsDraw; }
-    void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
-
     void clearLayerList() { m_layerList.clear(); }
     Vector<RefPtr<LayerChromium> >& layerList() { return m_layerList; }
 
-    void setMaskLayer(LayerChromium* maskLayer) { m_maskLayer = maskLayer; }
-
     void setNearestAncestorThatMovesPixels(RenderSurfaceChromium* surface) { m_nearestAncestorThatMovesPixels = surface; }
     const RenderSurfaceChromium* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
 
-    bool hasReplica() const;
-
-    bool hasMask() const;
-    bool replicaHasMask() const;
-
     FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const;
 private:
     LayerChromium* m_owningLayer;
-    LayerChromium* m_maskLayer;
 
     // Uses this surface's space.
     IntRect m_contentRect;
-    bool m_skipsDraw;
 
     float m_drawOpacity;
     bool m_drawOpacityIsAnimating;
@@ -131,8 +111,6 @@ private:
     WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
     bool m_targetSurfaceTransformsAreAnimating;
     bool m_screenSpaceTransformsAreAnimating;
-    WebKit::WebFilterOperations m_filters;
-    WebKit::WebFilterOperations m_backgroundFilters;
 
     // Uses the space of the surface's target surface.
     IntRect m_clipRect;
index 42dabd3..503f8a1 100644 (file)
@@ -80,6 +80,10 @@ public:
     void setReplicaLayer(PassOwnPtr<CCLayerImpl>);
     CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
 
+    bool hasMask() const { return m_maskLayer; }
+    bool hasReplica() const { return m_replicaLayer; }
+    bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_replicaLayer->m_maskLayer); }
+
     CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; }
     void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostImpl = hostImpl; }
 
index da2cb32..1f51f19 100644 (file)
@@ -555,7 +555,7 @@ size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& update
         size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA);
         contentsTextureBytes += bytes;
 
-        if (renderSurface->backgroundFilters().isEmpty())
+        if (renderSurfaceLayer->backgroundFilters().isEmpty())
             continue;
 
         if (bytes > maxBackgroundTextureBytes)
index 18d48f9..c75d548 100644 (file)
@@ -618,13 +618,10 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
         if (layer->replicaLayer() && layer->replicaLayer()->maskLayer())
             layer->replicaLayer()->maskLayer()->setRenderTarget(layer);
 
-        renderSurface->setFilters(layer->filters());
-        if (renderSurface->filters().hasFilterThatMovesPixels())
+        if (layer->filters().hasFilterThatMovesPixels())
             nearestAncestorThatMovesPixels = renderSurface;
         renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels);
 
-        renderSurface->setBackgroundFilters(layer->backgroundFilters());
-
         renderSurfaceLayerList.append(layer);
     } else {
         layer->setDrawTransform(combinedTransform);
index e937ce0..0d01593 100644 (file)
@@ -124,7 +124,7 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::finishedRenderTarget(
     RenderSurfaceType* surface = finishedTarget->renderSurface();
 
     // If the occlusion within the surface can not be applied to things outside of the surface's subtree, then clear the occlusion here so it won't be used.
-    if (finishedTarget->maskLayer() || !surfaceOpacityKnown(surface) || surface->drawOpacity() < 1 || surface->filters().hasFilterThatAffectsOpacity()) {
+    if (finishedTarget->maskLayer() || !surfaceOpacityKnown(surface) || surface->drawOpacity() < 1 || finishedTarget->filters().hasFilterThatAffectsOpacity()) {
         m_stack.last().occlusionInScreen = Region();
         m_stack.last().occlusionInTarget = Region();
     } else {
@@ -209,7 +209,7 @@ static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const IntR
         boundsInTarget.intersect(contributingLayer->renderSurface()->clipRect());
 
     int outsetTop, outsetRight, outsetBottom, outsetLeft;
-    contributingLayer->renderSurface()->backgroundFilters().getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
+    contributingLayer->backgroundFilters().getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
 
     // The filter can move pixels from outside of the clip, so allow affectedArea to expand outside the clip.
     boundsInTarget.move(-outsetLeft, -outsetTop);
@@ -236,14 +236,14 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(c
     const LayerType* oldTarget = m_stack[lastIndex].target;
     const RenderSurfaceType* oldSurface = oldTarget->renderSurface();
     Region oldTargetOcclusionInNewTarget = transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->originTransform());
-    if (oldSurface->hasReplica() && !oldSurface->replicaHasMask())
+    if (oldTarget->hasReplica() && !oldTarget->replicaHasMask())
         oldTargetOcclusionInNewTarget.unite(transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->replicaOriginTransform()));
 
     IntRect unoccludedSurfaceRect;
     IntRect unoccludedReplicaRect;
-    if (oldSurface->backgroundFilters().hasFilterThatMovesPixels()) {
+    if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) {
         unoccludedSurfaceRect = unoccludedContributingSurfaceContentRect(oldTarget, false, oldSurface->contentRect());
-        if (oldSurface->hasReplica())
+        if (oldTarget->hasReplica())
             unoccludedReplicaRect = unoccludedContributingSurfaceContentRect(oldTarget, true, oldSurface->contentRect());
     }
 
@@ -258,9 +258,9 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(c
         m_stack.last().occlusionInTarget = oldTargetOcclusionInNewTarget;
     }
 
-    if (oldSurface->backgroundFilters().hasFilterThatMovesPixels()) {
+    if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) {
         reduceOcclusionBelowSurface(oldTarget, unoccludedSurfaceRect, oldSurface->originTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
-        if (oldSurface->hasReplica())
+        if (oldTarget->hasReplica())
             reduceOcclusionBelowSurface(oldTarget, unoccludedReplicaRect, oldSurface->replicaOriginTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
     }
 }
index b11100a..f2e7a8f 100644 (file)
@@ -75,7 +75,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC
     surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id());
     m_sharedQuadStateList.append(sharedQuadState.release());
 
-    if (!surface->hasReplica())
+    if (!layer->hasReplica())
         return;
 
     // Add replica after the surface so that it appears below the surface.
index 2c93718..e726096 100644 (file)
@@ -78,7 +78,7 @@ FloatRect CCRenderSurface::drawableContentRect() const
     FloatRect localContentRect(-0.5 * m_contentRect.width(), -0.5 * m_contentRect.height(),
                                m_contentRect.width(), m_contentRect.height());
     FloatRect drawableContentRect = CCMathUtil::mapClippedRect(m_drawTransform, localContentRect);
-    if (hasReplica())
+    if (m_owningLayer->hasReplica())
         drawableContentRect.unite(CCMathUtil::mapClippedRect(m_replicaDrawTransform, localContentRect));
 
     return drawableContentRect;
@@ -120,20 +120,6 @@ int CCRenderSurface::owningLayerId() const
     return m_owningLayer ? m_owningLayer->id() : 0;
 }
 
-bool CCRenderSurface::hasReplica() const
-{
-    return m_owningLayer->replicaLayer();
-}
-
-bool CCRenderSurface::hasMask() const
-{
-    return m_owningLayer->maskLayer();
-}
-
-bool CCRenderSurface::replicaHasMask() const
-{
-    return hasReplica() && (m_owningLayer->maskLayer() || m_owningLayer->replicaLayer()->maskLayer());
-}
 
 void CCRenderSurface::setClipRect(const IntRect& clipRect)
 {
@@ -197,7 +183,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec
 
 void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId)
 {
-    ASSERT(!forReplica || hasReplica());
+    ASSERT(!forReplica || m_owningLayer->hasReplica());
 
     if (m_owningLayer->hasDebugBorders()) {
         int red = forReplica ? debugReplicaBorderColorRed : debugSurfaceBorderColorRed;
@@ -227,7 +213,10 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha
     WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
     IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();
 
-    quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame));
+    const WebKit::WebFilterOperations& filters = m_owningLayer->filters();
+    const WebKit::WebFilterOperations& backgroundFilters = m_owningLayer->backgroundFilters();
+
+    quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame));
 }
 
 }
index 7908e84..9f7d876 100644 (file)
@@ -32,7 +32,6 @@
 #include "FloatRect.h"
 #include "IntRect.h"
 #include "cc/CCSharedQuadState.h"
-#include <public/WebFilterOperations.h>
 #include <public/WebTransformationMatrix.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/text/WTFString.h>
@@ -63,12 +62,6 @@ public:
     float drawOpacity() const { return m_drawOpacity; }
     void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
 
-    void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
-    const WebKit::WebFilterOperations& filters() const { return m_filters; }
-
-    void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
-    const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
-
     void setNearestAncestorThatMovesPixels(CCRenderSurface* surface) { m_nearestAncestorThatMovesPixels = surface; }
     const CCRenderSurface* nearestAncestorThatMovesPixels() const { return m_nearestAncestorThatMovesPixels; }
 
@@ -115,11 +108,6 @@ public:
 
     int owningLayerId() const;
 
-    bool hasReplica() const;
-
-    bool hasMask() const;
-    bool replicaHasMask() const;
-
     void resetPropertyChangedFlag() { m_surfacePropertyChanged = false; }
     bool surfacePropertyChanged() const;
     bool surfacePropertyChangedOnlyFromDescendant() const;
@@ -150,8 +138,6 @@ private:
     WebKit::WebTransformationMatrix m_replicaScreenSpaceTransform;
     bool m_targetSurfaceTransformsAreAnimating;
     bool m_screenSpaceTransformsAreAnimating;
-    WebKit::WebFilterOperations m_filters;
-    WebKit::WebFilterOperations m_backgroundFilters;
 
     // Uses the space of the surface's target surface.
     IntRect m_clipRect;