| Index: cc/layer_sorter_unittest.cc
|
| diff --git a/cc/layer_sorter_unittest.cc b/cc/layer_sorter_unittest.cc
|
| index 812bda50c7cce857a62bcf6cd32fd892e52c039e..9b13fce76e1d8805e4b6f611c49dfeb01c69faae 100644
|
| --- a/cc/layer_sorter_unittest.cc
|
| +++ b/cc/layer_sorter_unittest.cc
|
| @@ -8,9 +8,7 @@
|
| #include "cc/math_util.h"
|
| #include "cc/single_thread_proxy.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| -#include <public/WebTransformationMatrix.h>
|
| -
|
| -using WebKit::WebTransformationMatrix;
|
| +#include "ui/gfx/transform.h"
|
|
|
| namespace cc {
|
| namespace {
|
| @@ -26,12 +24,12 @@ TEST(LayerSorterTest, BasicOverlap)
|
| float weight = 0;
|
|
|
| // Trivial test, with one layer directly obscuring the other.
|
| - WebTransformationMatrix neg4Translate;
|
| - neg4Translate.translate3d(0, 0, -4);
|
| + gfx::Transform neg4Translate;
|
| + neg4Translate.Translate3d(0, 0, -4);
|
| LayerShape front(2, 2, neg4Translate);
|
|
|
| - WebTransformationMatrix neg5Translate;
|
| - neg5Translate.translate3d(0, 0, -5);
|
| + gfx::Transform neg5Translate;
|
| + neg5Translate.Translate3d(0, 0, -5);
|
| LayerShape back(2, 2, neg5Translate);
|
|
|
| overlapResult = LayerSorter::checkOverlap(&front, &back, zThreshold, weight);
|
| @@ -43,8 +41,8 @@ TEST(LayerSorterTest, BasicOverlap)
|
| EXPECT_EQ(1, weight);
|
|
|
| // One layer translated off to the right. No overlap should be detected.
|
| - WebTransformationMatrix rightTranslate;
|
| - rightTranslate.translate3d(10, 0, -5);
|
| + gfx::Transform rightTranslate;
|
| + rightTranslate.Translate3d(10, 0, -5);
|
| LayerShape backRight(2, 2, rightTranslate);
|
| overlapResult = LayerSorter::checkOverlap(&front, &backRight, zThreshold, weight);
|
| EXPECT_EQ(LayerSorter::None, overlapResult);
|
| @@ -60,18 +58,18 @@ TEST(LayerSorterTest, RightAngleOverlap)
|
| const float zThreshold = 0.1f;
|
| float weight = 0;
|
|
|
| - WebTransformationMatrix perspectiveMatrix;
|
| - perspectiveMatrix.applyPerspective(1000);
|
| + gfx::Transform perspectiveMatrix;
|
| + perspectiveMatrix.ApplyPerspectiveDepth(1000);
|
|
|
| // Two layers forming a right angle with a perspective viewing transform.
|
| - WebTransformationMatrix leftFaceMatrix;
|
| - leftFaceMatrix.translate3d(-1, 0, -5);
|
| - leftFaceMatrix.rotate3d(0, 1, 0, -90);
|
| - leftFaceMatrix.translate(-1, -1);
|
| + gfx::Transform leftFaceMatrix;
|
| + leftFaceMatrix.Translate3d(-1, 0, -5);
|
| + MathUtil::rotateAxisAngle(&leftFaceMatrix, 0, 1, 0, -90);
|
| + leftFaceMatrix.Translate(-1, -1);
|
| LayerShape leftFace(2, 2, perspectiveMatrix * leftFaceMatrix);
|
| - WebTransformationMatrix frontFaceMatrix;
|
| - frontFaceMatrix.translate3d(0, 0, -4);
|
| - frontFaceMatrix.translate(-1, -1);
|
| + gfx::Transform frontFaceMatrix;
|
| + frontFaceMatrix.Translate3d(0, 0, -4);
|
| + frontFaceMatrix.Translate(-1, -1);
|
| LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix);
|
|
|
| overlapResult = LayerSorter::checkOverlap(&frontFace, &leftFace, zThreshold, weight);
|
| @@ -84,20 +82,20 @@ TEST(LayerSorterTest, IntersectingLayerOverlap)
|
| const float zThreshold = 0.1f;
|
| float weight = 0;
|
|
|
| - WebTransformationMatrix perspectiveMatrix;
|
| - perspectiveMatrix.applyPerspective(1000);
|
| + gfx::Transform perspectiveMatrix;
|
| + perspectiveMatrix.ApplyPerspectiveDepth(1000);
|
|
|
| // Intersecting layers. An explicit order will be returned based on relative z
|
| // values at the overlapping features but the weight returned should be zero.
|
| - WebTransformationMatrix frontFaceMatrix;
|
| - frontFaceMatrix.translate3d(0, 0, -4);
|
| - frontFaceMatrix.translate(-1, -1);
|
| + gfx::Transform frontFaceMatrix;
|
| + frontFaceMatrix.Translate3d(0, 0, -4);
|
| + frontFaceMatrix.Translate(-1, -1);
|
| LayerShape frontFace(2, 2, perspectiveMatrix * frontFaceMatrix);
|
|
|
| - WebTransformationMatrix throughMatrix;
|
| - throughMatrix.translate3d(0, 0, -4);
|
| - throughMatrix.rotate3d(0, 1, 0, 45);
|
| - throughMatrix.translate(-1, -1);
|
| + gfx::Transform throughMatrix;
|
| + throughMatrix.Translate3d(0, 0, -4);
|
| + MathUtil::rotateAxisAngle(&throughMatrix, 0, 1, 0, 45);
|
| + throughMatrix.Translate(-1, -1);
|
| LayerShape rotatedFace(2, 2, perspectiveMatrix * throughMatrix);
|
| overlapResult = LayerSorter::checkOverlap(&frontFace, &rotatedFace, zThreshold, weight);
|
| EXPECT_NE(LayerSorter::None, overlapResult);
|
| @@ -122,19 +120,19 @@ TEST(LayerSorterTest, LayersAtAngleOverlap)
|
| // C is in front of A and behind B (not what you'd expect by comparing centers).
|
| // A and B don't overlap, so they're incomparable.
|
|
|
| - WebTransformationMatrix transformA;
|
| - transformA.translate3d(-6, 0, 1);
|
| - transformA.translate(-4, -10);
|
| + gfx::Transform transformA;
|
| + transformA.Translate3d(-6, 0, 1);
|
| + transformA.Translate(-4, -10);
|
| LayerShape layerA(8, 20, transformA);
|
|
|
| - WebTransformationMatrix transformB;
|
| - transformB.translate3d(6, 0, -1);
|
| - transformB.translate(-4, -10);
|
| + gfx::Transform transformB;
|
| + transformB.Translate3d(6, 0, -1);
|
| + transformB.Translate(-4, -10);
|
| LayerShape layerB(8, 20, transformB);
|
|
|
| - WebTransformationMatrix transformC;
|
| - transformC.rotate3d(0, 1, 0, 40);
|
| - transformC.translate(-4, -10);
|
| + gfx::Transform transformC;
|
| + MathUtil::rotateAxisAngle(&transformC, 0, 1, 0, 40);
|
| + transformC.Translate(-4, -10);
|
| LayerShape layerC(8, 20, transformC);
|
|
|
| overlapResult = LayerSorter::checkOverlap(&layerA, &layerC, zThreshold, weight);
|
| @@ -156,22 +154,22 @@ TEST(LayerSorterTest, LayersUnderPathologicalPerspectiveTransform)
|
| // where w < 0. If the code uses the invalid value, it will think that a layer has
|
| // different bounds than it really does, which can cause things to sort incorrectly.
|
|
|
| - WebTransformationMatrix perspectiveMatrix;
|
| - perspectiveMatrix.applyPerspective(1);
|
| + gfx::Transform perspectiveMatrix;
|
| + perspectiveMatrix.ApplyPerspectiveDepth(1);
|
|
|
| - WebTransformationMatrix transformA;
|
| - transformA.translate3d(-15, 0, -2);
|
| - transformA.translate(-5, -5);
|
| + gfx::Transform transformA;
|
| + transformA.Translate3d(-15, 0, -2);
|
| + transformA.Translate(-5, -5);
|
| LayerShape layerA(10, 10, perspectiveMatrix * transformA);
|
|
|
| // With this sequence of transforms, when layer B is correctly clipped, it will be
|
| // visible on the left half of the projection plane, in front of layerA. When it is
|
| // not clipped, its bounds will actually incorrectly appear much smaller and the
|
| // correct sorting dependency will not be found.
|
| - WebTransformationMatrix transformB;
|
| - transformB.translate3d(0, 0, 0.7);
|
| - transformB.rotate3d(0, 45, 0);
|
| - transformB.translate(-5, -5);
|
| + gfx::Transform transformB;
|
| + transformB.Translate3d(0, 0, 0.7);
|
| + MathUtil::rotateEulerAngles(&transformB, 0, 45, 0);
|
| + transformB.Translate(-5, -5);
|
| LayerShape layerB(10, 10, perspectiveMatrix * transformB);
|
|
|
| // Sanity check that the test case actually covers the intended scenario, where part
|
| @@ -205,10 +203,10 @@ TEST(LayerSorterTest, verifyExistingOrderingPreservedWhenNoZDiff)
|
| scoped_ptr<LayerImpl> layer4 = LayerImpl::create(4);
|
| scoped_ptr<LayerImpl> layer5 = LayerImpl::create(5);
|
|
|
| - WebTransformationMatrix BehindMatrix;
|
| - BehindMatrix.translate3d(0, 0, 2);
|
| - WebTransformationMatrix FrontMatrix;
|
| - FrontMatrix.translate3d(0, 0, 1);
|
| + gfx::Transform BehindMatrix;
|
| + BehindMatrix.Translate3d(0, 0, 2);
|
| + gfx::Transform FrontMatrix;
|
| + FrontMatrix.Translate3d(0, 0, 1);
|
|
|
| layer1->setBounds(gfx::Size(10, 10));
|
| layer1->setContentBounds(gfx::Size(10, 10));
|
|
|