[chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jul 2012 22:07:50 +0000 (22:07 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jul 2012 22:07:50 +0000 (22:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91885

Reviewed by Adrienne Walker.

Source/WebCore:

We move the filter operations to CCRenderPass to avoid having
variable-length data in a WebCompositorQuad in order to serialize,
and also to avoid requiring a virtual destructor for the quad
classes.

The drawFrame method now takes a CCRenderPassIdHashMap in order
to connect RenderPass quads to their source RenderPass.

Covered by existing tests.

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame):
(WebCore::LayerRendererChromium::drawFrame):
(WebCore::LayerRendererChromium::beginDrawingFrame):
(WebCore::LayerRendererChromium::drawBackgroundFilters):
(WebCore::LayerRendererChromium::drawRenderPassQuad):
* platform/graphics/chromium/LayerRendererChromium.h:
(LayerRendererChromium):
* platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
(WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
(WebCore::CCLayerTreeHostImpl::drawLayers):
* platform/graphics/chromium/cc/CCRenderPass.h:
(WebCore::CCRenderPass::filters):
(WebCore::CCRenderPass::setFilters):
(CCRenderPass):
(WebCore::CCRenderPass::backgroundFilters):
(WebCore::CCRenderPass::setBackgroundFilters):
* platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp:
(WebCore::CCRenderPassDrawQuad::create):
(WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad):
* platform/graphics/chromium/cc/CCRenderPassDrawQuad.h:
(CCRenderPassDrawQuad):
* platform/graphics/chromium/cc/CCRenderSurface.cpp:
(WebCore::CCRenderSurface::appendQuads):
* platform/graphics/chromium/cc/CCRenderer.h:
(CCRenderer):

Source/WebKit/chromium:

* tests/CCLayerTreeHostImplTest.cpp:
* tests/LayerRendererChromiumTest.cpp:
(FakeCCRendererClient::FakeCCRendererClient):
(FakeCCRendererClient::rootRenderPass):
(FakeCCRendererClient::renderPassesInDrawOrder):
(FakeCCRendererClient::renderPasses):
(FakeCCRendererClient):
(TEST_F):
(TEST):

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

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp
Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp

index e1dc495..83fd80c 100644 (file)
@@ -1,3 +1,47 @@
+2012-07-25  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass
+        https://bugs.webkit.org/show_bug.cgi?id=91885
+
+        Reviewed by Adrienne Walker.
+
+        We move the filter operations to CCRenderPass to avoid having
+        variable-length data in a WebCompositorQuad in order to serialize,
+        and also to avoid requiring a virtual destructor for the quad
+        classes.
+
+        The drawFrame method now takes a CCRenderPassIdHashMap in order
+        to connect RenderPass quads to their source RenderPass.
+
+        Covered by existing tests.
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::decideRenderPassAllocationsForFrame):
+        (WebCore::LayerRendererChromium::drawFrame):
+        (WebCore::LayerRendererChromium::beginDrawingFrame):
+        (WebCore::LayerRendererChromium::drawBackgroundFilters):
+        (WebCore::LayerRendererChromium::drawRenderPassQuad):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+        (LayerRendererChromium):
+        * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+        (WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
+        (WebCore::CCLayerTreeHostImpl::drawLayers):
+        * platform/graphics/chromium/cc/CCRenderPass.h:
+        (WebCore::CCRenderPass::filters):
+        (WebCore::CCRenderPass::setFilters):
+        (CCRenderPass):
+        (WebCore::CCRenderPass::backgroundFilters):
+        (WebCore::CCRenderPass::setBackgroundFilters):
+        * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp:
+        (WebCore::CCRenderPassDrawQuad::create):
+        (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad):
+        * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h:
+        (CCRenderPassDrawQuad):
+        * platform/graphics/chromium/cc/CCRenderSurface.cpp:
+        (WebCore::CCRenderSurface::appendQuads):
+        * platform/graphics/chromium/cc/CCRenderer.h:
+        (CCRenderer):
+
 2012-07-25  Mike Reed  <reed@google.com>
 
         fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy
index 1281d80..680b10e 100644 (file)
@@ -334,14 +334,14 @@ GC3Denum LayerRendererChromium::renderPassTextureFormat(const CCRenderPass*)
 
 void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPassList& renderPassesInDrawOrder)
 {
-    HashMap<int, const CCRenderPass*> passesInFrame;
+    HashMap<int, const CCRenderPass*> renderPassesInFrame;
     for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i)
-        passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]);
+        renderPassesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]);
 
     Vector<int> passesToDelete;
     HashMap<int, OwnPtr<CachedTexture> >::const_iterator passIterator;
     for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPassTextures.end(); ++passIterator) {
-        const CCRenderPass* renderPassInFrame = passesInFrame.get(passIterator->first);
+        const CCRenderPass* renderPassInFrame = renderPassesInFrame.get(passIterator->first);
         if (!renderPassInFrame) {
             passesToDelete.append(passIterator->first);
             continue;
@@ -374,29 +374,34 @@ bool LayerRendererChromium::haveCachedResourcesForRenderPassId(int id) const
     return texture && texture->id() && texture->isComplete();
 }
 
-void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPasses, const FloatRect& rootScissorRect)
+void LayerRendererChromium::drawFrame(const CCRenderPassList& renderPassesInDrawOrder, const CCRenderPassIdHashMap& renderPassesById, const FloatRect& rootScissorRect)
 {
-    const CCRenderPass* rootRenderPass = renderPasses.last();
-    beginDrawingFrame(rootRenderPass);
+    const CCRenderPass* rootRenderPass = renderPassesInDrawOrder.last();
+    ASSERT(rootRenderPass);
 
-    for (size_t i = 0; i < renderPasses.size(); ++i) {
-        const CCRenderPass* renderPass = renderPasses[i];
+    m_defaultRenderPass = rootRenderPass;
+    m_renderPassesById = &renderPassesById;
+
+    beginDrawingFrame();
+
+    for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) {
+        const CCRenderPass* renderPass = renderPassesInDrawOrder[i];
 
         FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(rootScissorRect);
         drawRenderPass(renderPass, rootScissorRectInCurrentSurface);
     }
 
     finishDrawingFrame();
+
+    m_defaultRenderPass = 0;
+    m_renderPassesById = 0;
 }
 
-void LayerRendererChromium::beginDrawingFrame(const CCRenderPass* rootRenderPass)
+void LayerRendererChromium::beginDrawingFrame()
 {
     // FIXME: Remove this once framebuffer is automatically recreated on first use
     ensureFramebuffer();
 
-    m_defaultRenderPass = rootRenderPass;
-    ASSERT(m_defaultRenderPass);
-
     if (viewportSize().isEmpty())
         return;
 
@@ -556,7 +561,7 @@ static inline SkBitmap applyFilters(LayerRendererChromium* layerRenderer, const
     return source;
 }
 
-PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebTransformationMatrix& contentsDeviceTransform)
+PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* quad, const WebKit::WebFilterOperations& filters, const WebTransformationMatrix& contentsDeviceTransform)
 {
     // This method draws a background filter, which applies a filter to any pixels behind the quad and seen through its background.
     // The algorithm works as follows:
@@ -574,7 +579,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C
 
     // FIXME: When this algorithm changes, update CCLayerTreeHost::prioritizeTextures() accordingly.
 
-    if (quad->backgroundFilters().isEmpty())
+    if (filters.isEmpty())
         return nullptr;
 
     // FIXME: We only allow background filters on an opaque render surface because other surfaces may contain
@@ -587,7 +592,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C
     IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox()));
 
     int top, right, bottom, left;
-    quad->backgroundFilters().getOutsets(top, right, bottom, left);
+    filters.getOutsets(top, right, bottom, left);
     deviceRect.move(-left, -top);
     deviceRect.expand(left + right, top + bottom);
 
@@ -597,7 +602,7 @@ PassOwnPtr<CCScopedTexture> LayerRendererChromium::drawBackgroundFilters(const C
     if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
         return nullptr;
 
-    SkBitmap filteredDeviceBackground = applyFilters(this, quad->backgroundFilters(), deviceBackgroundTexture.get());
+    SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get());
     if (!filteredDeviceBackground.getTexture())
         return nullptr;
 
@@ -636,6 +641,11 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad)
     if (!contentsTexture || !contentsTexture->id())
         return;
 
+    const CCRenderPass* renderPass = m_renderPassesById->get(quad->renderPassId());
+    ASSERT(renderPass);
+    if (!renderPass)
+        return;
+
     WebTransformationMatrix renderMatrix = quad->quadTransform();
     renderMatrix.translate(0.5 * quad->quadRect().width() + quad->quadRect().x(), 0.5 * quad->quadRect().height() + quad->quadRect().y());
     WebTransformationMatrix deviceMatrix = renderMatrix;
@@ -646,11 +656,11 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad)
     if (!contentsDeviceTransform.isInvertible())
         return;
 
-    OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(quad, contentsDeviceTransform);
+    OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(quad, renderPass->backgroundFilters(), contentsDeviceTransform);
 
     // FIXME: Cache this value so that we don't have to do it for both the surface and its replica.
     // Apply filters to the contents texture.
-    SkBitmap filterBitmap = applyFilters(this, quad->filters(), contentsTexture);
+    SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTexture);
     OwnPtr<CCScopedLockResourceForRead> contentsResourceLock;
     unsigned contentsTextureId = 0;
     if (filterBitmap.getTexture()) {
index 90bd774..8f59d4e 100644 (file)
@@ -80,7 +80,7 @@ public:
     virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) OVERRIDE;
     virtual bool haveCachedResourcesForRenderPassId(int id) const OVERRIDE;
 
-    virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) OVERRIDE;
+    virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&, const FloatRect& rootScissorRect) OVERRIDE;
 
     // waits for rendering to finish
     virtual void finish() OVERRIDE;
@@ -121,14 +121,14 @@ protected:
 private:
     static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&);
 
-    void beginDrawingFrame(const CCRenderPass* rootRenderPass);
+    void beginDrawingFrame();
     void drawRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect);
     void finishDrawingFrame();
 
     void drawQuad(const CCDrawQuad*);
     void drawCheckerboardQuad(const CCCheckerboardDrawQuad*);
     void drawDebugBorderQuad(const CCDebugBorderDrawQuad*);
-    PassOwnPtr<CCScopedTexture> drawBackgroundFilters(const CCRenderPassDrawQuad*, const WebKit::WebTransformationMatrix& deviceTransform);
+    PassOwnPtr<CCScopedTexture> drawBackgroundFilters(const CCRenderPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformationMatrix& deviceTransform);
     void drawRenderPassQuad(const CCRenderPassDrawQuad*);
     void drawSolidColorQuad(const CCSolidColorDrawQuad*);
     void drawStreamVideoQuad(const CCStreamVideoDrawQuad*);
@@ -264,6 +264,7 @@ private:
     WebKit::WebGraphicsContext3D* m_context;
 
     const CCRenderPass* m_defaultRenderPass;
+    const CCRenderPassIdHashMap* m_renderPassesById;
 
     bool m_isViewportChanged;
     bool m_isFramebufferDiscarded;
index 32e3f09..493f35a 100644 (file)
@@ -283,6 +283,9 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
 
         int renderPassId = renderSurfaceLayer->id();
         OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId);
+        pass->setFilters(renderSurfaceLayer->filters());
+        pass->setBackgroundFilters(renderSurfaceLayer->backgroundFilters());
+
         surfacePassMap.add(renderSurface, pass.get());
         frame.renderPasses.append(pass.get());
         frame.renderPassesById.add(renderPassId, pass.release());
@@ -539,7 +542,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
     // RenderWidget.
     m_fpsCounter->markBeginningOfFrame(currentTime());
 
-    m_layerRenderer->drawFrame(frame.renderPasses, m_rootScissorRect);
+    m_layerRenderer->drawFrame(frame.renderPasses, frame.renderPassesById, m_rootScissorRect);
 
     for (unsigned int i = 0; i < frame.renderPasses.size(); i++)
         frame.renderPasses[i]->targetSurface()->damageTracker()->didDrawDamagedArea();
index 816481c..7158212 100644 (file)
@@ -30,6 +30,7 @@
 #include "cc/CCDrawQuad.h"
 #include "cc/CCOcclusionTracker.h"
 #include "cc/CCSharedQuadState.h"
+#include <public/WebFilterOperations.h>
 #include <wtf/HashMap.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
@@ -68,6 +69,12 @@ public:
     // This denotes the bounds in physical pixels of the output generated by this RenderPass.
     const IntRect& framebufferOutputRect() const { return m_framebufferOutputRect; }
 
+    const WebKit::WebFilterOperations& filters() const { return m_filters; }
+    void setFilters(const WebKit::WebFilterOperations& filters) { m_filters = filters; }
+
+    const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
+    void setBackgroundFilters(const WebKit::WebFilterOperations& filters) { m_backgroundFilters = filters; }
+
     bool hasTransparentBackground() const { return m_hasTransparentBackground; }
     void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
 
@@ -83,6 +90,8 @@ protected:
     Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList;
     bool m_hasTransparentBackground;
     bool m_hasOcclusionFromOutsideTargetSurface;
+    WebKit::WebFilterOperations m_filters;
+    WebKit::WebFilterOperations m_backgroundFilters;
 };
 
 typedef Vector<CCRenderPass*> CCRenderPassList;
index 2d74a22..8f51b94 100644 (file)
@@ -31,18 +31,16 @@ using WebKit::WebCompositorQuad;
 
 namespace WebCore {
 
-PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame)
+PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame)
 {
-    return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame));
+    return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, maskResourceId, contentsChangedSinceLastFrame));
 }
 
-CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame)
+CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame)
     : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect)
     , m_renderPassId(renderPassId)
     , m_isReplica(isReplica)
     , m_drawTransform(drawTransform)
-    , m_filters(filters)
-    , m_backgroundFilters(backgroundFilters)
     , m_maskResourceId(maskResourceId)
     , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame)
 {
index 6f399be..aff8db6 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "cc/CCResourceProvider.h"
 #include <public/WebCompositorQuad.h>
-#include <public/WebFilterOperations.h>
 #include <public/WebTransformationMatrix.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -39,7 +38,7 @@ class CCRenderPass;
 class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad {
     WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad);
 public:
-    static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame);
+    static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame);
 
     int renderPassId() const { return m_renderPassId; }
     bool isReplica() const { return m_isReplica; }
@@ -49,18 +48,13 @@ public:
     // FIXME: This should be removed and we should draw the RenderPass with the quadTransform.
     const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; }
 
-    const WebKit::WebFilterOperations& filters() const { return m_filters; }
-    const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; }
-
     static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*);
 private:
-    CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame);
+    CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, CCResourceProvider::ResourceId maskResourceId, const IntRect& contentsChangedSinceLastFrame);
 
     int m_renderPassId;
     bool m_isReplica;
     WebKit::WebTransformationMatrix m_drawTransform;
-    WebKit::WebFilterOperations m_filters;
-    WebKit::WebFilterOperations m_backgroundFilters;
     CCResourceProvider::ResourceId m_maskResourceId;
     IntRect m_contentsChangedSinceLastFrame;
 };
index 95ef0b9..5067b9e 100644 (file)
@@ -211,10 +211,7 @@ void CCRenderSurface::appendQuads(CCQuadSink& quadList, CCSharedQuadState* share
     WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
     IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();
 
-    const WebKit::WebFilterOperations& filters = m_owningLayer->filters();
-    const WebKit::WebFilterOperations& backgroundFilters = m_owningLayer->backgroundFilters();
-
-    quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters, backgroundFilters, maskResourceId, contentsChangedSinceLastFrame));
+    quadList.append(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, maskResourceId, contentsChangedSinceLastFrame));
 }
 
 }
index 9397871..51b8942 100644 (file)
@@ -80,7 +80,7 @@ public:
     virtual void decideRenderPassAllocationsForFrame(const CCRenderPassList&) { }
     virtual bool haveCachedResourcesForRenderPassId(int) const { return false; }
 
-    virtual void drawFrame(const CCRenderPassList&, const FloatRect& rootScissorRect) = 0;
+    virtual void drawFrame(const CCRenderPassList&, const CCRenderPassIdHashMap&, const FloatRect& rootScissorRect) = 0;
 
     // waits for rendering to finish
     virtual void finish() = 0;
index 27b552b..b7e7e8d 100644 (file)
@@ -1,3 +1,20 @@
+2012-07-25  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass
+        https://bugs.webkit.org/show_bug.cgi?id=91885
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+        * tests/LayerRendererChromiumTest.cpp:
+        (FakeCCRendererClient::FakeCCRendererClient):
+        (FakeCCRendererClient::rootRenderPass):
+        (FakeCCRendererClient::renderPassesInDrawOrder):
+        (FakeCCRendererClient::renderPasses):
+        (FakeCCRendererClient):
+        (TEST_F):
+        (TEST):
+
 2012-07-24  Shawn Singh  <shawnsingh@chromium.org>
 
         [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code.
index e64156b..c7a5c53 100644 (file)
@@ -3577,12 +3577,12 @@ struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData {
 
 class CCTestRenderPass: public CCRenderPass {
 public:
-    static PassOwnPtr<CCRenderPass> create(CCRenderSurface* targetSurface, int id) { return adoptPtr(new CCTestRenderPass(targetSurface, id)); }
+    static PassOwnPtr<CCRenderPass> create(CCRenderSurface* renderSurface, int id) { return adoptPtr(new CCTestRenderPass(renderSurface, id)); }
 
     void appendQuad(PassOwnPtr<CCDrawQuad> quad) { m_quadList.append(quad); }
 
 protected:
-    CCTestRenderPass(CCRenderSurface* targetSurface, int id) : CCRenderPass(targetSurface, id) { }
+    CCTestRenderPass(CCRenderSurface* renderSurface, int id) : CCRenderPass(renderSurface, id) { }
 };
 
 class CCTestRenderer : public LayerRendererChromium, public CCRendererClient {
@@ -3698,7 +3698,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
 
                 IntRect quadRect = IntRect(0, 0, 1, 1);
                 IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect();
-                OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect);
+                OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), 1, contentsChangedRect);
                 static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release());
             }
         }
index f1d8dc1..d861164 100644 (file)
@@ -80,8 +80,9 @@ public:
         , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit())
     {
         m_rootLayer->createRenderSurface();
-        m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id());
-        m_renderPasses.append(m_rootRenderPass.get());
+        OwnPtr<CCRenderPass> rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id());
+        m_renderPassesInDrawOrder.append(rootRenderPass.get());
+        m_renderPasses.set(m_rootLayer->id(), rootRenderPass.release());
     }
 
     // CCRendererClient methods.
@@ -96,8 +97,9 @@ public:
     // Methods added for test.
     int setFullRootLayerDamageCount() const { return m_setFullRootLayerDamageCount; }
 
-    CCRenderPass* rootRenderPass() { return m_rootRenderPass.get(); }
-    const CCRenderPassList& renderPasses() { return m_renderPasses; }
+    CCRenderPass* rootRenderPass() { return m_renderPassesInDrawOrder.last(); }
+    const CCRenderPassList& renderPassesInDrawOrder() const { return m_renderPassesInDrawOrder; }
+    const CCRenderPassIdHashMap& renderPasses() const { return m_renderPasses; }
 
     size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; }
 
@@ -105,8 +107,8 @@ private:
     int m_setFullRootLayerDamageCount;
     DebugScopedSetImplThread m_implThread;
     OwnPtr<CCLayerImpl> m_rootLayer;
-    OwnPtr<CCRenderPass> m_rootRenderPass;
-    CCRenderPassList m_renderPasses;
+    CCRenderPassList m_renderPassesInDrawOrder;
+    CCRenderPassIdHashMap m_renderPasses;
     size_t m_memoryAllocationLimitBytes;
 };
 
@@ -222,7 +224,7 @@ TEST_F(LayerRendererChromiumTest, DiscardedBackbufferIsRecreatedForScopeDuration
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
 
     m_layerRendererChromium.setVisible(true);
-    m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect());
+    m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect());
     EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
 
     swapBuffers();
@@ -237,7 +239,7 @@ TEST_F(LayerRendererChromiumTest, FramebufferDiscardedAfterReadbackWhenNotVisibl
     EXPECT_EQ(1, m_mockClient.setFullRootLayerDamageCount());
 
     char pixels[4];
-    m_layerRendererChromium.drawFrame(m_mockClient.renderPasses(), FloatRect());
+    m_layerRendererChromium.drawFrame(m_mockClient.renderPassesInDrawOrder(), m_mockClient.renderPasses(), FloatRect());
     EXPECT_FALSE(m_layerRendererChromium.isFramebufferDiscarded());
 
     m_layerRendererChromium.getFramebufferPixels(pixels, IntRect(0, 0, 1, 1));
@@ -418,7 +420,7 @@ TEST(LayerRendererChromiumTest2, opaqueBackground)
 
     EXPECT_TRUE(layerRendererChromium.initialize());
 
-    layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect());
+    layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect());
 
     // On DEBUG builds, render passes with opaque background clear to blue to
     // easily see regions that were not drawn on the screen.
@@ -441,7 +443,7 @@ TEST(LayerRendererChromiumTest2, transparentBackground)
 
     EXPECT_TRUE(layerRendererChromium.initialize());
 
-    layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect());
+    layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect());
 
     EXPECT_EQ(1, context->clearCount());
 }