Title: [123666] trunk/Source
Revision
123666
Author
dan...@chromium.org
Date
2012-07-25 15:07:50 -0700 (Wed, 25 Jul 2012)

Log Message

[chromium] Move WebFilterOperations from RenderPassDrawQuad to RenderPass
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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123665 => 123666)


--- trunk/Source/WebCore/ChangeLog	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/ChangeLog	2012-07-25 22:07:50 UTC (rev 123666)
@@ -1,3 +1,47 @@
+2012-07-25  Dana Jansens  <dan...@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  <r...@google.com>
 
         fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -334,14 +334,14 @@
 
 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 @@
     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 @@
     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 @@
 
     // 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 @@
     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 @@
     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 @@
     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 @@
     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()) {

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2012-07-25 22:07:50 UTC (rev 123666)
@@ -80,7 +80,7 @@
     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 @@
 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 @@
     WebKit::WebGraphicsContext3D* m_context;
 
     const CCRenderPass* m_defaultRenderPass;
+    const CCRenderPassIdHashMap* m_renderPassesById;
 
     bool m_isViewportChanged;
     bool m_isFramebufferDiscarded;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -283,6 +283,9 @@
 
         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 @@
     // 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();

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h	2012-07-25 22:07:50 UTC (rev 123666)
@@ -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 @@
     // 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 @@
     Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList;
     bool m_hasTransparentBackground;
     bool m_hasOcclusionFromOutsideTargetSurface;
+    WebKit::WebFilterOperations m_filters;
+    WebKit::WebFilterOperations m_backgroundFilters;
 };
 
 typedef Vector<CCRenderPass*> CCRenderPassList;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -31,18 +31,16 @@
 
 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)
 {

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h	2012-07-25 22:07:50 UTC (rev 123666)
@@ -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 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 @@
     // 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;
 };

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -211,10 +211,7 @@
     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));
 }
 
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h (123665 => 123666)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCRenderer.h	2012-07-25 22:07:50 UTC (rev 123666)
@@ -80,7 +80,7 @@
     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;

Modified: trunk/Source/WebKit/chromium/ChangeLog (123665 => 123666)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 22:07:50 UTC (rev 123666)
@@ -1,3 +1,20 @@
+2012-07-25  Dana Jansens  <dan...@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  <shawnsi...@chromium.org>
 
         [chromium] Refactor CCLayerTreeHostCommon: move root layer special case initialization into internal code.

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (123665 => 123666)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -3577,12 +3577,12 @@
 
 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 @@
 
                 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());
             }
         }

Modified: trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp (123665 => 123666)


--- trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp	2012-07-25 21:47:21 UTC (rev 123665)
+++ trunk/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp	2012-07-25 22:07:50 UTC (rev 123666)
@@ -80,8 +80,9 @@
         , 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 @@
     // 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 @@
     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 @@
     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 @@
     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 @@
 
     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 @@
 
     EXPECT_TRUE(layerRendererChromium.initialize());
 
-    layerRendererChromium.drawFrame(mockClient.renderPasses(), FloatRect());
+    layerRendererChromium.drawFrame(mockClient.renderPassesInDrawOrder(), mockClient.renderPasses(), FloatRect());
 
     EXPECT_EQ(1, context->clearCount());
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to