| Index: cc/damage_tracker_unittest.cc
|
| diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc
|
| index d7a8dabca00169aa495c03c142288e986750da3b..22280e469733b8763e0b6f3956b24c0b6bd94e52 100644
|
| --- a/cc/damage_tracker_unittest.cc
|
| +++ b/cc/damage_tracker_unittest.cc
|
| @@ -71,18 +71,18 @@ scoped_ptr<LayerImpl> createTestTreeWithOneSurface()
|
| scoped_ptr<LayerImpl> root = LayerImpl::create(1);
|
| scoped_ptr<LayerImpl> child = LayerImpl::create(2);
|
|
|
| - root->setPosition(FloatPoint::zero());
|
| - root->setAnchorPoint(FloatPoint::zero());
|
| - root->setBounds(IntSize(500, 500));
|
| - root->setContentBounds(IntSize(500, 500));
|
| + root->setPosition(gfx::PointF());
|
| + root->setAnchorPoint(gfx::PointF());
|
| + root->setBounds(gfx::Size(500, 500));
|
| + root->setContentBounds(gfx::Size(500, 500));
|
| root->setDrawsContent(true);
|
| root->createRenderSurface();
|
| - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
|
| + root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
|
|
|
| - child->setPosition(FloatPoint(100, 100));
|
| - child->setAnchorPoint(FloatPoint::zero());
|
| - child->setBounds(IntSize(30, 30));
|
| - child->setContentBounds(IntSize(30, 30));
|
| + child->setPosition(gfx::PointF(100, 100));
|
| + child->setAnchorPoint(gfx::PointF());
|
| + child->setBounds(gfx::Size(30, 30));
|
| + child->setContentBounds(gfx::Size(30, 30));
|
| child->setDrawsContent(true);
|
| root->addChild(child.Pass());
|
|
|
| @@ -101,37 +101,37 @@ scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces()
|
| scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
|
| scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5);
|
|
|
| - root->setPosition(FloatPoint::zero());
|
| - root->setAnchorPoint(FloatPoint::zero());
|
| - root->setBounds(IntSize(500, 500));
|
| - root->setContentBounds(IntSize(500, 500));
|
| + root->setPosition(gfx::PointF());
|
| + root->setAnchorPoint(gfx::PointF());
|
| + root->setBounds(gfx::Size(500, 500));
|
| + root->setContentBounds(gfx::Size(500, 500));
|
| root->setDrawsContent(true);
|
| root->createRenderSurface();
|
| - root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
|
| + root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
|
|
|
| - child1->setPosition(FloatPoint(100, 100));
|
| - child1->setAnchorPoint(FloatPoint::zero());
|
| - child1->setBounds(IntSize(30, 30));
|
| - child1->setContentBounds(IntSize(30, 30));
|
| + child1->setPosition(gfx::PointF(100, 100));
|
| + child1->setAnchorPoint(gfx::PointF());
|
| + child1->setBounds(gfx::Size(30, 30));
|
| + child1->setContentBounds(gfx::Size(30, 30));
|
| child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface.
|
| child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface.
|
|
|
| - child2->setPosition(FloatPoint(11, 11));
|
| - child2->setAnchorPoint(FloatPoint::zero());
|
| - child2->setBounds(IntSize(18, 18));
|
| - child2->setContentBounds(IntSize(18, 18));
|
| + child2->setPosition(gfx::PointF(11, 11));
|
| + child2->setAnchorPoint(gfx::PointF());
|
| + child2->setBounds(gfx::Size(18, 18));
|
| + child2->setContentBounds(gfx::Size(18, 18));
|
| child2->setDrawsContent(true);
|
|
|
| - grandChild1->setPosition(FloatPoint(200, 200));
|
| - grandChild1->setAnchorPoint(FloatPoint::zero());
|
| - grandChild1->setBounds(IntSize(6, 8));
|
| - grandChild1->setContentBounds(IntSize(6, 8));
|
| + grandChild1->setPosition(gfx::PointF(200, 200));
|
| + grandChild1->setAnchorPoint(gfx::PointF());
|
| + grandChild1->setBounds(gfx::Size(6, 8));
|
| + grandChild1->setContentBounds(gfx::Size(6, 8));
|
| grandChild1->setDrawsContent(true);
|
|
|
| - grandChild2->setPosition(FloatPoint(190, 190));
|
| - grandChild2->setAnchorPoint(FloatPoint::zero());
|
| - grandChild2->setBounds(IntSize(6, 8));
|
| - grandChild2->setContentBounds(IntSize(6, 8));
|
| + grandChild2->setPosition(gfx::PointF(190, 190));
|
| + grandChild2->setAnchorPoint(gfx::PointF());
|
| + grandChild2->setBounds(gfx::Size(6, 8));
|
| + grandChild2->setContentBounds(gfx::Size(6, 8));
|
| grandChild2->setDrawsContent(true);
|
|
|
| child1->addChild(grandChild1.Pass());
|
| @@ -181,8 +181,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface)
|
| EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id());
|
| EXPECT_EQ(2, root->renderSurface()->layerList()[1]->id());
|
|
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
| @@ -194,8 +194,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
|
|
| LayerImpl* child1 = root->children()[0];
|
| LayerImpl* child2 = root->children()[1];
|
| - FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| ASSERT_TRUE(child1->renderSurface());
|
| EXPECT_FALSE(child2->renderSurface());
|
| @@ -203,8 +203,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
|
| EXPECT_EQ(2u, child1->renderSurface()->layerList().size());
|
|
|
| // The render surface for child1 only has a contentRect that encloses grandChild1 and grandChild2, because child1 does not draw content.
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
|
| @@ -215,30 +215,30 @@ TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
|
| // CASE 1: Setting the update rect should cause the corresponding damage to the surface.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100).
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
|
|
|
| // CASE 2: The same update rect twice in a row still produces the same damage.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
|
|
|
| // CASE 3: Setting a different update rect should cause damage on the new update region, but no additional exposed old region.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(20, 25, 1, 2));
|
| + child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Damage position on the surface should be: position of updateRect (20, 25) relative to the child (100, 100).
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(120, 125, 1, 2), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(120, 125, 1, 2), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
| @@ -249,7 +249,7 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
| // CASE 1: The layer's property changed flag takes priority over update rect.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
| child->setOpacity(0.5);
|
| emulateDrawingOneFrame(root.get());
|
|
|
| @@ -258,8 +258,8 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
| ASSERT_EQ(2u, root->renderSurface()->layerList().size());
|
|
|
| // Damage should be the entire child layer in targetSurface space.
|
| - FloatRect expectedRect = FloatRect(100, 100, 30, 30);
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF expectedRect = gfx::RectF(100, 100, 30, 30);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
|
|
| // CASE 2: If a layer moves due to property change, it damages both the new location
|
| @@ -269,15 +269,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
|
| // Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
|
| clearDamageForAllSurfaces(root.get());
|
| emulateDrawingOneFrame(root.get());
|
| - EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
|
| + EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
|
|
|
| // Then, test the actual layer movement.
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setPosition(FloatPoint(200, 230));
|
| + child->setPosition(gfx::PointF(200, 230));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Expect damage to be the combination of the previous one and the new one.
|
| - expectedRect.uniteIfNonZero(FloatRect(200, 230, 30, 30));
|
| + expectedRect.Union(gfx::RectF(200, 230, 30, 30));
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
| }
|
| @@ -294,13 +294,13 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
|
| rotation.rotate(45);
|
|
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setAnchorPoint(FloatPoint(0.5, 0.5));
|
| - child->setPosition(FloatPoint(85, 85));
|
| + child->setAnchorPoint(gfx::PointF(0.5, 0.5));
|
| + child->setPosition(gfx::PointF(85, 85));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Sanity check that the layer actually moved to (85, 85), damaging its old location and new location.
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(85, 85, 45, 45), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(85, 85, 45, 45), rootDamageRect);
|
|
|
| // With the anchor on the layer's center, now we can test the rotation more
|
| // intuitively, since it applies about the layer's anchor.
|
| @@ -313,7 +313,7 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
|
| // old exposed region should be fully contained in the new region.
|
| double expectedWidth = 30 * sqrt(2.0);
|
| double expectedPosition = 100 - 0.5 * expectedWidth;
|
| - FloatRect expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
|
| + gfx::RectF expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
|
| }
|
| @@ -340,15 +340,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
|
| transform.translate3d(-50, -50, 0);
|
|
|
| // Set up the child
|
| - child->setPosition(FloatPoint(0, 0));
|
| - child->setBounds(IntSize(100, 100));
|
| - child->setContentBounds(IntSize(100, 100));
|
| + child->setPosition(gfx::PointF(0, 0));
|
| + child->setBounds(gfx::Size(100, 100));
|
| + child->setContentBounds(gfx::Size(100, 100));
|
| child->setTransform(transform);
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Sanity check that the child layer's bounds would actually get clipped by w < 0,
|
| // otherwise this test is not actually testing the intended scenario.
|
| - FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100)));
|
| + FloatQuad testQuad(gfx::RectF(gfx::PointF(), gfx::SizeF(100, 100)));
|
| bool clipped = false;
|
| MathUtil::mapQuad(transform, testQuad, clipped);
|
| EXPECT_TRUE(clipped);
|
| @@ -360,9 +360,9 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
|
|
|
| // The expected damage should cover the entire root surface (500x500), but we don't
|
| // care whether the damage rect was clamped or is larger than the surface for this test.
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
|
| - EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout));
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF damageWeCareAbout = gfx::RectF(gfx::PointF(), gfx::SizeF(500, 500));
|
| + EXPECT_TRUE(rootDamageRect.Contains(damageWeCareAbout));
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
|
| @@ -382,14 +382,13 @@ TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
|
|
|
| // Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect expectedDamageRect = FloatRect(110, 111, 12, 13);
|
| - expectedDamageRect.move(-outsetLeft, -outsetTop);
|
| - expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF expectedDamageRect = gfx::RectF(110, 111, 12, 13);
|
| + expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
| }
|
|
|
| @@ -397,7 +396,7 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
|
| {
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface();
|
| LayerImpl* child = root->children()[0];
|
| - FloatRect rootDamageRect, childDamageRect;
|
| + gfx::RectF rootDamageRect, childDamageRect;
|
|
|
| // Allow us to set damage on child too.
|
| child->setDrawsContent(true);
|
| @@ -410,18 +409,18 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
|
|
| // CASE 1: Setting the update rect should damage the whole surface (for now)
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(0, 0, 1, 1));
|
| + child->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
| @@ -447,15 +446,14 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
| // the surface, blurred based on the size of the child's background blur
|
| // filter.
|
| clearDamageForAllSurfaces(root.get());
|
| - root->setUpdateRect(FloatRect(297, 297, 2, 2));
|
| + root->setUpdateRect(gfx::RectF(297, 297, 2, 2));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage position on the surface should be a composition of the damage on the root and on child2.
|
| // Damage on the root should be: position of updateRect (297, 297), but expanded by the blur outsets.
|
| - FloatRect expectedDamageRect = FloatRect(297, 297, 2, 2);
|
| - expectedDamageRect.move(-outsetLeft, -outsetTop);
|
| - expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
| + gfx::RectF expectedDamageRect = gfx::RectF(297, 297, 2, 2);
|
| + expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
|
|
| // CASE 2: Setting the update rect should cause the corresponding damage to
|
| @@ -463,67 +461,64 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
|
| // filter. Since the damage extends to the right/bottom outside of the
|
| // blurred layer, only the left/top should end up expanded.
|
| clearDamageForAllSurfaces(root.get());
|
| - root->setUpdateRect(FloatRect(297, 297, 30, 30));
|
| + root->setUpdateRect(gfx::RectF(297, 297, 30, 30));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage position on the surface should be a composition of the damage on the root and on child2.
|
| // Damage on the root should be: position of updateRect (297, 297), but expanded on the left/top
|
| // by the blur outsets.
|
| - expectedDamageRect = FloatRect(297, 297, 30, 30);
|
| - expectedDamageRect.move(-outsetLeft, -outsetTop);
|
| - expectedDamageRect.expand(outsetLeft, outsetTop);
|
| + expectedDamageRect = gfx::RectF(297, 297, 30, 30);
|
| + expectedDamageRect.Inset(-outsetLeft, -outsetTop, 0, 0);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
|
|
| // CASE 3: Setting this update rect outside the blurred contentBounds of the blurred
|
| // child1 will not cause it to be expanded.
|
| clearDamageForAllSurfaces(root.get());
|
| - root->setUpdateRect(FloatRect(30, 30, 2, 2));
|
| + root->setUpdateRect(gfx::RectF(30, 30, 2, 2));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage on the root should be: position of updateRect (30, 30), not
|
| // expanded.
|
| - expectedDamageRect = FloatRect(30, 30, 2, 2);
|
| + expectedDamageRect = gfx::RectF(30, 30, 2, 2);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
|
|
| // CASE 4: Setting this update rect inside the blurred contentBounds but outside the
|
| // original contentBounds of the blurred child1 will cause it to be expanded.
|
| clearDamageForAllSurfaces(root.get());
|
| - root->setUpdateRect(FloatRect(99, 99, 1, 1));
|
| + root->setUpdateRect(gfx::RectF(99, 99, 1, 1));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage on the root should be: position of updateRect (99, 99), expanded
|
| // by the blurring on child1, but since it is 1 pixel outside the layer, the
|
| // expanding should be reduced by 1.
|
| - expectedDamageRect = FloatRect(99, 99, 1, 1);
|
| - expectedDamageRect.move(-outsetLeft + 1, -outsetTop + 1);
|
| - expectedDamageRect.expand(outsetLeft + outsetRight - 1, outsetTop + outsetBottom - 1);
|
| + expectedDamageRect = gfx::RectF(99, 99, 1, 1);
|
| + expectedDamageRect.Inset(-outsetLeft + 1, -outsetTop + 1, -outsetRight, -outsetBottom);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
|
|
| // CASE 5: Setting the update rect on child2, which is above child1, will
|
| // not get blurred by child1, so it does not need to get expanded.
|
| clearDamageForAllSurfaces(root.get());
|
| - child2->setUpdateRect(FloatRect(0, 0, 1, 1));
|
| + child2->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage on child2 should be: position of updateRect offset by the child's position (11, 11), and not expanded by anything.
|
| - expectedDamageRect = FloatRect(11, 11, 1, 1);
|
| + expectedDamageRect = gfx::RectF(11, 11, 1, 1);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
|
|
| // CASE 6: Setting the update rect on child1 will also blur the damage, so
|
| // that any pixels needed for the blur are redrawn in the current frame.
|
| clearDamageForAllSurfaces(root.get());
|
| - child1->setUpdateRect(FloatRect(0, 0, 1, 1));
|
| + child1->setUpdateRect(gfx::RectF(0, 0, 1, 1));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| // Damage on child1 should be: position of updateRect offset by the child's position (100, 100), and expanded by the damage.
|
| - expectedDamageRect = FloatRect(100, 100, 1, 1);
|
| - expectedDamageRect.move(-outsetLeft, -outsetTop);
|
| - expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
|
| + expectedDamageRect = gfx::RectF(100, 100, 1, 1);
|
| + expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
|
| EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
|
| }
|
|
|
| @@ -537,10 +532,10 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
| clearDamageForAllSurfaces(root.get());
|
| {
|
| scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
| - child2->setPosition(FloatPoint(400, 380));
|
| - child2->setAnchorPoint(FloatPoint::zero());
|
| - child2->setBounds(IntSize(6, 8));
|
| - child2->setContentBounds(IntSize(6, 8));
|
| + child2->setPosition(gfx::PointF(400, 380));
|
| + child2->setAnchorPoint(gfx::PointF());
|
| + child2->setBounds(gfx::Size(6, 8));
|
| + child2->setContentBounds(gfx::Size(6, 8));
|
| child2->setDrawsContent(true);
|
| root->addChild(child2.Pass());
|
| }
|
| @@ -549,8 +544,8 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
| // Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
|
| ASSERT_EQ(3u, root->renderSurface()->layerList().size());
|
|
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
|
|
|
| // CASE 2: If the layer is removed, its entire old layer becomes exposed, not just the
|
| // last update rect.
|
| @@ -558,13 +553,13 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
|
| // Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
|
| clearDamageForAllSurfaces(root.get());
|
| emulateDrawingOneFrame(root.get());
|
| - EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
|
| + EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
|
|
|
| // Then, test removing child1.
|
| child1->removeFromParent();
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
| @@ -577,16 +572,16 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
| clearDamageForAllSurfaces(root.get());
|
| {
|
| scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
| - child2->setPosition(FloatPoint(400, 380));
|
| - child2->setAnchorPoint(FloatPoint::zero());
|
| - child2->setBounds(IntSize(6, 8));
|
| - child2->setContentBounds(IntSize(6, 8));
|
| + child2->setPosition(gfx::PointF(400, 380));
|
| + child2->setAnchorPoint(gfx::PointF());
|
| + child2->setBounds(gfx::Size(6, 8));
|
| + child2->setContentBounds(gfx::Size(6, 8));
|
| child2->setDrawsContent(true);
|
| child2->resetAllChangeTrackingForSubtree();
|
| // Sanity check the initial conditions of the test, if these asserts trigger, it
|
| // means the test no longer actually covers the intended scenario.
|
| ASSERT_FALSE(child2->layerPropertyChanged());
|
| - ASSERT_TRUE(child2->updateRect().isEmpty());
|
| + ASSERT_TRUE(child2->updateRect().IsEmpty());
|
| root->addChild(child2.Pass());
|
| }
|
| emulateDrawingOneFrame(root.get());
|
| @@ -594,8 +589,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
|
| // Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
|
| ASSERT_EQ(3u, root->renderSurface()->layerList().size());
|
|
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
| @@ -607,10 +602,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
| clearDamageForAllSurfaces(root.get());
|
| {
|
| scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
|
| - child2->setPosition(FloatPoint(400, 380));
|
| - child2->setAnchorPoint(FloatPoint::zero());
|
| - child2->setBounds(IntSize(6, 8));
|
| - child2->setContentBounds(IntSize(6, 8));
|
| + child2->setPosition(gfx::PointF(400, 380));
|
| + child2->setAnchorPoint(gfx::PointF());
|
| + child2->setBounds(gfx::Size(6, 8));
|
| + child2->setContentBounds(gfx::Size(6, 8));
|
| child2->setDrawsContent(true);
|
| root->addChild(child2.Pass());
|
| }
|
| @@ -618,14 +613,14 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Damaging two layers simultaneously should cause combined damage.
|
| - // - child1 update rect in surface space: FloatRect(100, 100, 1, 2);
|
| - // - child2 update rect in surface space: FloatRect(400, 380, 3, 4);
|
| + // - child1 update rect in surface space: gfx::RectF(100, 100, 1, 2);
|
| + // - child2 update rect in surface space: gfx::RectF(400, 380, 3, 4);
|
| clearDamageForAllSurfaces(root.get());
|
| - child1->setUpdateRect(FloatRect(0, 0, 1, 2));
|
| - child2->setUpdateRect(FloatRect(0, 0, 3, 4));
|
| + child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
|
| + child2->setUpdateRect(gfx::RectF(0, 0, 3, 4));
|
| emulateDrawingOneFrame(root.get());
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 303, 284), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 303, 284), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
| @@ -634,8 +629,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
| LayerImpl* child1 = root->children()[0];
|
| LayerImpl* child2 = root->children()[1];
|
| LayerImpl* grandChild1 = root->children()[0]->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| // CASE 1: Damage to a descendant surface should propagate properly to ancestor surface.
|
| //
|
| @@ -644,20 +639,20 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(300, 300, 6, 8), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(300, 300, 6, 8), rootDamageRect);
|
|
|
| // CASE 2: Same as previous case, but with additional damage elsewhere that should be properly unioned.
|
| - // - child1 surface damage in root surface space: FloatRect(300, 300, 6, 8);
|
| - // - child2 damage in root surface space: FloatRect(11, 11, 18, 18);
|
| + // - child1 surface damage in root surface space: gfx::RectF(300, 300, 6, 8);
|
| + // - child2 damage in root surface space: gfx::RectF(11, 11, 18, 18);
|
| clearDamageForAllSurfaces(root.get());
|
| grandChild1->setOpacity(0.7f);
|
| child2->setOpacity(0.7f);
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(11, 11, 295, 297), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(11, 11, 295, 297), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
|
| @@ -672,21 +667,21 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
| LayerImpl* child1 = root->children()[0];
|
| LayerImpl* grandChild1 = root->children()[0]->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| clearDamageForAllSurfaces(root.get());
|
| - grandChild1->setPosition(FloatPoint(195, 205));
|
| + grandChild1->setPosition(gfx::PointF(195, 205));
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| // The new surface bounds should be damaged entirely, even though only one of the layers changed.
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 11, 23), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 11, 23), childDamageRect);
|
|
|
| // Damage to the root surface should be the union of child1's *entire* render surface
|
| // (in target space), and its old exposed area (also in target space).
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 23), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 23), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
|
| @@ -704,30 +699,30 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
|
|
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
| LayerImpl* child1 = root->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| clearDamageForAllSurfaces(root.get());
|
| - child1->setPosition(FloatPoint(50, 50));
|
| + child1->setPosition(gfx::PointF(50, 50));
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| // The new surface bounds should be damaged entirely.
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
|
|
| // The entire child1 surface and the old exposed child1 surface should damage the root surface.
|
| - // - old child1 surface in target space: FloatRect(290, 290, 16, 18)
|
| - // - new child1 surface in target space: FloatRect(240, 240, 16, 18)
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(240, 240, 66, 68), rootDamageRect);
|
| + // - old child1 surface in target space: gfx::RectF(290, 290, 16, 18)
|
| + // - new child1 surface in target space: gfx::RectF(240, 240, 16, 18)
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(240, 240, 66, 68), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
| {
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
| LayerImpl* child1 = root->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| // CASE 1: If a descendant surface disappears, its entire old area becomes exposed.
|
| //
|
| @@ -740,7 +735,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
| ASSERT_EQ(4u, root->renderSurface()->layerList().size());
|
|
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
|
|
|
| // CASE 2: If a descendant surface appears, its entire old area becomes exposed.
|
|
|
| @@ -748,7 +743,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
| clearDamageForAllSurfaces(root.get());
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
|
|
| // Then change the tree so that the render surface is added back.
|
| clearDamageForAllSurfaces(root.get());
|
| @@ -762,16 +757,16 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
|
|
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
| {
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
| LayerImpl* child1 = root->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| // CASE 1: If nothing changes, the damage rect should be empty.
|
| //
|
| @@ -779,8 +774,8 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(childDamageRect.isEmpty());
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(childDamageRect.IsEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
|
|
| // CASE 2: If nothing changes twice in a row, the damage rect should still be empty.
|
| //
|
| @@ -788,26 +783,26 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(childDamageRect.isEmpty());
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(childDamageRect.IsEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
|
| {
|
| scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
|
| LayerImpl* child1 = root->children()[0];
|
| - FloatRect childDamageRect;
|
| - FloatRect rootDamageRect;
|
| + gfx::RectF childDamageRect;
|
| + gfx::RectF rootDamageRect;
|
|
|
| // In our specific tree, the update rect of child1 should not cause any damage to any
|
| // surface because it does not actually draw content.
|
| clearDamageForAllSurfaces(root.get());
|
| - child1->setUpdateRect(FloatRect(0, 0, 1, 2));
|
| + child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(childDamageRect.isEmpty());
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(childDamageRect.IsEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| @@ -823,13 +818,13 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| // For this test case, we modify grandChild2, and add grandChild3 to extend the bounds
|
| // of child1's surface. This way, we can test reflection changes without changing
|
| // contentBounds of the surface.
|
| - grandChild2->setPosition(FloatPoint(180, 180));
|
| + grandChild2->setPosition(gfx::PointF(180, 180));
|
| {
|
| scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6);
|
| - grandChild3->setPosition(FloatPoint(240, 240));
|
| - grandChild3->setAnchorPoint(FloatPoint::zero());
|
| - grandChild3->setBounds(IntSize(10, 10));
|
| - grandChild3->setContentBounds(IntSize(10, 10));
|
| + grandChild3->setPosition(gfx::PointF(240, 240));
|
| + grandChild3->setAnchorPoint(gfx::PointF());
|
| + grandChild3->setBounds(gfx::Size(10, 10));
|
| + grandChild3->setContentBounds(gfx::Size(10, 10));
|
| grandChild3->setDrawsContent(true);
|
| child1->addChild(grandChild3.Pass());
|
| }
|
| @@ -841,8 +836,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| clearDamageForAllSurfaces(root.get());
|
| {
|
| scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(7);
|
| - grandChild1Replica->setPosition(FloatPoint::zero());
|
| - grandChild1Replica->setAnchorPoint(FloatPoint::zero());
|
| + grandChild1Replica->setPosition(gfx::PointF());
|
| + grandChild1Replica->setAnchorPoint(gfx::PointF());
|
| WebTransformationMatrix reflection;
|
| reflection.scale3d(-1, 1, 1);
|
| grandChild1Replica->setTransform(reflection);
|
| @@ -850,21 +845,21 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| }
|
| emulateDrawingOneFrame(root.get());
|
|
|
| - FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| // The grandChild surface damage should not include its own replica. The child
|
| // surface damage should include the normal and replica surfaces.
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 12, 8), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(294, 300, 12, 8), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 12, 8), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(294, 300, 12, 8), rootDamageRect);
|
|
|
| // CASE 2: moving the descendant surface should cause both the original and reflected
|
| // areas to be damaged on the target.
|
| clearDamageForAllSurfaces(root.get());
|
| - IntRect oldContentRect = child1->renderSurface()->contentRect();
|
| - grandChild1->setPosition(FloatPoint(195, 205));
|
| + gfx::Rect oldContentRect = child1->renderSurface()->contentRect();
|
| + grandChild1->setPosition(gfx::PointF(195, 205));
|
| emulateDrawingOneFrame(root.get());
|
| ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width());
|
| ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height());
|
| @@ -874,11 +869,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| // The child surface damage should include normal and replica surfaces for both old and new locations.
|
| - // - old location in target space: FloatRect(194, 200, 12, 8)
|
| - // - new location in target space: FloatRect(189, 205, 12, 8)
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(189, 200, 17, 13), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(289, 300, 17, 13), rootDamageRect);
|
| + // - old location in target space: gfx::RectF(194, 200, 12, 8)
|
| + // - new location in target space: gfx::RectF(189, 205, 12, 8)
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 200, 17, 13), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 300, 17, 13), rootDamageRect);
|
|
|
| // CASE 3: removing the reflection should cause the entire region including reflection
|
| // to damage the target surface.
|
| @@ -892,8 +887,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(189, 205, 12, 8), childDamageRect);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(289, 305, 12, 8), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 205, 12, 8), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 305, 12, 8), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| @@ -910,7 +905,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| {
|
| scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3);
|
| maskLayer->setPosition(child->position());
|
| - maskLayer->setAnchorPoint(FloatPoint::zero());
|
| + maskLayer->setAnchorPoint(gfx::PointF());
|
| maskLayer->setBounds(child->bounds());
|
| maskLayer->setContentBounds(child->bounds());
|
| child->setMaskLayer(maskLayer.Pass());
|
| @@ -921,10 +916,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| child->setOpacity(0.5);
|
| {
|
| scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4);
|
| - grandChild->setPosition(FloatPoint(2, 2));
|
| - grandChild->setAnchorPoint(FloatPoint::zero());
|
| - grandChild->setBounds(IntSize(2, 2));
|
| - grandChild->setContentBounds(IntSize(2, 2));
|
| + grandChild->setPosition(gfx::PointF(2, 2));
|
| + grandChild->setAnchorPoint(gfx::PointF());
|
| + grandChild->setBounds(gfx::Size(2, 2));
|
| + grandChild->setContentBounds(gfx::Size(2, 2));
|
| grandChild->setDrawsContent(true);
|
| child->addChild(grandChild.Pass());
|
| }
|
| @@ -936,10 +931,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| // CASE 1: the updateRect on a mask layer should damage the entire target surface.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - maskLayer->setUpdateRect(FloatRect(1, 2, 3, 4));
|
| + maskLayer->setUpdateRect(gfx::RectF(1, 2, 3, 4));
|
| emulateDrawingOneFrame(root.get());
|
| - FloatRect childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
| + gfx::RectF childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
|
|
| // CASE 2: a property change on the mask layer should damage the entire target surface.
|
| //
|
| @@ -948,7 +943,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| clearDamageForAllSurfaces(root.get());
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(childDamageRect.isEmpty());
|
| + EXPECT_TRUE(childDamageRect.IsEmpty());
|
|
|
| // Then test the property change.
|
| clearDamageForAllSurfaces(root.get());
|
| @@ -956,7 +951,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
|
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
|
|
| // CASE 3: removing the mask also damages the entire target surface.
|
| //
|
| @@ -965,7 +960,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| clearDamageForAllSurfaces(root.get());
|
| emulateDrawingOneFrame(root.get());
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(childDamageRect.isEmpty());
|
| + EXPECT_TRUE(childDamageRect.IsEmpty());
|
|
|
| // Then test mask removal.
|
| clearDamageForAllSurfaces(root.get());
|
| @@ -977,7 +972,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
|
| ASSERT_TRUE(child->renderSurface());
|
|
|
| childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
| @@ -994,8 +989,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
| // Create a reflection about the left edge of grandChild1.
|
| {
|
| scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
|
| - grandChild1Replica->setPosition(FloatPoint::zero());
|
| - grandChild1Replica->setAnchorPoint(FloatPoint::zero());
|
| + grandChild1Replica->setPosition(gfx::PointF());
|
| + grandChild1Replica->setAnchorPoint(gfx::PointF());
|
| WebTransformationMatrix reflection;
|
| reflection.scale3d(-1, 1, 1);
|
| grandChild1Replica->setTransform(reflection);
|
| @@ -1006,8 +1001,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
| // Set up the mask layer on the replica layer
|
| {
|
| scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
|
| - replicaMaskLayer->setPosition(FloatPoint::zero());
|
| - replicaMaskLayer->setAnchorPoint(FloatPoint::zero());
|
| + replicaMaskLayer->setPosition(gfx::PointF());
|
| + replicaMaskLayer->setAnchorPoint(gfx::PointF());
|
| replicaMaskLayer->setBounds(grandChild1->bounds());
|
| replicaMaskLayer->setContentBounds(grandChild1->bounds());
|
| grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
|
| @@ -1024,11 +1019,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
| replicaMaskLayer->setStackingOrderChanged(true);
|
| emulateDrawingOneFrame(root.get());
|
|
|
| - FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
| - FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
| + gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| - EXPECT_TRUE(grandChildDamageRect.isEmpty());
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
|
| + EXPECT_TRUE(grandChildDamageRect.IsEmpty());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
|
|
|
| // CASE 2: removing the replica mask damages only the reflected region on the target surface.
|
| //
|
| @@ -1039,8 +1034,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
|
| grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
|
| childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
|
|
| - EXPECT_TRUE(grandChildDamageRect.isEmpty());
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
|
| + EXPECT_TRUE(grandChildDamageRect.IsEmpty());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
| @@ -1052,12 +1047,12 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
| // Verify that the correct replicaOriginTransform is used for the replicaMask;
|
| clearDamageForAllSurfaces(root.get());
|
|
|
| - grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
|
| + grandChild1->setAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
|
|
|
| {
|
| scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
|
| - grandChild1Replica->setPosition(FloatPoint::zero());
|
| - grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested.
|
| + grandChild1Replica->setPosition(gfx::PointF());
|
| + grandChild1Replica->setAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
|
| WebTransformationMatrix reflection;
|
| reflection.scale3d(-1, 1, 1);
|
| grandChild1Replica->setTransform(reflection);
|
| @@ -1068,8 +1063,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
| // Set up the mask layer on the replica layer
|
| {
|
| scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
|
| - replicaMaskLayer->setPosition(FloatPoint::zero());
|
| - replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
|
| + replicaMaskLayer->setPosition(gfx::PointF());
|
| + replicaMaskLayer->setAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
|
| replicaMaskLayer->setBounds(grandChild1->bounds());
|
| replicaMaskLayer->setContentBounds(grandChild1->bounds());
|
| grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
|
| @@ -1087,8 +1082,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
|
|
|
| emulateDrawingOneFrame(root.get());
|
|
|
| - FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect);
|
| + gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(206, 200, 6, 8), childDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
| @@ -1100,11 +1095,11 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
| // it takes priority over any other partial damage.
|
| //
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 12, 13));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
|
| root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
|
| emulateDrawingOneFrame(root.get());
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
|
|
| // Case 2: An additional sanity check that forcing full damage works even when nothing
|
| // on the layer tree changed.
|
| @@ -1113,7 +1108,7 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
|
| root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
|
| @@ -1127,10 +1122,10 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
|
| ASSERT_TRUE(root == root->renderTarget());
|
| RenderSurfaceImpl* targetSurface = root->renderSurface();
|
| targetSurface->clearLayerLists();
|
| - targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, WebFilterOperations(), 0);
|
| + targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, gfx::Rect(), 0, WebFilterOperations(), 0);
|
|
|
| - FloatRect damageRect = targetSurface->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(damageRect.isEmpty());
|
| + gfx::RectF damageRect = targetSurface->damageTracker()->currentDamageRect();
|
| + EXPECT_TRUE(damageRect.IsEmpty());
|
| }
|
|
|
| TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
|
| @@ -1141,28 +1136,28 @@ TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
|
| LayerImpl* child = root->children()[0];
|
|
|
| clearDamageForAllSurfaces(root.get());
|
| - child->setUpdateRect(FloatRect(10, 11, 1, 2));
|
| + child->setUpdateRect(gfx::RectF(10, 11, 1, 2));
|
| emulateDrawingOneFrame(root.get());
|
|
|
| // Sanity check damage after the first frame; this isnt the actual test yet.
|
| - FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 1, 2), rootDamageRect);
|
| + gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 1, 2), rootDamageRect);
|
|
|
| // New damage, without having cleared the previous damage, should be unioned to the previous one.
|
| - child->setUpdateRect(FloatRect(20, 25, 1, 2));
|
| + child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 11, 16), rootDamageRect);
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 11, 16), rootDamageRect);
|
|
|
| // If we notify the damage tracker that we drew the damaged area, then damage should be emptied.
|
| root->renderSurface()->damageTracker()->didDrawDamagedArea();
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
|
|
| // Damage should remain empty even after one frame, since there's yet no new damage
|
| emulateDrawingOneFrame(root.get());
|
| rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
|
| - EXPECT_TRUE(rootDamageRect.isEmpty());
|
| + EXPECT_TRUE(rootDamageRect.IsEmpty());
|
| }
|
|
|
| } // namespace
|
|
|