diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:15:58 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 18:15:58 +0000 |
commit | aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53 (patch) | |
tree | 24c9af166977bbf8f25aa5b129defb35f3f8ec05 /cc/layer_unittest.cc | |
parent | 33432d8c37e3b929c60097c1eb7a53b13f364fb5 (diff) | |
download | chromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.zip chromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.tar.gz chromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.tar.bz2 |
cc: Use gfx:: Geometry types for positions, bounds, and related things.
This covers layers, layer tree hosts, and related classes. *phew*
I intentionally avoided anything to do with scrolling or page scale. Those
should be changed to be Vectors and need a bit more thought. This change
should be pretty mindless.
It converts to gfx Rect, Size, Vector, and Point classes. No change is
made for FloatPoint3D or FloatQuad yet.
I've added cc/geometry.h as a place for free functions that don't exist
on gfx types yet, and that we should port over in the future.
No change in behaviour; covered by existing tests.
BUG=147395
R=enne
Review URL: https://codereview.chromium.org/11264056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_unittest.cc')
-rw-r--r-- | cc/layer_unittest.cc | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc index a4a0725..f1a64e8 100644 --- a/cc/layer_unittest.cc +++ b/cc/layer_unittest.cc @@ -419,12 +419,12 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior) testLayer->setLayerTreeHost(m_layerTreeHost.get()); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setIsDrawable(true)); - IntSize testBounds = IntSize(501, 508); + gfx::Size testBounds = gfx::Size(501, 508); - FloatRect dirty1 = FloatRect(10, 15, 1, 2); - FloatRect dirty2 = FloatRect(20, 25, 3, 4); - FloatRect emptyDirtyRect = FloatRect(40, 45, 0, 0); - FloatRect outOfBoundsDirtyRect = FloatRect(400, 405, 500, 502); + gfx::RectF dirty1 = gfx::RectF(10, 15, 1, 2); + gfx::RectF dirty2 = gfx::RectF(20, 25, 3, 4); + gfx::RectF emptyDirtyRect = gfx::RectF(40, 45, 0, 0); + gfx::RectF outOfBoundsDirtyRect = gfx::RectF(400, 405, 500, 502); // Before anything, testLayer should not be dirty. EXPECT_FALSE(testLayer->needsDisplay()); @@ -486,25 +486,25 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should not call needsDisplay and needsCommit when changed. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(gfx::Rect(0, 0, 40, 50))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUseLCDText(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setRenderTarget(0)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix())); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(gfx::Rect(4, 5, 6, 7))); EXPECT_FALSE(testLayer->needsDisplay()); // Next, test properties that should call setNeedsCommit (but not setNeedsDisplay) // All properties need to be set to new values in order for setNeedsCommit to be called. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56f))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPointZ(0.7f)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(SK_ColorLTGRAY)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setContentsOpaque(true)); - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4, 9))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(gfx::PointF(4, 9))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get())); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true)); @@ -522,7 +522,7 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should call setNeedsDisplay and setNeedsCommit - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(IntSize(5, 10))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(gfx::Size(5, 10))); EXPECT_TRUE(testLayer->needsDisplay()); } @@ -533,20 +533,20 @@ TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect) scoped_refptr<Layer> testLayer = Layer::create(); scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1); - testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5))); + testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); - EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLayer->updateRect()); + EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer->updateRect()); // The LayerImpl's updateRect should be accumulated here, since we did not do anything to clear it. - testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5))); + testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); - EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(15, 15)), implLayer->updateRect()); + EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLayer->updateRect()); // If we do clear the LayerImpl side, then the next updateRect should be fresh without accumulation. implLayer->resetAllChangeTrackingForSubtree(); - testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5))); + testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5))); testLayer->pushPropertiesTo(implLayer.get()); - EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)), implLayer->updateRect()); + EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), implLayer->updateRect()); } class FakeLayerImplTreeHost : public LayerTreeHost { @@ -792,9 +792,9 @@ TEST(LayerTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmpt { scoped_refptr<MockLayer> layer(new MockLayer); EXPECT_FALSE(layer->needsDisplay()); - layer->setBounds(IntSize(0, 10)); + layer->setBounds(gfx::Size(0, 10)); EXPECT_FALSE(layer->needsDisplay()); - layer->setBounds(IntSize(10, 10)); + layer->setBounds(gfx::Size(10, 10)); EXPECT_TRUE(layer->needsDisplay()); } |