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

Unified Diff: cc/layer_tree_host_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_tree_host_unittest.cc
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 27f231f3f462a458c0ceac6e75a6e561a6a4b00a..d87593013993a69249e60ace086161d820a08736 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -22,6 +22,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/gfx/size_conversions.h"
#include <public/Platform.h>
#include <public/WebLayerScrollClient.h>
#include <public/WebSize.h>
@@ -310,7 +311,7 @@ public:
m_numCommits++;
if (m_numCommits == 1) {
// Make the viewport empty so the host says it can't draw.
- m_layerTreeHost->setViewportSize(IntSize(0, 0), IntSize(0, 0));
+ m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0));
scoped_array<char> pixels(new char[4]);
m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
@@ -774,7 +775,7 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->rootLayer()->setDrawOpacity(1);
- m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
m_layerTreeHost->rootLayer()->setOpacity(0);
postAddAnimationToMainThread();
}
@@ -1028,7 +1029,7 @@ public:
virtual void beginTest() OVERRIDE
{
- m_layerTreeHost->setViewportSize(IntSize(20, 20), IntSize(20, 20));
+ m_layerTreeHost->setViewportSize(gfx::Size(20, 20), gfx::Size(20, 20));
m_layerTreeHost->setBackgroundColor(SK_ColorGRAY);
m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5);
@@ -1037,7 +1038,7 @@ public:
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize());
+ EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize());
EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor());
EXPECT_EQ(5, impl->pageScaleFactor());
@@ -1191,8 +1192,8 @@ private:
: ContentLayer(client)
, m_paintContentsCount(0)
{
- setAnchorPoint(FloatPoint(0, 0));
- setBounds(IntSize(10, 10));
+ setAnchorPoint(gfx::PointF(0, 0));
+ setBounds(gfx::Size(10, 10));
setIsDrawable(true);
}
virtual ~ContentLayerWithUpdateTracking()
@@ -1282,12 +1283,12 @@ public:
m_rootLayer->addChild(m_childLayer);
m_rootLayer->setIsDrawable(true);
- m_rootLayer->setBounds(IntSize(30, 30));
+ m_rootLayer->setBounds(gfx::Size(30, 30));
m_rootLayer->setAnchorPoint(FloatPoint(0, 0));
m_childLayer->setIsDrawable(true);
- m_childLayer->setPosition(IntPoint(2, 2));
- m_childLayer->setBounds(IntSize(10, 10));
+ m_childLayer->setPosition(gfx::Point(2, 2));
+ m_childLayer->setBounds(gfx::Size(10, 10));
m_childLayer->setAnchorPoint(FloatPoint(0, 0));
m_layerTreeHost->setRootLayer(m_rootLayer);
@@ -1314,8 +1315,8 @@ public:
LayerImpl* child = impl->rootLayer()->children()[0];
// Positions remain in layout pixels.
- EXPECT_EQ(IntPoint(0, 0), root->position());
- EXPECT_EQ(IntPoint(2, 2), child->position());
+ EXPECT_EQ(gfx::Point(0, 0), root->position());
+ EXPECT_EQ(gfx::Point(2, 2), child->position());
// Compute all the layer transforms for the frame.
MockLayerTreeHostImpl::LayerList renderSurfaceLayerList;
@@ -1330,8 +1331,8 @@ public:
EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect());
// The content bounds of the child should be scaled.
- IntSize childBoundsScaled = child->bounds();
- childBoundsScaled.scale(1.5);
+ gfx::Size childBoundsScaled = child->bounds();
+ childBoundsScaled = gfx::ToRoundedSize(childBoundsScaled.Scale(1.5));
EXPECT_EQ(childBoundsScaled, child->contentBounds());
WebTransformationMatrix scaleTransform;
@@ -3080,9 +3081,9 @@ public:
m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
m_contentLayer = ContentLayer::create(&m_mockDelegate);
- m_contentLayer->setBounds(IntSize(10, 10));
- m_contentLayer->setPosition(FloatPoint(0, 0));
- m_contentLayer->setAnchorPoint(FloatPoint(0, 0));
+ m_contentLayer->setBounds(gfx::Size(10, 10));
+ m_contentLayer->setPosition(gfx::PointF(0, 0));
+ m_contentLayer->setAnchorPoint(gfx::PointF(0, 0));
m_contentLayer->setIsDrawable(true);
m_layerTreeHost->rootLayer()->addChild(m_contentLayer);

Powered by Google App Engine
This is Rietveld 408576698