Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3258)

Unified Diff: cc/layer_unittest.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layer_unittest.cc
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index 8ce7bbf69148b355c9fd33bf17bd6a742d75f7ab..4bbefbd5ccdef05953eab579b85aacdc0c7b328d 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -422,12 +422,12 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior)
scoped_refptr<Layer> testLayer = Layer::create();
testLayer->setLayerTreeHost(m_layerTreeHost.get());
- 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());
@@ -478,25 +478,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));
@@ -514,7 +514,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());
}
@@ -525,20 +525,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 LayerWithContentScaling : public Layer {
@@ -553,7 +553,7 @@ public:
return true;
}
- virtual void setNeedsDisplayRect(const FloatRect& dirtyRect) OVERRIDE
+ virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect) OVERRIDE
{
m_lastNeedsDisplayRect = dirtyRect;
Layer::setNeedsDisplayRect(dirtyRect);
@@ -564,14 +564,14 @@ public:
m_needsDisplay = false;
}
- const FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
+ const gfx::RectF& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
private:
virtual ~LayerWithContentScaling()
{
}
- FloatRect m_lastNeedsDisplayRect;
+ gfx::RectF m_lastNeedsDisplayRect;
};
TEST_F(LayerTest, checkContentsScaleChangeTriggersNeedsDisplay)
@@ -579,7 +579,7 @@ TEST_F(LayerTest, checkContentsScaleChangeTriggersNeedsDisplay)
scoped_refptr<LayerWithContentScaling> testLayer = make_scoped_refptr(new LayerWithContentScaling());
testLayer->setLayerTreeHost(m_layerTreeHost.get());
- IntSize testBounds = IntSize(320, 240);
+ gfx::Size testBounds = gfx::Size(320, 240);
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(testBounds));
testLayer->resetNeedsDisplay();
@@ -587,7 +587,7 @@ TEST_F(LayerTest, checkContentsScaleChangeTriggersNeedsDisplay)
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setContentsScale(testLayer->contentsScale() + 1.f));
EXPECT_TRUE(testLayer->needsDisplay());
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240), testLayer->lastNeedsDisplayRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 320, 240), testLayer->lastNeedsDisplayRect());
}
class FakeLayerImplTreeHost : public LayerTreeHost {
@@ -840,9 +840,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());
}
« cc/layer_tiling_data.cc ('K') | « cc/layer_tree_host_unittest.cc ('k') | cc/math_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698