summaryrefslogtreecommitdiffstats
path: root/cc/test/layer_test_common.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 18:15:58 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 18:15:58 +0000
commitaad0a007e1cd343892d7b13ce5ea8d90e8ef7f53 (patch)
tree24c9af166977bbf8f25aa5b129defb35f3f8ec05 /cc/test/layer_test_common.cc
parent33432d8c37e3b929c60097c1eb7a53b13f364fb5 (diff)
downloadchromium_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/test/layer_test_common.cc')
-rw-r--r--cc/test/layer_test_common.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc
index 72546dd..9e7dd33 100644
--- a/cc/test/layer_test_common.cc
+++ b/cc/test/layer_test_common.cc
@@ -6,48 +6,52 @@
#include "cc/test/layer_test_common.h"
+#include "Region.h"
#include "cc/draw_quad.h"
#include "cc/math_util.h"
+#include "cc/render_pass.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/point_conversions.h"
+#include "ui/gfx/rect_conversions.h"
+#include "ui/gfx/size_conversions.h"
namespace LayerTestCommon {
// Align with expected and actual output
const char* quadString = " Quad: ";
-bool floatRectCanBeSafelyRoundedToIntRect(const cc::FloatRect& r)
+bool canRectFBeSafelyRoundedToRect(const gfx::RectF& r)
{
// Ensure that range of float values is not beyond integer range.
- if (!r.isExpressibleAsIntRect())
+ if (!cc::FloatRect(r).isExpressibleAsIntRect())
return false;
// Ensure that the values are actually integers.
- if (floorf(r.x()) == r.x()
- && floorf(r.y()) == r.y()
- && floorf(r.width()) == r.width()
- && floorf(r.height()) == r.height())
+ if (gfx::ToFlooredPoint(r.origin()) == r.origin()
+ && gfx::ToFlooredSize(r.size()) == r.size())
return true;
return false;
}
void verifyQuadsExactlyCoverRect(const cc::QuadList& quads,
- const cc::IntRect& rect) {
- cc::Region remaining(rect);
+ const gfx::Rect& rect) {
+ cc::Region remaining = cc::IntRect(rect);
for (size_t i = 0; i < quads.size(); ++i) {
cc::DrawQuad* quad = quads[i];
- cc::FloatRect floatQuadRect = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, cc::FloatRect(quad->quadRect()));
+ gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, gfx::RectF(quad->quadRect()));
// Before testing for exact coverage in the integer world, assert that rounding
// will not round the rect incorrectly.
- ASSERT_TRUE(floatRectCanBeSafelyRoundedToIntRect(floatQuadRect));
+ ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF));
- cc::IntRect quadRect = enclosingIntRect(floatQuadRect);
+ gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF);
- EXPECT_TRUE(rect.contains(quadRect)) << quadString << i;
- EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i;
- remaining.subtract(cc::Region(quadRect));
+ EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i;
+ EXPECT_TRUE(remaining.contains(cc::IntRect(quadRect))) << quadString << i;
+ remaining.subtract(cc::IntRect(quadRect));
}
EXPECT_TRUE(remaining.isEmpty());