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

Unified Diff: cc/layer_tree_host_unittest.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years, 1 month 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
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_unittest.cc
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 5135441fd3730797d476ffb8d3b0a5e53d9256de..479138aafd1cc204db27e83ed44d49d7faf685bc 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -1339,20 +1339,20 @@ public:
gfx::Size childBoundsScaled = gfx::ToCeiledSize(gfx::ScaleSize(child->bounds(), 1.5));
EXPECT_EQ(childBoundsScaled, child->contentBounds());
- WebTransformationMatrix scaleTransform;
- scaleTransform.scale(impl->deviceScaleFactor());
+ gfx::Transform scaleTransform;
+ scaleTransform.Scale(impl->deviceScaleFactor(), impl->deviceScaleFactor());
// The root layer is scaled by 2x.
- WebTransformationMatrix rootScreenSpaceTransform = scaleTransform;
- WebTransformationMatrix rootDrawTransform = scaleTransform;
+ gfx::Transform rootScreenSpaceTransform = scaleTransform;
+ gfx::Transform rootDrawTransform = scaleTransform;
EXPECT_EQ(rootDrawTransform, root->drawTransform());
EXPECT_EQ(rootScreenSpaceTransform, root->screenSpaceTransform());
// The child is at position 2,2, which is transformed to 3,3 after the scale
- WebTransformationMatrix childScreenSpaceTransform;
- childScreenSpaceTransform.translate(3, 3);
- WebTransformationMatrix childDrawTransform = childScreenSpaceTransform;
+ gfx::Transform childScreenSpaceTransform;
+ childScreenSpaceTransform.Translate(3, 3);
+ gfx::Transform childDrawTransform = childScreenSpaceTransform;
EXPECT_EQ(childDrawTransform, child->drawTransform());
EXPECT_EQ(childScreenSpaceTransform, child->screenSpaceTransform());
@@ -1465,7 +1465,7 @@ TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread)
runTest(true);
}
-static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
+static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const gfx::Transform& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
{
layer->removeAllChildren();
if (parent)
@@ -1493,7 +1493,7 @@ public:
m_layerTreeHost->setRootLayer(m_parent);
m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
- WebTransformationMatrix identityMatrix;
+ gfx::Transform identityMatrix;
setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true);
setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 10), gfx::Size(10, 10), false);
@@ -1637,7 +1637,7 @@ private:
Region m_occludedScreenSpace;
};
-static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
+static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const gfx::Transform& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
{
setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque);
layer->clearOccludedScreenSpace();
@@ -1655,11 +1655,11 @@ public:
scoped_refptr<TestLayer> grandChild = TestLayer::create();
scoped_refptr<TestLayer> mask = TestLayer::create();
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
+ gfx::Transform identityMatrix;
+ gfx::Transform childTransform;
+ childTransform.Translate(250, 250);
+ childTransform.Rotate(90);
+ childTransform.Translate(-250, -250);
child->setMasksToBounds(true);
@@ -1828,11 +1828,11 @@ public:
scoped_refptr<TestLayer> grandChild = TestLayer::create();
scoped_refptr<TestLayer> mask = TestLayer::create();
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix childTransform;
- childTransform.translate(250, 250);
- childTransform.rotate(90);
- childTransform.translate(-250, -250);
+ gfx::Transform identityMatrix;
+ gfx::Transform childTransform;
+ childTransform.Translate(250, 250);
+ childTransform.Rotate(90);
+ childTransform.Translate(-250, -250);
child->setMasksToBounds(true);
@@ -1907,7 +1907,7 @@ public:
{
// We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion.
Region occluded;
- const WebTransformationMatrix identityMatrix;
+ const gfx::Transform identityMatrix;
std::vector<scoped_refptr<TestLayer> > layers;
std::vector<scoped_refptr<TestLayer> > children;
int numSurfaces = 20;
@@ -2708,7 +2708,7 @@ public:
m_layerTreeHost->setRootLayer(m_layer);
m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
- WebTransformationMatrix identityMatrix;
+ gfx::Transform identityMatrix;
setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true);
postSetNeedsCommitToMainThread();
@@ -2841,7 +2841,7 @@ public:
m_layerTreeHost->setRootLayer(m_layer);
m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
- WebTransformationMatrix identityMatrix;
+ gfx::Transform identityMatrix;
setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true);
postSetNeedsCommitToMainThread();
@@ -2966,7 +2966,7 @@ public:
m_layerTreeHost->setRootLayer(m_parent);
m_layerTreeHost->setViewportSize(gfx::Size(m_numChildren, 1), gfx::Size(m_numChildren, 1));
- WebTransformationMatrix identityMatrix;
+ gfx::Transform identityMatrix;
setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(m_numChildren, 1), true);
for (int i = 0; i < m_numChildren; i++)
setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(i, 0), gfx::Size(1, 1), false);
@@ -3122,15 +3122,15 @@ public:
virtual void beginTest() OVERRIDE
{
- WebTransformationMatrix m;
- m.translate(250, 360);
- m.scale(2);
+ gfx::Transform m;
+ m.Translate(250, 360);
+ m.Scale(2, 2);
gfx::Point point(400, 550);
gfx::Point transformedPoint;
// Unit transform, no change expected.
- m_layerTreeHost->setImplTransform(WebTransformationMatrix());
+ m_layerTreeHost->setImplTransform(gfx::Transform());
transformedPoint = gfx::ToRoundedPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
EXPECT_EQ(point.x(), transformedPoint.x());
EXPECT_EQ(point.y(), transformedPoint.y());
« no previous file with comments | « cc/layer_tree_host_impl_unittest.cc ('k') | cc/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698