Title: [113637] trunk/Source
Revision
113637
Author
dan...@chromium.org
Date
2012-04-09 15:52:25 -0700 (Mon, 09 Apr 2012)

Log Message

[chromium] Make culling work with clipped rects
https://bugs.webkit.org/show_bug.cgi?id=83494

Reviewed by Adrienne Walker.

Source/WebCore:

Use new CCMathUtil transformation methods to deal with rects that clip
the camera plane. This fixes three things:

1. A layer completely behind the camera is not visible and should not
occlude.
2. A layer that is clipped by the camera is treated like a
non-axis-aligned transform, as the result of a mapClippedRect() is a
bounding box and may contain pixels not in the original rect. This guards
our use of mapRect() when transforming occluded regions.
3. A layer's occlusion must be clipped by its scissor rect. This scissor
rect exists in its target space, so occlusion in screen space is only
possible if its target also is axis aligned in the screen, such that
the layer's scissor rect remains a rect in screen space.

Unit tests: CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude
            CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect

* platform/graphics/chromium/cc/CCMathUtil.cpp:
(WebCore::CCMathUtil::mapQuad):
* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::transformSurfaceOpaqueRegion):
(WebCore::computeOcclusionBehindLayer):
(WebCore::::markOccludedBehindLayer):
(WebCore::testContentRectOccluded):
(WebCore::computeUnoccludedContentRect):

Source/WebKit/chromium:

* tests/CCOcclusionTrackerTest.cpp:
(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude):
(WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
(WebKitTests):
(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect):
(WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
* tests/CCQuadCullerTest.cpp:
(WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
(WebCore::makeLayer):
(WebCore::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113636 => 113637)


--- trunk/Source/WebCore/ChangeLog	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebCore/ChangeLog	2012-04-09 22:52:25 UTC (rev 113637)
@@ -1,3 +1,36 @@
+2012-04-09  Dana Jansens  <dan...@chromium.org>
+
+        [chromium] Make culling work with clipped rects
+        https://bugs.webkit.org/show_bug.cgi?id=83494
+
+        Reviewed by Adrienne Walker.
+
+        Use new CCMathUtil transformation methods to deal with rects that clip
+        the camera plane. This fixes three things:
+
+        1. A layer completely behind the camera is not visible and should not
+        occlude.
+        2. A layer that is clipped by the camera is treated like a
+        non-axis-aligned transform, as the result of a mapClippedRect() is a
+        bounding box and may contain pixels not in the original rect. This guards
+        our use of mapRect() when transforming occluded regions.
+        3. A layer's occlusion must be clipped by its scissor rect. This scissor
+        rect exists in its target space, so occlusion in screen space is only
+        possible if its target also is axis aligned in the screen, such that
+        the layer's scissor rect remains a rect in screen space.
+
+        Unit tests: CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude
+                    CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect
+
+        * platform/graphics/chromium/cc/CCMathUtil.cpp:
+        (WebCore::CCMathUtil::mapQuad):
+        * platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
+        (WebCore::transformSurfaceOpaqueRegion):
+        (WebCore::computeOcclusionBehindLayer):
+        (WebCore::::markOccludedBehindLayer):
+        (WebCore::testContentRectOccluded):
+        (WebCore::computeUnoccludedContentRect):
+
 2012-04-09  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r113613.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp (113636 => 113637)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp	2012-04-09 22:52:25 UTC (rev 113637)
@@ -280,6 +280,7 @@
     if (transform.isIdentityOrTranslation()) {
         FloatQuad mappedQuad(q);
         mappedQuad.move(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
+        clipped = false;
         return mappedQuad;
     }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp (113636 => 113637)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp	2012-04-09 22:52:25 UTC (rev 113637)
@@ -115,13 +115,16 @@
     // Verify that rects within the |surface| will remain rects in its target surface after applying |transform|. If this is true, then
     // apply |transform| to each rect within |region| in order to transform the entire Region.
 
-    FloatQuad transformedBoundsQuad = transform.mapQuad(FloatQuad(region.bounds()));
-    if (!transformedBoundsQuad.isRectilinear())
+    bool clipped;
+    FloatQuad transformedBoundsQuad = CCMathUtil::mapQuad(transform, FloatQuad(region.bounds()), clipped);
+    // FIXME: Find a rect interior to each transformed quad.
+    if (clipped || !transformedBoundsQuad.isRectilinear())
         return Region();
 
     Region transformedRegion;
 
     Vector<IntRect> rects = region.rects();
+    // Clipping has been verified above, so mapRect will give correct results.
     for (size_t i = 0; i < rects.size(); ++i)
         transformedRegion.unite(enclosedIntRect(transform.mapRect(FloatRect(rects[i]))));
     return transformedRegion;
@@ -195,13 +198,15 @@
 
 // FIXME: Remove usePaintTracking when paint tracking is on for paint culling.
 template<typename LayerType>
-static inline Region computeOcclusionBehindLayer(const LayerType* layer, const TransformationMatrix& transform, bool usePaintTracking)
+static inline Region computeOcclusionBehindLayer(const LayerType* layer, const TransformationMatrix& transform, const IntRect& scissorRect, bool usePaintTracking)
 {
     Region opaqueRegion;
 
-    FloatQuad unoccludedQuad = transform.mapQuad(FloatQuad(layer->visibleLayerRect()));
+    bool clipped;
+    FloatQuad unoccludedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleLayerRect()), clipped);
     bool isPaintedAxisAligned = unoccludedQuad.isRectilinear();
-    if (!isPaintedAxisAligned)
+    // FIXME: Find a rect interior to each transformed quad.
+    if (clipped || !isPaintedAxisAligned)
         return opaqueRegion;
 
     if (layer->opaque())
@@ -211,9 +216,11 @@
     else if (usePaintTracking) {
         Region contentRegion = layer->visibleContentOpaqueRegion();
         Vector<IntRect> contentRects = contentRegion.rects();
+        // We verify that the possible bounds of this region are not clipped above, so we can use mapRect() safely here.
         for (size_t i = 0; i < contentRects.size(); ++i)
             opaqueRegion.unite(enclosedIntRect(transform.mapRect(FloatRect(contentRects[i]))));
     }
+    opaqueRegion.intersect(scissorRect);
     return opaqueRegion;
 }
 
@@ -228,16 +235,26 @@
     if (!layerOpacityKnown(layer) || layer->drawOpacity() < 1)
         return;
 
-    // FIXME: Remove m_usePaintTracking when paint tracking is on for paint culling.
-    if (layerTransformsToScreenKnown(layer))
-        m_stack.last().occlusionInScreen.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToScreenSpaceTransform<LayerType>(layer), m_usePaintTracking));
+    IntRect scissorInTarget = layerScissorRectInTargetSurface(layer);
     if (layerTransformsToTargetKnown(layer))
-        m_stack.last().occlusionInTarget.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToTargetSurfaceTransform<LayerType>(layer), m_usePaintTracking));
+        m_stack.last().occlusionInTarget.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToTargetSurfaceTransform<LayerType>(layer), scissorInTarget, m_usePaintTracking));
+
+    // We must clip the occlusion within the layer's scissorInTarget within screen space as well. If the scissor rect can't be moved to screen space and
+    // remain rectilinear, then we don't add any occlusion in screen space.
+
+    if (layerTransformsToScreenKnown(layer)) {
+        TransformationMatrix targetToScreenTransform = m_stack.last().surface->screenSpaceTransform();
+        FloatQuad scissorInScreenQuad = targetToScreenTransform.mapQuad(FloatQuad(FloatRect(scissorInTarget)));
+        if (!scissorInScreenQuad.isRectilinear())
+            return;
+        IntRect scissorInScreenRect = intersection(m_scissorRectInScreenSpace, enclosedIntRect(CCMathUtil::mapClippedRect(targetToScreenTransform, FloatRect(scissorInTarget))));
+        m_stack.last().occlusionInScreen.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToScreenSpaceTransform<LayerType>(layer), scissorInScreenRect, m_usePaintTracking));
+    }
 }
 
 static inline bool testContentRectOccluded(const IntRect& contentRect, const TransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion)
 {
-    FloatRect transformedRect = contentSpaceTransform.mapRect(FloatRect(contentRect));
+    FloatRect transformedRect = CCMathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect));
     // Take the enclosingIntRect, as we want to include partial pixels in the test.
     IntRect targetRect = intersection(enclosingIntRect(transformedRect), scissorRect);
     return targetRect.isEmpty() || occlusion.contains(targetRect);
@@ -281,13 +298,10 @@
     if (!contentSpaceTransform.isInvertible())
         return contentRect;
 
-    FloatRect transformedRect = contentSpaceTransform.mapRect(FloatRect(contentRect));
     // Take the enclosingIntRect at each step, as we want to contain any unoccluded partial pixels in the resulting IntRect.
+    FloatRect transformedRect = CCMathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect));
     IntRect shrunkRect = rectSubtractRegion(intersection(enclosingIntRect(transformedRect), scissorRect), occlusion);
-    bool clipped; // FIXME: We should be able to use projectClippedQuad instead of forcing everything to be unoccluded. https://bugs.webkit.org/show_bug.cgi?id=83217.
-    IntRect unoccludedRect = enclosingIntRect(CCMathUtil::projectQuad(contentSpaceTransform.inverse(), FloatQuad(FloatRect(shrunkRect)), clipped).boundingBox());
-    if (clipped)
-        return contentRect;
+    IntRect unoccludedRect = enclosingIntRect(CCMathUtil::projectClippedRect(contentSpaceTransform.inverse(), FloatRect(shrunkRect)));
     // The rect back in content space is a bounding box and may extend outside of the original contentRect, so clamp it to the contentRectBounds.
     return intersection(unoccludedRect, contentRect);
 }

Modified: trunk/Source/WebKit/chromium/ChangeLog (113636 => 113637)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-04-09 22:52:25 UTC (rev 113637)
@@ -1,3 +1,21 @@
+2012-04-09  Dana Jansens  <dan...@chromium.org>
+
+        [chromium] Make culling work with clipped rects
+        https://bugs.webkit.org/show_bug.cgi?id=83494
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCOcclusionTrackerTest.cpp:
+        (CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude):
+        (WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
+        (WebKitTests):
+        (CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect):
+        (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
+        * tests/CCQuadCullerTest.cpp:
+        (WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):
+        (WebCore::makeLayer):
+        (WebCore::TEST):
+
 2012-04-09  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r113613.

Modified: trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp (113636 => 113637)


--- trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp	2012-04-09 22:52:25 UTC (rev 113637)
@@ -1674,6 +1674,65 @@
 MAIN_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransformBehindCamera);
 
 template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+    void runMyTest()
+    {
+        TransformationMatrix transform;
+        transform.translate(50, 50);
+        transform.applyPerspective(100);
+        transform.translate3d(0, 0, 110);
+        transform.translate(-50, -50);
+
+        typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+        parent->setPreserves3D(true);
+        this->calcDrawEtc(parent);
+
+        TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+        occlusion.enterTargetRenderSurface(parent->renderSurface());
+
+        // This layer is entirely behind the camera and should not occlude.
+        occlusion.markOccludedBehindLayer(layer);
+        EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
+        EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
+    }
+};
+
+MAIN_THREAD_TEST(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+    void runMyTest()
+    {
+        TransformationMatrix transform;
+        transform.translate(50, 50);
+        transform.applyPerspective(100);
+        transform.translate3d(0, 0, 99);
+        transform.translate(-50, -50);
+
+        typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+        parent->setPreserves3D(true);
+        this->calcDrawEtc(parent);
+
+        TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+        occlusion.enterTargetRenderSurface(parent->renderSurface());
+
+        // This is very close to the camera, so pixels in its visibleLayerRect will actually go outside of the layer's clipRect.
+        // Ensure that those pixels don't occlude things outside the clipRect.
+        occlusion.markOccludedBehindLayer(layer);
+        EXPECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+        EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+        EXPECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+        EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+    }
+};
+
+MAIN_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect);
+
+template<class Types, bool opaqueLayers>
 class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTrackerTest<Types, opaqueLayers> {
 protected:
     void runMyTest()

Modified: trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp (113636 => 113637)


--- trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp	2012-04-09 22:49:43 UTC (rev 113636)
+++ trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp	2012-04-09 22:52:25 UTC (rev 113637)
@@ -44,8 +44,6 @@
         : CCOcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame)
         , m_scissorRectInScreen(scissorRectInScreen)
     {
-        // Pretend we have visited a render surface.
-        m_stack.append(StackObject());
     }
 
 protected:
@@ -55,7 +53,7 @@
     IntRect m_scissorRectInScreen;
 };
 
-static PassOwnPtr<CCTiledLayerImpl> makeLayer(const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect)
+static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const TransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect)
 {
     OwnPtr<CCTiledLayerImpl> layer = CCTiledLayerImpl::create(0);
     OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::NoBorderTexels);
@@ -75,6 +73,12 @@
             layer->pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), tileOpaqueRect);
         }
 
+    if (!parent) {
+        layer->createRenderSurface();
+        layer->setTargetRenderSurface(layer->renderSurface());
+    } else
+        layer->setTargetRenderSurface(parent->targetRenderSurface());
+
     return layer.release();
 }
 
@@ -101,9 +105,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     appendQuads(quadList, sharedStateList, rootLayer.get(), occlusionTracker);
@@ -117,9 +122,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -134,9 +140,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 0.9, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -151,9 +158,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -170,9 +178,10 @@
 
     childTransform.translate(50, 50);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -213,9 +222,10 @@
 
     rootRect = childRect = IntRect(0, 0, 100, 100);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(rootTransform, rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -241,9 +251,10 @@
 
     rootRect = childRect = IntRect(0, 0, 100, 100);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(rootTransform, rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -261,9 +272,10 @@
 
     childTransform.translate(100, 100);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -280,10 +292,11 @@
 
     childTransform.translate(50, 50);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
     IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -300,10 +313,11 @@
 
     childTransform.translate(50, 10);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
     IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -320,10 +334,11 @@
 
     childTransform.translate(50, 49);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
     IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, false, childOpaqueRect);
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, false, childOpaqueRect);
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -341,9 +356,10 @@
     // Use a small rotation so as to not disturb the geometry significantly.
     childTransform.rotate(1);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(childTransform, childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -367,9 +383,10 @@
     TransformationMatrix parentTransform;
     parentTransform.rotate(1);
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(parentTransform, rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -384,9 +401,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -401,9 +419,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -418,9 +437,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -435,9 +455,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100));
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
@@ -452,9 +473,10 @@
 {
     DECLARE_AND_INITIALIZE_TEST_QUADS
 
-    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(TransformationMatrix(), rootRect, 1.0, true, IntRect());
-    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(TransformationMatrix(), childRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> rootLayer = makeLayer(0, TransformationMatrix(), rootRect, 1.0, true, IntRect());
+    OwnPtr<CCTiledLayerImpl> childLayer = makeLayer(rootLayer.get(), TransformationMatrix(), childRect, 1.0, true, IntRect());
     TestCCOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false);
+    occlusionTracker.enterTargetRenderSurface(rootLayer->renderSurface());
 
     appendQuads(quadList, sharedStateList, childLayer.get(), occlusionTracker);
     occlusionTracker.markOccludedBehindLayer(childLayer.get());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to