Title: [111982] trunk/Source
Revision
111982
Author
shawnsi...@chromium.org
Date
2012-03-23 23:51:34 -0700 (Fri, 23 Mar 2012)

Log Message

[chromium] Incorrect replica originTransform used in CCDamageTracker
https://bugs.webkit.org/show_bug.cgi?id=82118

Reviewed by Adrienne Walker.

Source/WebCore:

Unit test added to CCDamageTrackerTest.cpp

* platform/graphics/chromium/cc/CCDamageTracker.cpp:
(WebCore::CCDamageTracker::extendDamageForRenderSurface):

Source/WebKit/chromium:

* tests/CCDamageTrackerTest.cpp:
(WebKitTests::TEST_F):
(WebKitTests):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111981 => 111982)


--- trunk/Source/WebCore/ChangeLog	2012-03-24 06:44:52 UTC (rev 111981)
+++ trunk/Source/WebCore/ChangeLog	2012-03-24 06:51:34 UTC (rev 111982)
@@ -1,3 +1,15 @@
+2012-03-23  Shawn Singh  <shawnsi...@chromium.org>
+
+        [chromium] Incorrect replica originTransform used in CCDamageTracker
+        https://bugs.webkit.org/show_bug.cgi?id=82118
+
+        Reviewed by Adrienne Walker.
+
+        Unit test added to CCDamageTrackerTest.cpp
+
+        * platform/graphics/chromium/cc/CCDamageTracker.cpp:
+        (WebCore::CCDamageTracker::extendDamageForRenderSurface):
+
 2012-03-23  Dana Jansens  <dan...@chromium.org>
 
         [chromium] When prepainting fails, tiles dirty rects may be cleared

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp (111981 => 111982)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp	2012-03-24 06:44:52 UTC (rev 111981)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp	2012-03-24 06:51:34 UTC (rev 111982)
@@ -297,11 +297,7 @@
         removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew);
 
         // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space.
-        TransformationMatrix replicaOriginTransform = layer->renderSurface()->originTransform();
-        replicaOriginTransform.translate(layer->replicaLayer()->position().x(), layer->replicaLayer()->position().y());
-        replicaOriginTransform.multiply(layer->replicaLayer()->transform());
-        replicaOriginTransform.translate(-layer->replicaLayer()->position().x(), -layer->replicaLayer()->position().y());
-
+        const TransformationMatrix& replicaOriginTransform = renderSurface->replicaOriginTransform();
         FloatRect replicaMaskLayerRect = replicaOriginTransform.mapRect(FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height())));
         saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect);
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (111981 => 111982)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-24 06:44:52 UTC (rev 111981)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-24 06:51:34 UTC (rev 111982)
@@ -1,3 +1,14 @@
+2012-03-23  Shawn Singh  <shawnsi...@chromium.org>
+
+        [chromium] Incorrect replica originTransform used in CCDamageTracker
+        https://bugs.webkit.org/show_bug.cgi?id=82118
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCDamageTrackerTest.cpp:
+        (WebKitTests::TEST_F):
+        (WebKitTests):
+
 2012-03-23  Dana Jansens  <dan...@chromium.org>
 
         [chromium] When prepainting fails, tiles dirty rects may be cleared

Modified: trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp (111981 => 111982)


--- trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp	2012-03-24 06:44:52 UTC (rev 111981)
+++ trunk/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp	2012-03-24 06:51:34 UTC (rev 111982)
@@ -797,6 +797,56 @@
     EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
 }
 
+TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
+{
+    OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
+    CCLayerImpl* child1 = root->children()[0].get();
+    CCLayerImpl* grandChild1 = child1->children()[0].get();
+
+    // Verify that the correct replicaOriginTransform is used for the replicaMask; the
+    // incorrect old code did not actually correctly account for the anchor for the
+    // replica.
+    //
+    // Create a reflection about the left edge, but the anchor point is shifted all the
+    // way to the right. this case the reflection should be directly on top (but
+    // horizontally flipped) of grandChild1.
+
+    grandChild1->setAnchorPoint(FloatPoint(1.0, 0.0)); // This is the anchor being tested.
+
+    {
+        OwnPtr<CCLayerImpl> grandChild1Replica = CCLayerImpl::create(6);
+        grandChild1Replica->setPosition(FloatPoint::zero());
+        grandChild1Replica->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
+        TransformationMatrix reflection;
+        reflection.scale3d(-1.0, 1.0, 1.0);
+        grandChild1Replica->setTransform(reflection);
+        grandChild1->setReplicaLayer(grandChild1Replica.release());
+    }
+    CCLayerImpl* grandChild1Replica = grandChild1->replicaLayer();
+
+    // Set up the mask layer on the replica layer
+    {
+        OwnPtr<CCLayerImpl> replicaMaskLayer = CCLayerImpl::create(7);
+        replicaMaskLayer->setPosition(FloatPoint::zero());
+        replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
+        replicaMaskLayer->setBounds(grandChild1->bounds());
+        grandChild1Replica->setMaskLayer(replicaMaskLayer.release());
+    }
+    CCLayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer();
+
+    emulateDrawingOneFrame(root.get());
+
+    // Sanity check that the appropriate render surfaces were created
+    ASSERT_TRUE(grandChild1->renderSurface());
+
+    // A property change on the replicaMask should damage the reflected region on the target surface.
+    replicaMaskLayer->setOpacity(0.6);
+    emulateDrawingOneFrame(root.get());
+
+    FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+    EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
+}
+
 TEST_F(CCDamageTrackerTest, verifyDamageWhenForcedFullDamage)
 {
     OwnPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to