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

Unified Diff: cc/quad_culler_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: Rebased to tip of tree and addressed feedback 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
Index: cc/quad_culler_unittest.cc
diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc
index 82de2bbb2f6c4f209d0b721c3869bc801ead66f3..ee0938923dded21344858b59de275531a7777cba 100644
--- a/cc/quad_culler_unittest.cc
+++ b/cc/quad_culler_unittest.cc
@@ -14,9 +14,9 @@
#include "cc/tiled_layer_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include <public/WebTransformationMatrix.h>
+#include "ui/gfx/transform.h"
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
namespace {
@@ -38,7 +38,7 @@ private:
typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
-static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
+static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const Transform& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
{
scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1);
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::NoBorderTexels);
@@ -89,7 +89,7 @@ static void appendQuads(QuadList& quadList, SharedQuadStateList& sharedStateList
QuadList quadList; \
SharedQuadStateList sharedStateList; \
std::vector<LayerImpl*> renderSurfaceLayerList; \
- WebTransformationMatrix childTransform; \
+ Transform childTransform; \
danakj 2012/11/24 02:34:54 move the \
gfx::Size rootSize = gfx::Size(300, 300); \
gfx::Rect rootRect = gfx::Rect(rootSize); \
gfx::Size childSize = gfx::Size(200, 200); \
@@ -99,8 +99,8 @@ TEST(QuadCullerTest, verifyNoCulling)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -116,8 +116,8 @@ TEST(QuadCullerTest, verifyCullChildLinesUpTopLeft)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -133,7 +133,7 @@ TEST(QuadCullerTest, verifyCullWhenChildOpacityNotOne)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -150,7 +150,7 @@ TEST(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -167,9 +167,9 @@ TEST(QuadCullerTest, verifyCullCenterTileOnly)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(50, 50);
+ childTransform.PreconcatTranslate(50, 50);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -202,13 +202,13 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(100, 100);
+ childTransform.PreconcatTranslate(100, 100);
// Make the root layer's quad have extent (99.1, 99.1) -> (200.9, 200.9) to make
// sure it doesn't get culled due to transform rounding.
- WebTransformationMatrix rootTransform;
- rootTransform.translate(99.1, 99.1);
- rootTransform.scale(1.018);
+ Transform rootTransform;
+ rootTransform.PreconcatTranslate(99.1, 99.1);
+ rootTransform.PreconcatScale(1.018, 1.018);
rootRect = childRect = gfx::Rect(0, 0, 100, 100);
@@ -232,11 +232,11 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2)
// Make the child's quad slightly smaller than, and centred over, the root layer tile.
// Verify the child does not cause the quad below to be culled due to rounding.
- childTransform.translate(100.1, 100.1);
- childTransform.scale(0.982);
+ childTransform.PreconcatTranslate(100.1, 100.1);
+ childTransform.PreconcatScale(0.982, 0.982);
- WebTransformationMatrix rootTransform;
- rootTransform.translate(100, 100);
+ Transform rootTransform;
+ rootTransform.PreconcatTranslate(100, 100);
rootRect = childRect = gfx::Rect(0, 0, 100, 100);
@@ -258,9 +258,9 @@ TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(100, 100);
+ childTransform.PreconcatTranslate(100, 100);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -277,9 +277,9 @@ TEST(QuadCullerTest, verifyCullSubRegion)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(50, 50);
+ childTransform.PreconcatTranslate(50, 50);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
@@ -297,9 +297,9 @@ TEST(QuadCullerTest, verifyCullSubRegion2)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(50, 10);
+ childTransform.PreconcatTranslate(50, 10);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
@@ -317,9 +317,9 @@ TEST(QuadCullerTest, verifyCullSubRegionCheckOvercull)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- childTransform.translate(50, 49);
+ childTransform.PreconcatTranslate(50, 49);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
@@ -338,9 +338,9 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
DECLARE_AND_INITIALIZE_TEST_QUADS
// Use a small rotation so as to not disturb the geometry significantly.
- childTransform.rotate(1);
+ childTransform.PreconcatRotate(1);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -363,11 +363,11 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled)
DECLARE_AND_INITIALIZE_TEST_QUADS
// Use a small rotation so as to not disturb the geometry significantly.
- WebTransformationMatrix parentTransform;
- parentTransform.rotate(1);
+ Transform parentTransform;
+ parentTransform.PreconcatRotate(1);
scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -383,8 +383,8 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(200, 100, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -400,8 +400,8 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverCulledTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(100, 100, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -417,8 +417,8 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -434,8 +434,8 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverNoTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(500, 500, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
@@ -451,8 +451,8 @@ TEST(QuadCullerTest, verifyWithoutMetrics)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, Transform(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), Transform(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200), false);
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);

Powered by Google App Engine
This is Rietveld 408576698