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

Unified Diff: cc/layer_tree_host_common_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/layer_tree_host_common_unittest.cc
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index 456ea52f1fafac554620061135916567e46636b6..19e39874739cad00f3aa0c4cbcae42485abd36ce 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -19,16 +19,16 @@
#include "ui/gfx/size_conversions.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 namespace WebKitTests;
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
namespace {
template<typename LayerType>
-void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
+void setLayerPropertiesForTestingInternal(LayerType* layer, const Transform& transform, const Transform& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
layer->setTransform(transform);
layer->setSublayerTransform(sublayerTransform);
@@ -38,13 +38,13 @@ void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformat
layer->setPreserves3D(preserves3D);
}
-void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(Layer* layer, const Transform& transform, const Transform& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setAutomaticallyComputeRasterScale(true);
}
-void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(LayerImpl* layer, const Transform& transform, const Transform& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setContentBounds(bounds);
@@ -52,7 +52,7 @@ void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatri
void executeCalculateDrawTransformsAndVisibility(Layer* rootLayer, float deviceScaleFactor = 1, float pageScaleFactor = 1)
{
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
@@ -66,7 +66,7 @@ void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float dev
{
// Note: this version skips layer sorting.
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
std::vector<LayerImpl*> dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
@@ -76,16 +76,16 @@ void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float dev
LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
}
-WebTransformationMatrix remove3DComponentOfMatrix(const WebTransformationMatrix& mat)
+Transform remove3DComponentOfMatrix(const Transform& mat)
{
- WebTransformationMatrix ret = mat;
- ret.setM13(0);
- ret.setM23(0);
- ret.setM31(0);
- ret.setM32(0);
- ret.setM33(1);
- ret.setM34(0);
- ret.setM43(0);
+ Transform ret = mat;
+ ret.matrix().setDouble(2, 0, 0);
+ ret.matrix().setDouble(2, 1, 0);
+ ret.matrix().setDouble(0, 2, 0);
+ ret.matrix().setDouble(1, 2, 0);
+ ret.matrix().setDouble(2, 2, 1);
+ ret.matrix().setDouble(3, 2, 0);
+ ret.matrix().setDouble(2, 3, 0);
return ret;
}
@@ -96,7 +96,7 @@ scoped_ptr<LayerImpl> createTreeForFixedPositionTests()
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3);
scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4);
- WebTransformationMatrix IdentityMatrix;
+ Transform IdentityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -160,7 +160,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
parent->addChild(child);
child->addChild(grandChild);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
@@ -175,7 +175,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
{
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<Layer> layer = Layer::create();
scoped_refptr<Layer> root = Layer::create();
@@ -183,17 +183,17 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
root->addChild(layer);
// Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform.
- WebTransformationMatrix arbitraryTranslation;
- arbitraryTranslation.translate(10, 20);
+ Transform arbitraryTranslation;
+ arbitraryTranslation.PreconcatTranslate(10, 20);
setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedDrawTransform = identityMatrix;
+ Transform expectedDrawTransform = identityMatrix;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
// Case 2: Setting the bounds of the layer should not affect either the draw transform or the screenspace transform.
- WebTransformationMatrix translationToCenter;
- translationToCenter.translate(5, 6);
+ Transform translationToCenter;
+ translationToCenter.PreconcatTranslate(5, 6);
setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform());
@@ -206,8 +206,8 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
// Case 4: A change in actual position affects both the draw transform and screen space transform.
- WebTransformationMatrix positionTransform;
- positionTransform.translate(0, 1.2);
+ Transform positionTransform;
+ positionTransform.PreconcatTranslate(0, 1.2);
setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform());
@@ -215,17 +215,17 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 5: In the correct sequence of transforms, the layer transform should pre-multiply the translationToCenter. This is easily tested by
// using a scale transform, because scale and translation are not commutative.
- WebTransformationMatrix layerTransform;
- layerTransform.scale3d(2, 2, 1);
+ Transform layerTransform;
+ layerTransform.PreconcatScale3d(2, 2, 1);
setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform());
// Case 6: The layer transform should occur with respect to the anchor point.
- WebTransformationMatrix translationToAnchor;
- translationToAnchor.translate(5, 0);
- WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse();
+ Transform translationToAnchor;
+ translationToAnchor.PreconcatTranslate(5, 0);
+ Transform expectedResult = translationToAnchor * layerTransform * MathUtil::inverse(translationToAnchor);
setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
@@ -234,7 +234,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 7: Verify that position pre-multiplies the layer transform.
// The current implementation of calculateDrawTransforms does this implicitly, but it is
// still worth testing to detect accidental regressions.
- expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse();
+ expectedResult = positionTransform * translationToAnchor * layerTransform * MathUtil::inverse(translationToAnchor);
setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
@@ -243,7 +243,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
{
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<Layer> root = Layer::create();
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child = Layer::create();
@@ -266,8 +266,8 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->screenSpaceTransform());
// Case 2: parent's position affects child and grandChild.
- WebTransformationMatrix parentPositionTransform;
- parentPositionTransform.translate(0, 1.2);
+ Transform parentPositionTransform;
+ parentPositionTransform.PreconcatTranslate(0, 1.2);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
@@ -278,11 +278,11 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, grandChild->screenSpaceTransform());
// Case 3: parent's local transform affects child and grandchild
- WebTransformationMatrix parentLayerTransform;
- parentLayerTransform.scale3d(2, 2, 1);
- WebTransformationMatrix parentTranslationToAnchor;
- parentTranslationToAnchor.translate(2.5, 3);
- WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse();
+ Transform parentLayerTransform;
+ parentLayerTransform.PreconcatScale3d(2, 2, 1);
+ Transform parentTranslationToAnchor;
+ parentTranslationToAnchor.PreconcatTranslate(2.5, 3);
+ Transform parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * MathUtil::inverse(parentTranslationToAnchor);
setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
@@ -296,14 +296,14 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
// scaling is used here again so that the correct sequence of transforms is properly tested.
// Note that preserves3D is false, but the sublayer matrix should retain its 3D properties when given to child.
// But then, the child also does not preserve3D. When it gives its hierarchy to the grandChild, it should be flattened to 2D.
- WebTransformationMatrix parentSublayerMatrix;
- parentSublayerMatrix.scale3d(10, 10, 3.3);
- WebTransformationMatrix parentTranslationToCenter;
- parentTranslationToCenter.translate(5, 6);
+ Transform parentSublayerMatrix;
+ parentSublayerMatrix.PreconcatScale3d(10, 10, 3.3);
+ Transform parentTranslationToCenter;
+ parentTranslationToCenter.PreconcatTranslate(5, 6);
// Sublayer matrix is applied to the center of the parent layer.
- parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
- * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
- WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform);
+ parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * MathUtil::inverse(parentTranslationToAnchor)
+ * parentTranslationToCenter * parentSublayerMatrix * MathUtil::inverse(parentTranslationToCenter);
+ Transform flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform);
setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
@@ -336,26 +336,26 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
child->addChild(grandChild);
// One-time setup of root layer
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
- WebTransformationMatrix parentLayerTransform;
- parentLayerTransform.scale3d(1, 0.9, 1);
- WebTransformationMatrix parentTranslationToAnchor;
- parentTranslationToAnchor.translate(25, 30);
- WebTransformationMatrix parentSublayerMatrix;
- parentSublayerMatrix.scale3d(0.9, 1, 3.3);
- WebTransformationMatrix parentTranslationToCenter;
- parentTranslationToCenter.translate(50, 60);
- WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
- * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
+ Transform parentLayerTransform;
+ parentLayerTransform.PreconcatScale3d(1, 0.9, 1);
+ Transform parentTranslationToAnchor;
+ parentTranslationToAnchor.PreconcatTranslate(25, 30);
+ Transform parentSublayerMatrix;
+ parentSublayerMatrix.PreconcatScale3d(0.9, 1, 3.3);
+ Transform parentTranslationToCenter;
+ parentTranslationToCenter.PreconcatTranslate(50, 60);
+ Transform parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * MathUtil::inverse(parentTranslationToAnchor)
+ * parentTranslationToCenter * parentSublayerMatrix * MathUtil::inverse(parentTranslationToCenter);
gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
- WebTransformationMatrix surfaceSublayerTransform;
- surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
- WebTransformationMatrix surfaceSublayerCompositeTransform = parentCompositeTransform * surfaceSublayerTransform.inverse();
+ Transform surfaceSublayerTransform;
+ surfaceSublayerTransform.PreconcatScale(parentCompositeScale.x(), parentCompositeScale.y());
+ Transform surfaceSublayerCompositeTransform = parentCompositeTransform * MathUtil::inverse(surfaceSublayerTransform);
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
@@ -395,30 +395,30 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
child->setReplicaLayer(childReplica.get());
// One-time setup of root layer
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
- WebTransformationMatrix parentLayerTransform;
- parentLayerTransform.scale3d(2, 2, 1);
- WebTransformationMatrix parentTranslationToAnchor;
- parentTranslationToAnchor.translate(2.5, 3);
- WebTransformationMatrix parentSublayerMatrix;
- parentSublayerMatrix.scale3d(10, 10, 3.3);
- WebTransformationMatrix parentTranslationToCenter;
- parentTranslationToCenter.translate(5, 6);
- WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
- * parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
- WebTransformationMatrix childTranslationToCenter;
- childTranslationToCenter.translate(8, 9);
- WebTransformationMatrix replicaLayerTransform;
- replicaLayerTransform.scale3d(3, 3, 1);
+ Transform parentLayerTransform;
+ parentLayerTransform.PreconcatScale3d(2, 2, 1);
+ Transform parentTranslationToAnchor;
+ parentTranslationToAnchor.PreconcatTranslate(2.5, 3);
+ Transform parentSublayerMatrix;
+ parentSublayerMatrix.PreconcatScale3d(10, 10, 3.3);
+ Transform parentTranslationToCenter;
+ parentTranslationToCenter.PreconcatTranslate(5, 6);
+ Transform parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * MathUtil::inverse(parentTranslationToAnchor)
+ * parentTranslationToCenter * parentSublayerMatrix * MathUtil::inverse(parentTranslationToCenter);
+ Transform childTranslationToCenter;
+ childTranslationToCenter.PreconcatTranslate(8, 9);
+ Transform replicaLayerTransform;
+ replicaLayerTransform.PreconcatScale3d(3, 3, 1);
gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
- WebTransformationMatrix surfaceSublayerTransform;
- surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
- WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform * surfaceSublayerTransform.inverse();
+ Transform surfaceSublayerTransform;
+ surfaceSublayerTransform.PreconcatScale(parentCompositeScale.x(), parentCompositeScale.y());
+ Transform replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform * MathUtil::inverse(surfaceSublayerTransform);
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
@@ -475,7 +475,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
renderSurface2->setOpacity(0.33f);
// One-time setup of root layer
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// All layers in the tree are initialized with an anchor at .25 and a size of (10,10).
@@ -485,38 +485,38 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
//
// x component tests that layerTransform and sublayerTransform are done in the right order (translation and scale are noncommutative).
// y component has a translation by 1 for every ancestor, which indicates the "depth" of the layer in the hierarchy.
- WebTransformationMatrix translationToAnchor;
- translationToAnchor.translate(2.5, 0);
- WebTransformationMatrix translationToCenter;
- translationToCenter.translate(5, 5);
- WebTransformationMatrix layerTransform;
- layerTransform.translate(1, 1);
- WebTransformationMatrix sublayerTransform;
- sublayerTransform.scale3d(10, 1, 1);
- WebTransformationMatrix replicaLayerTransform;
- replicaLayerTransform.scale3d(-2, 5, 1);
-
- WebTransformationMatrix A = translationToAnchor * layerTransform * translationToAnchor.inverse();
- WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse();
- WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse();
+ Transform translationToAnchor;
+ translationToAnchor.PreconcatTranslate(2.5, 0);
+ Transform translationToCenter;
+ translationToCenter.PreconcatTranslate(5, 5);
+ Transform layerTransform;
+ layerTransform.PreconcatTranslate(1, 1);
+ Transform sublayerTransform;
+ sublayerTransform.PreconcatScale3d(10, 1, 1);
+ Transform replicaLayerTransform;
+ replicaLayerTransform.PreconcatScale3d(-2, 5, 1);
+
+ Transform A = translationToAnchor * layerTransform * MathUtil::inverse(translationToAnchor);
+ Transform B = translationToCenter * sublayerTransform * MathUtil::inverse(translationToCenter);
+ Transform R = A * translationToAnchor * replicaLayerTransform * MathUtil::inverse(translationToAnchor);
gfx::Vector2dF surface1ParentTransformScale = MathUtil::computeTransform2dScaleComponents(A * B);
- WebTransformationMatrix surface1SublayerTransform;
- surface1SublayerTransform.scaleNonUniform(surface1ParentTransformScale.x(), surface1ParentTransformScale.y());
+ Transform surface1SublayerTransform;
+ surface1SublayerTransform.PreconcatScale(surface1ParentTransformScale.x(), surface1ParentTransformScale.y());
// SS1 = transform given to the subtree of renderSurface1
- WebTransformationMatrix SS1 = surface1SublayerTransform;
+ Transform SS1 = surface1SublayerTransform;
// S1 = transform to move from renderSurface1 pixels to the layer space of the owning layer
- WebTransformationMatrix S1 = surface1SublayerTransform.inverse();
+ Transform S1 = MathUtil::inverse(surface1SublayerTransform);
gfx::Vector2dF surface2ParentTransformScale = MathUtil::computeTransform2dScaleComponents(SS1 * A * B);
- WebTransformationMatrix surface2SublayerTransform;
- surface2SublayerTransform.scaleNonUniform(surface2ParentTransformScale.x(), surface2ParentTransformScale.y());
+ Transform surface2SublayerTransform;
+ surface2SublayerTransform.PreconcatScale(surface2ParentTransformScale.x(), surface2ParentTransformScale.y());
// SS2 = transform given to the subtree of renderSurface2
- WebTransformationMatrix SS2 = surface2SublayerTransform;
+ Transform SS2 = surface2SublayerTransform;
// S2 = transform to move from renderSurface2 pixels to the layer space of the owning layer
- WebTransformationMatrix S2 = surface2SublayerTransform.inverse();
+ Transform S2 = MathUtil::inverse(surface2SublayerTransform);
setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
@@ -606,17 +606,17 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// Sanity check. If these fail there is probably a bug in the test itself.
// It is expected that we correctly set up transforms so that the y-component of the screen-space transform
// encodes the "depth" of the layer in the tree.
- EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().matrix().getDouble(1, 3));
- EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().matrix().getDouble(1, 3));
- EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().matrix().getDouble(1, 3));
}
TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
@@ -630,10 +630,10 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
scoped_refptr<Layer> child = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
- WebTransformationMatrix rotationAboutYAxis;
- rotationAboutYAxis.rotate3d(0, 30, 0);
+ Transform rotationAboutYAxis;
+ MathUtil::rotateEulerAngles(&rotationAboutYAxis, 0, 30, 0);
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(child.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(grandChild.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
@@ -647,10 +647,10 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
ASSERT_FALSE(child->preserves3D());
ASSERT_FALSE(grandChild->preserves3D());
- WebTransformationMatrix expectedChildDrawTransform = rotationAboutYAxis;
- WebTransformationMatrix expectedChildScreenSpaceTransform = rotationAboutYAxis;
- WebTransformationMatrix expectedGrandChildDrawTransform = rotationAboutYAxis; // draws onto child's renderSurface
- WebTransformationMatrix expectedGrandChildScreenSpaceTransform = rotationAboutYAxis.to2dTransform() * rotationAboutYAxis;
+ Transform expectedChildDrawTransform = rotationAboutYAxis;
+ Transform expectedChildScreenSpaceTransform = rotationAboutYAxis;
+ Transform expectedGrandChildDrawTransform = rotationAboutYAxis; // draws onto child's renderSurface
+ Transform expectedGrandChildScreenSpaceTransform = MathUtil::to2dTransform(rotationAboutYAxis) * rotationAboutYAxis;
executeCalculateDrawTransformsAndVisibility(root.get());
@@ -677,7 +677,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
scoped_refptr<LayerWithForcedDrawsContent> grandChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
// The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 0), false);
setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
@@ -700,7 +700,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipped
scoped_refptr<Layer> renderSurface1 = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false);
@@ -728,7 +728,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
scoped_refptr<Layer> renderSurface1 = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
@@ -757,7 +757,7 @@ TEST(LayerTreeHostCommonTest, verifyForceRenderSurface)
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
renderSurface1->setForceRenderSurface(true);
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
@@ -801,8 +801,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform;
+ Transform expectedChildTransform;
+ Transform expectedGrandChildTransform = expectedChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -812,8 +812,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
executeCalculateDrawTransformsAndVisibility(root.get());
// Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -10);
+ expectedChildTransform.matrix().setIdentity();
danakj 2012/11/24 02:34:54 note: we should have API on gfx::Transform to neve
+ expectedChildTransform.PreconcatTranslate(-10, -10);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -834,8 +834,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
LayerImpl* grandChild = child->children()[0];
// This scale will cause child and grandChild to be effectively 200 x 800 with respect to the renderTarget.
- WebTransformationMatrix nonUniformScale;
- nonUniformScale.scaleNonUniform(2, 8);
+ Transform nonUniformScale;
+ nonUniformScale.PreconcatScale(2, 8);
child->setTransform(nonUniformScale);
child->setIsContainerForFixedPositionLayers(true);
@@ -845,10 +845,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- expectedChildTransform.multiply(nonUniformScale);
+ Transform expectedChildTransform;
+ expectedChildTransform.PreconcatTransform(nonUniformScale);
- WebTransformationMatrix expectedGrandChildTransform = expectedChildTransform;
+ Transform expectedGrandChildTransform = expectedChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -858,9 +858,9 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithT
executeCalculateDrawTransformsAndVisibility(root.get());
// The child should be affected by scrollDelta, but the fixed position grandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -20); // scrollDelta
- expectedChildTransform.multiply(nonUniformScale);
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -20); // scrollDelta
+ expectedChildTransform.PreconcatTransform(nonUniformScale);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -883,11 +883,11 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- WebTransformationMatrix expectedGrandChildTransform;
- expectedGrandChildTransform.translate(8, 6);
+ Transform expectedChildTransform;
+ Transform expectedGrandChildTransform;
+ expectedGrandChildTransform.PreconcatTranslate(8, 6);
- WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+ Transform expectedGreatGrandChildTransform = expectedGrandChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -898,10 +898,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
executeCalculateDrawTransformsAndVisibility(root.get());
// Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -10);
- expectedGrandChildTransform.makeIdentity();
- expectedGrandChildTransform.translate(-2, -4);
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -10);
+ expectedGrandChildTransform.matrix().setIdentity();
+ expectedGrandChildTransform.PreconcatTranslate(-2, -4);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGreatGrandChildTransform, greatGrandChild->drawTransform());
@@ -917,8 +917,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
LayerImpl* grandChild = child->children()[0];
LayerImpl* greatGrandChild = grandChild->children()[0];
- WebTransformationMatrix rotationAboutZ;
- rotationAboutZ.rotate3d(0, 0, 90);
+ Transform rotationAboutZ;
+ MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
@@ -930,15 +930,15 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- expectedChildTransform.multiply(rotationAboutZ);
+ Transform expectedChildTransform;
+ expectedChildTransform.PreconcatTransform(rotationAboutZ);
- WebTransformationMatrix expectedGrandChildTransform;
- expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
- expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
- expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ Transform expectedGrandChildTransform;
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.PreconcatTranslate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChild's local transform
- WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+ Transform expectedGreatGrandChildTransform = expectedGrandChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -949,15 +949,15 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
executeCalculateDrawTransformsAndVisibility(root.get());
// Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -20); // scrollDelta
- expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -20); // scrollDelta
+ expectedChildTransform.PreconcatTransform(rotationAboutZ);
- expectedGrandChildTransform.makeIdentity();
- expectedGrandChildTransform.translate(-10, -20); // child's scrollDelta is inherited
- expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
- expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
- expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.matrix().setIdentity();
+ expectedGrandChildTransform.PreconcatTranslate(-10, -20); // child's scrollDelta is inherited
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.PreconcatTranslate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChild's local transform
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -977,8 +977,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
LayerImpl* grandChild = child->children()[0];
LayerImpl* greatGrandChild = grandChild->children()[0];
- WebTransformationMatrix rotationAboutZ;
- rotationAboutZ.rotate3d(0, 0, 90);
+ Transform rotationAboutZ;
+ MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
@@ -990,15 +990,15 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- expectedChildTransform.multiply(rotationAboutZ);
+ Transform expectedChildTransform;
+ expectedChildTransform.PreconcatTransform(rotationAboutZ);
- WebTransformationMatrix expectedGrandChildTransform;
- expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
- expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
- expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ Transform expectedGrandChildTransform;
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.PreconcatTranslate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChild's local transform
- WebTransformationMatrix expectedGreatGrandChildTransform = expectedGrandChildTransform;
+ Transform expectedGreatGrandChildTransform = expectedGrandChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -1010,16 +1010,16 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
executeCalculateDrawTransformsAndVisibility(root.get());
// Here the child and grandChild are affected by scrollDelta, but the fixed position greatGrandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, 0); // scrollDelta
- expectedChildTransform.multiply(rotationAboutZ);
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, 0); // scrollDelta
+ expectedChildTransform.PreconcatTransform(rotationAboutZ);
- expectedGrandChildTransform.makeIdentity();
- expectedGrandChildTransform.translate(-10, 0); // child's scrollDelta is inherited
- expectedGrandChildTransform.multiply(rotationAboutZ); // child's local transform is inherited
- expectedGrandChildTransform.translate(-5, 0); // grandChild's scrollDelta
- expectedGrandChildTransform.translate(8, 6); // translation because of position occurs before layer's local transform.
- expectedGrandChildTransform.multiply(rotationAboutZ); // grandChild's local transform
+ expectedGrandChildTransform.matrix().setIdentity();
+ expectedGrandChildTransform.PreconcatTranslate(-10, 0); // child's scrollDelta is inherited
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // child's local transform is inherited
+ expectedGrandChildTransform.PreconcatTranslate(-5, 0); // grandChild's scrollDelta
+ expectedGrandChildTransform.PreconcatTranslate(8, 6); // translation because of position occurs before layer's local transform.
+ expectedGrandChildTransform.PreconcatTransform(rotationAboutZ); // grandChild's local transform
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -1043,20 +1043,20 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
greatGrandChild->setFixedToContainerLayer(true);
greatGrandChild->setDrawsContent(true);
- WebTransformationMatrix rotationAboutZ;
- rotationAboutZ.rotate3d(0, 0, 90);
+ Transform rotationAboutZ;
+ MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
grandChild->setTransform(rotationAboutZ);
// Case 1: scrollDelta of 0, 0
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- WebTransformationMatrix expectedSurfaceDrawTransform;
- expectedSurfaceDrawTransform.translate(8, 6);
- expectedSurfaceDrawTransform.multiply(rotationAboutZ);
- WebTransformationMatrix expectedGrandChildTransform;
- WebTransformationMatrix expectedGreatGrandChildTransform;
+ Transform expectedChildTransform;
+ Transform expectedSurfaceDrawTransform;
+ expectedSurfaceDrawTransform.PreconcatTranslate(8, 6);
+ expectedSurfaceDrawTransform.PreconcatTransform(rotationAboutZ);
+ Transform expectedGrandChildTransform;
+ Transform expectedGreatGrandChildTransform;
ASSERT_TRUE(grandChild->renderSurface());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, grandChild->renderSurface()->drawTransform());
@@ -1074,21 +1074,21 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
// that surface. So, the net result is that, unlike previous tests where the fixed
// position layer's transform remains unchanged, here the fixed position layer's
// transform explicitly contains the translation that cancels out the scroll.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -30); // scrollDelta
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -30); // scrollDelta
- expectedSurfaceDrawTransform.makeIdentity();
- expectedSurfaceDrawTransform.translate(-10, -30); // scrollDelta
- expectedSurfaceDrawTransform.translate(8, 6);
- expectedSurfaceDrawTransform.multiply(rotationAboutZ);
+ expectedSurfaceDrawTransform.matrix().setIdentity();
+ expectedSurfaceDrawTransform.PreconcatTranslate(-10, -30); // scrollDelta
+ expectedSurfaceDrawTransform.PreconcatTranslate(8, 6);
+ expectedSurfaceDrawTransform.PreconcatTransform(rotationAboutZ);
// The rotation and its inverse are needed to place the scrollDelta compensation in
// the correct space. This test will fail if the rotation/inverse are backwards, too,
// so it requires perfect order of operations.
- expectedGreatGrandChildTransform.makeIdentity();
- expectedGreatGrandChildTransform.multiply(rotationAboutZ.inverse());
- expectedGreatGrandChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
- expectedGreatGrandChildTransform.multiply(rotationAboutZ);
+ expectedGreatGrandChildTransform.matrix().setIdentity();
+ expectedGreatGrandChildTransform.PreconcatTransform(MathUtil::inverse(rotationAboutZ));
+ expectedGreatGrandChildTransform.PreconcatTranslate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
+ expectedGreatGrandChildTransform.PreconcatTransform(rotationAboutZ);
ASSERT_TRUE(grandChild->renderSurface());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
@@ -1110,7 +1110,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
// Add one more layer to the test tree for this scenario.
{
- WebTransformationMatrix identity;
+ Transform identity;
scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5);
setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
greatGrandChild->addChild(fixedPositionChild.Pass());
@@ -1130,10 +1130,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
// verify that we have correct order-of-operations in the final scroll compensation.
// Note that rotating about the center of the layer ensures we do not accidentally
// clip away layers that we want to test.
- WebTransformationMatrix rotationAboutZ;
- rotationAboutZ.translate(50, 50);
- rotationAboutZ.rotate3d(0, 0, 90);
- rotationAboutZ.translate(-50, -50);
+ Transform rotationAboutZ;
+ rotationAboutZ.PreconcatTranslate(50, 50);
+ MathUtil::rotateEulerAngles(&rotationAboutZ, 0, 0, 90);
+ rotationAboutZ.PreconcatTranslate(-50, -50);
grandChild->setTransform(rotationAboutZ);
greatGrandChild->setTransform(rotationAboutZ);
@@ -1141,21 +1141,21 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
+ Transform expectedChildTransform;
- WebTransformationMatrix expectedGrandChildSurfaceDrawTransform;
- expectedGrandChildSurfaceDrawTransform.translate(8, 6);
- expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ);
+ Transform expectedGrandChildSurfaceDrawTransform;
+ expectedGrandChildSurfaceDrawTransform.PreconcatTranslate(8, 6);
+ expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ);
- WebTransformationMatrix expectedGrandChildTransform;
+ Transform expectedGrandChildTransform;
- WebTransformationMatrix expectedGreatGrandChildSurfaceDrawTransform;
- expectedGreatGrandChildSurfaceDrawTransform.translate(40, 60);
- expectedGreatGrandChildSurfaceDrawTransform.multiply(rotationAboutZ);
+ Transform expectedGreatGrandChildSurfaceDrawTransform;
+ expectedGreatGrandChildSurfaceDrawTransform.PreconcatTranslate(40, 60);
+ expectedGreatGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ);
- WebTransformationMatrix expectedGreatGrandChildTransform;
+ Transform expectedGreatGrandChildTransform;
- WebTransformationMatrix expectedFixedPositionChildTransform;
+ Transform expectedFixedPositionChildTransform;
ASSERT_TRUE(grandChild->renderSurface());
ASSERT_TRUE(greatGrandChild->renderSurface());
@@ -1170,13 +1170,13 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
child->setScrollDelta(gfx::Vector2d(10, 30));
executeCalculateDrawTransformsAndVisibility(root.get());
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -30); // scrollDelta
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -30); // scrollDelta
- expectedGrandChildSurfaceDrawTransform.makeIdentity();
- expectedGrandChildSurfaceDrawTransform.translate(-10, -30); // scrollDelta
- expectedGrandChildSurfaceDrawTransform.translate(8, 6);
- expectedGrandChildSurfaceDrawTransform.multiply(rotationAboutZ);
+ expectedGrandChildSurfaceDrawTransform.matrix().setIdentity();
+ expectedGrandChildSurfaceDrawTransform.PreconcatTranslate(-10, -30); // scrollDelta
+ expectedGrandChildSurfaceDrawTransform.PreconcatTranslate(8, 6);
+ expectedGrandChildSurfaceDrawTransform.PreconcatTransform(rotationAboutZ);
// grandChild, greatGrandChild, and greatGrandChild's surface are not expected to
// change, since they are all not fixed, and they are all drawn with respect to
@@ -1185,16 +1185,16 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
// But the great-great grandchild, "fixedPositionChild", should have a transform that explicitly cancels out the scrollDelta.
// The expected transform is:
// compoundDrawTransform.inverse() * translate(positive scrollDelta) * compoundOriginTransform
- WebTransformationMatrix compoundDrawTransform; // transform from greatGrandChildSurface's origin to the root surface.
- compoundDrawTransform.translate(8, 6); // origin translation of grandChild
- compoundDrawTransform.multiply(rotationAboutZ); // rotation of grandChild
- compoundDrawTransform.translate(40, 60); // origin translation of greatGrandChild
- compoundDrawTransform.multiply(rotationAboutZ); // rotation of greatGrandChild
+ Transform compoundDrawTransform; // transform from greatGrandChildSurface's origin to the root surface.
+ compoundDrawTransform.PreconcatTranslate(8, 6); // origin translation of grandChild
+ compoundDrawTransform.PreconcatTransform(rotationAboutZ); // rotation of grandChild
+ compoundDrawTransform.PreconcatTranslate(40, 60); // origin translation of greatGrandChild
+ compoundDrawTransform.PreconcatTransform(rotationAboutZ); // rotation of greatGrandChild
- expectedFixedPositionChildTransform.makeIdentity();
- expectedFixedPositionChildTransform.multiply(compoundDrawTransform.inverse());
- expectedFixedPositionChildTransform.translate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
- expectedFixedPositionChildTransform.multiply(compoundDrawTransform);
+ expectedFixedPositionChildTransform.matrix().setIdentity();
+ expectedFixedPositionChildTransform.PreconcatTransform(MathUtil::inverse(compoundDrawTransform));
+ expectedFixedPositionChildTransform.PreconcatTranslate(10, 30); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
+ expectedFixedPositionChildTransform.PreconcatTransform(compoundDrawTransform);
ASSERT_TRUE(grandChild->renderSurface());
ASSERT_TRUE(greatGrandChild->renderSurface());
@@ -1225,10 +1225,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedSurfaceDrawTransform;
- expectedSurfaceDrawTransform.translate(0, 0);
- WebTransformationMatrix expectedChildTransform;
- WebTransformationMatrix expectedGrandChildTransform;
+ Transform expectedSurfaceDrawTransform;
+ expectedSurfaceDrawTransform.PreconcatTranslate(0, 0);
+ Transform expectedChildTransform;
+ Transform expectedGrandChildTransform;
ASSERT_TRUE(child->renderSurface());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
@@ -1241,10 +1241,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithC
// The surface is translated by scrollDelta, the child transform doesn't change
// because it scrolls along with the surface, but the fixed position grandChild
// needs to compensate for the scroll translation.
- expectedSurfaceDrawTransform.makeIdentity();
- expectedSurfaceDrawTransform.translate(-10, -10);
- expectedGrandChildTransform.makeIdentity();
- expectedGrandChildTransform.translate(10, 10);
+ expectedSurfaceDrawTransform.matrix().setIdentity();
+ expectedSurfaceDrawTransform.PreconcatTranslate(-10, -10);
+ expectedGrandChildTransform.matrix().setIdentity();
+ expectedGrandChildTransform.PreconcatTranslate(10, 10);
ASSERT_TRUE(child->renderSurface());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform());
@@ -1271,8 +1271,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
child->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix expectedChildTransform;
- WebTransformationMatrix expectedGrandChildTransform;
+ Transform expectedChildTransform;
+ Transform expectedGrandChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -1281,8 +1281,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatI
executeCalculateDrawTransformsAndVisibility(root.get());
// Here the child is affected by scrollDelta, but the fixed position grandChild should not be affected.
- expectedChildTransform.makeIdentity();
- expectedChildTransform.translate(-10, -10);
+ expectedChildTransform.matrix().setIdentity();
+ expectedChildTransform.PreconcatTranslate(-10, -10);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
}
@@ -1296,8 +1296,8 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
LayerImpl* child = root->children()[0];
LayerImpl* grandChild = child->children()[0];
- WebTransformationMatrix rotationByZ;
- rotationByZ.rotate3d(0, 0, 90);
+ Transform rotationByZ;
+ MathUtil::rotateEulerAngles(&rotationByZ, 0, 0, 90);
root->setTransform(rotationByZ);
grandChild->setFixedToContainerLayer(true);
@@ -1306,7 +1306,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
root->setScrollDelta(gfx::Vector2d(0, 0));
executeCalculateDrawTransformsAndVisibility(root.get());
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform());
@@ -1319,10 +1319,10 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerThatH
// the child's target surface (i.e. the root renderSurface). The grandChild is not
// affected by the scrollDelta, so its drawTransform needs to explicitly
// inverse-compensate for the scroll that's embedded in the target surface.
- WebTransformationMatrix expectedGrandChildTransform;
- expectedGrandChildTransform.multiply(rotationByZ.inverse());
- expectedGrandChildTransform.translate(10, 20); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
- expectedGrandChildTransform.multiply(rotationByZ);
+ Transform expectedGrandChildTransform;
+ expectedGrandChildTransform.PreconcatTransform(MathUtil::inverse(rotationByZ));
+ expectedGrandChildTransform.PreconcatTranslate(10, 20); // explicit canceling out the scrollDelta that gets embedded in the fixed position layer's surface.
+ expectedGrandChildTransform.PreconcatTransform(rotationByZ);
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildTransform, grandChild->drawTransform());
@@ -1344,7 +1344,7 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
// clipRect, and they should never get scheduled on the list of renderSurfaces.
//
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child = Layer::create();
scoped_refptr<Layer> grandChild = Layer::create();
@@ -1399,7 +1399,7 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
// this clipping should be avoided and we should keep the grandChild
// in the renderSurfaceLayerList.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child = Layer::create();
scoped_refptr<Layer> grandChild = Layer::create();
@@ -1457,7 +1457,7 @@ TEST(LayerTreeHostCommonTest, verifyIsClippedIsSetCorrectly)
// - but if the layer itself masks to bounds, it is considered clipped
// and propagates the clip to the subtree.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> root = Layer::create();
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child1 = Layer::create();
@@ -1552,7 +1552,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
// grandChild4 - outside parent's clipRect; the drawableContentRect should be empty.
//
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child = Layer::create();
scoped_refptr<Layer> grandChild1 = Layer::create();
@@ -1602,7 +1602,7 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
// have a clipRect of their own layer bounds, however, if masksToBounds was true.
//
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<Layer> child = Layer::create();
scoped_refptr<Layer> grandChild1 = Layer::create();
@@ -1693,10 +1693,10 @@ TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
// Also put an animated opacity on a layer without descendants.
addOpacityTransitionToController(*grandChildOfRoot->layerAnimationController(), 10, 1, 0, false);
- WebTransformationMatrix layerTransform;
- layerTransform.translate(1, 1);
- WebTransformationMatrix sublayerTransform;
- sublayerTransform.scale3d(10, 1, 1);
+ Transform layerTransform;
+ layerTransform.PreconcatTranslate(1, 1);
+ Transform sublayerTransform;
+ sublayerTransform.PreconcatScale3d(10, 1, 1);
// Put a transform animation on the render surface.
addAnimatedTransformToController(*renderSurface2->layerAnimationController(), 10, 30, 0);
@@ -1791,17 +1791,17 @@ TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
// Sanity check. If these fail there is probably a bug in the test itself.
// It is expected that we correctly set up transforms so that the y-component of the screen-space transform
// encodes the "depth" of the layer in the tree.
- EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(1, parent->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(2, childOfRoot->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(3, grandChildOfRoot->screenSpaceTransform().matrix().getDouble(1, 3));
- EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(2, renderSurface1->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(3, childOfRS1->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(4, grandChildOfRS1->screenSpaceTransform().matrix().getDouble(1, 3));
- EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().m42());
- EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().m42());
+ EXPECT_FLOAT_EQ(3, renderSurface2->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(4, childOfRS2->screenSpaceTransform().matrix().getDouble(1, 3));
+ EXPECT_FLOAT_EQ(5, grandChildOfRS2->screenSpaceTransform().matrix().getDouble(1, 3));
}
TEST(LayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform)
@@ -1809,7 +1809,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform)
// Test the calculateVisibleRect() function works correctly for identity transforms.
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(10, 10), gfx::Size(30, 30));
@@ -1835,24 +1835,24 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForTranslations)
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(10, 10);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(10, 10);
gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(120, 120);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(120, 120);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_TRUE(actual.IsEmpty());
// Case 3: Layer is partially overlapping the surface rect.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(80, 80);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(80, 80);
expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1865,20 +1865,20 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(50, 50);
- layerToSurfaceTransform.rotate(45);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(50, 50);
+ layerToSurfaceTransform.PreconcatRotate(45);
gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(-50, 0);
- layerToSurfaceTransform.rotate(45);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(-50, 0);
+ layerToSurfaceTransform.PreconcatRotate(45);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_TRUE(actual.IsEmpty());
@@ -1887,8 +1887,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// this case, the visible rect should still be the entire layer (remember the
// visible rect is computed in layer space); both the top-left and
// bottom-right corners of the layer are still visible.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.rotate(45);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatRotate(45);
expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1898,9 +1898,9 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// of the surface overlapping the layer. In layer space, the render surface
// overlaps the right side of the layer. The visible rect should be the
// layer's right half.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(0, -sqrt(2.0) * 15);
- layerToSurfaceTransform.rotate(45);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(0, -sqrt(2.0) * 15);
+ layerToSurfaceTransform.PreconcatRotate(45);
expected = gfx::Rect(gfx::Point(15, 0), gfx::Size(15, 30)); // right half of layer bounds.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1912,11 +1912,11 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.rotate3d(0, 45, 0);
+ layerToSurfaceTransform.matrix().setIdentity();
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1925,9 +1925,9 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
// shifted to the side so only the right-half the layer would be visible on
// the surface.
double halfWidthOfRotatedLayer = (100 / sqrt(2.0)) * 0.5; // 100 is the un-rotated layer width; divided by sqrt(2) is the rotated width.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0);
- layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(-halfWidthOfRotatedLayer, 0);
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0); // rotates about the left edge of the layer
expected = gfx::Rect(gfx::Point(50, 0), gfx::Size(50, 100)); // right half of the layer.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1940,20 +1940,20 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// Case 1: Even though the layer is twice as large as the surface, due to perspective
// foreshortening, the layer will fit fully in the surface when its translated
// more than the perspective amount.
- layerToSurfaceTransform.makeIdentity();
+ layerToSurfaceTransform.matrix().setIdentity();
// The following sequence of transforms applies the perspective about the center of the surface.
- layerToSurfaceTransform.translate(50, 50);
- layerToSurfaceTransform.applyPerspective(9);
- layerToSurfaceTransform.translate(-50, -50);
+ layerToSurfaceTransform.PreconcatTranslate(50, 50);
+ layerToSurfaceTransform.PreconcatPerspectiveDepth(9);
+ layerToSurfaceTransform.PreconcatTranslate(-50, -50);
// This translate places the layer in front of the surface's projection plane.
- layerToSurfaceTransform.translate3d(0, 0, -27);
+ layerToSurfaceTransform.PreconcatTranslate3d(0, 0, -27);
gfx::Rect expected = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
@@ -1967,7 +1967,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// Then, by similar triangles, if we want to move a layer by translating -50 units in projected surface units (so that only half of it is
// visible), then we would need to translate by (-36 / 9) * -50 == -200 in the layer's units.
//
- layerToSurfaceTransform.translate3d(-200, 0, 0);
+ layerToSurfaceTransform.PreconcatTranslate3d(-200, 0, 0);
expected = gfx::Rect(gfx::Point(50, -50), gfx::Size(100, 200)); // The right half of the layer's bounding rect.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1982,14 +1982,14 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// This sequence of transforms effectively rotates the layer about the y-axis at the
// center of the layer.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.translate(50, 0);
- layerToSurfaceTransform.rotate3d(0, 45, 0);
- layerToSurfaceTransform.translate(-50, 0);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatTranslate(50, 0);
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
+ layerToSurfaceTransform.PreconcatTranslate(-50, 0);
gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
@@ -2006,16 +2006,16 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -1), gfx::Size(20, 2));
- WebTransformationMatrix layerToSurfaceTransform;
+ Transform layerToSurfaceTransform;
// The layer is positioned so that the right half of the layer should be in front of
// the camera, while the other half is behind the surface's projection plane. The
// following sequence of transforms applies the perspective and rotation about the
// center of the layer.
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.applyPerspective(1);
- layerToSurfaceTransform.translate3d(-2, 0, 1);
- layerToSurfaceTransform.rotate3d(0, 45, 0);
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatPerspectiveDepth(1);
+ layerToSurfaceTransform.PreconcatTranslate3d(-2, 0, 1);
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
// Sanity check that this transform does indeed cause w < 0 when applying the
// transform, otherwise this code is not testing the intended scenario.
@@ -2040,18 +2040,18 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped.
gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -10), gfx::Size(20, 20));
- WebTransformationMatrix layerToSurfaceTransform;
- layerToSurfaceTransform.makeIdentity();
- layerToSurfaceTransform.applyPerspective(1);
- layerToSurfaceTransform.translate3d(0, 0, -5);
- layerToSurfaceTransform.rotate3d(0, 45, 0);
- layerToSurfaceTransform.rotate3d(80, 0, 0);
+ Transform layerToSurfaceTransform;
+ layerToSurfaceTransform.matrix().setIdentity();
+ layerToSurfaceTransform.PreconcatPerspectiveDepth(1);
+ layerToSurfaceTransform.PreconcatTranslate3d(0, 0, -5);
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 0, 45, 0);
+ MathUtil::rotateEulerAngles(&layerToSurfaceTransform, 80, 0, 0);
// Sanity check that un-projection does indeed cause w < 0, otherwise this code is not
// testing the intended scenario.
bool clipped = false;
gfx::RectF clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
- MathUtil::projectQuad(layerToSurfaceTransform.inverse(), gfx::QuadF(clippedRect), clipped);
+ MathUtil::projectQuad(MathUtil::inverse(layerToSurfaceTransform), gfx::QuadF(clippedRect), clipped);
ASSERT_TRUE(clipped);
// Only the corner of the layer is not visible on the surface because of being
@@ -2072,7 +2072,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayer
root->addChild(child2);
root->addChild(child3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
@@ -2109,7 +2109,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClipp
child->addChild(grandChild2);
child->addChild(grandChild3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
@@ -2151,7 +2151,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnc
renderSurface1->addChild(child2);
renderSurface1->addChild(child3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
@@ -2195,7 +2195,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInCli
renderSurface1->addChild(child2);
renderSurface1->addChild(child3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
@@ -2245,7 +2245,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHier
renderSurface2->addChild(child2);
renderSurface2->addChild(child3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(7, 13), false);
@@ -2300,9 +2300,9 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix childRotation;
- childRotation.rotate(45);
+ Transform identityMatrix;
+ Transform childRotation;
+ childRotation.PreconcatRotate(45);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
@@ -2340,9 +2340,9 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
root->addChild(renderSurface1);
renderSurface1->addChild(child1);
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix childRotation;
- childRotation.rotate(45);
+ Transform identityMatrix;
+ Transform childRotation;
+ childRotation.PreconcatRotate(45);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
@@ -2384,7 +2384,7 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
renderSurface2->addChild(child2);
renderSurface2->addChild(child3);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(3, 4), false);
setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(7, 13), false);
@@ -2439,7 +2439,7 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
// that 3d transforms still apply in this case, but they are "flattened" to each
// parent layer according to current W3C spec.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
scoped_refptr<LayerWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
@@ -2469,10 +2469,10 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
frontFacingChildOfBackFacingSurface->setDoubleSided(false);
backFacingChildOfBackFacingSurface->setDoubleSided(false);
- WebTransformationMatrix backfaceMatrix;
- backfaceMatrix.translate(50, 50);
- backfaceMatrix.rotate3d(0, 1, 0, 180);
- backfaceMatrix.translate(-50, -50);
+ Transform backfaceMatrix;
+ backfaceMatrix.PreconcatTranslate(50, 50);
+ MathUtil::rotateAxisAngle(&backfaceMatrix, 0, 1, 0, 180);
+ backfaceMatrix.PreconcatTranslate(-50, -50);
// Having a descendant and opacity will force these to have render surfaces.
frontFacingSurface->setOpacity(0.5);
@@ -2531,7 +2531,7 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
{
// Verify the behavior of back-face culling when preserves-3d transform style is used.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> frontFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
scoped_refptr<LayerWithForcedDrawsContent> backFacingChild = make_scoped_refptr(new LayerWithForcedDrawsContent());
@@ -2563,10 +2563,10 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
frontFacingChildOfBackFacingSurface->setDoubleSided(false);
backFacingChildOfBackFacingSurface->setDoubleSided(false);
- WebTransformationMatrix backfaceMatrix;
- backfaceMatrix.translate(50, 50);
- backfaceMatrix.rotate3d(0, 1, 0, 180);
- backfaceMatrix.translate(-50, -50);
+ Transform backfaceMatrix;
+ backfaceMatrix.PreconcatTranslate(50, 50);
+ MathUtil::rotateAxisAngle(&backfaceMatrix, 0, 1, 0, 180);
+ backfaceMatrix.PreconcatTranslate(-50, -50);
// Opacity will not force creation of renderSurfaces in this case because of the
// preserve-3d transform style. Instead, an example of when a surface would be
@@ -2628,7 +2628,7 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
// treated as "unknown" so we can not be sure that their back face is really showing.
//
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
scoped_refptr<LayerWithForcedDrawsContent> animatingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent());
@@ -2649,10 +2649,10 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
childOfAnimatingSurface->setDoubleSided(false);
animatingChild->setDoubleSided(false);
- WebTransformationMatrix backfaceMatrix;
- backfaceMatrix.translate(50, 50);
- backfaceMatrix.rotate3d(0, 1, 0, 180);
- backfaceMatrix.translate(-50, -50);
+ Transform backfaceMatrix;
+ backfaceMatrix.PreconcatTranslate(50, 50);
+ MathUtil::rotateAxisAngle(&backfaceMatrix, 0, 1, 0, 180);
+ backfaceMatrix.PreconcatTranslate(-50, -50);
// Make our render surface.
animatingSurface->setForceRenderSurface(true);
@@ -2708,7 +2708,7 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningS
// Verify the behavior of back-face culling for a renderSurface that is created
// when it flattens its subtree, and its parent has preserves-3d.
- const WebTransformationMatrix identityMatrix;
+ const Transform identityMatrix;
scoped_refptr<Layer> parent = Layer::create();
scoped_refptr<LayerWithForcedDrawsContent> frontFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent());
scoped_refptr<LayerWithForcedDrawsContent> backFacingSurface = make_scoped_refptr(new LayerWithForcedDrawsContent());
@@ -2724,10 +2724,10 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningS
frontFacingSurface->setDoubleSided(false);
backFacingSurface->setDoubleSided(false);
- WebTransformationMatrix backfaceMatrix;
- backfaceMatrix.translate(50, 50);
- backfaceMatrix.rotate3d(0, 1, 0, 180);
- backfaceMatrix.translate(-50, -50);
+ Transform backfaceMatrix;
+ backfaceMatrix.PreconcatTranslate(50, 50);
+ MathUtil::rotateAxisAngle(&backfaceMatrix, 0, 1, 0, 180);
+ backfaceMatrix.PreconcatTranslate(-50, -50);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent transform style is preserve3d.
setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // surface transform style is flat.
@@ -2778,7 +2778,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -2818,14 +2818,14 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix uninvertibleTransform;
- uninvertibleTransform.setM11(0);
- uninvertibleTransform.setM22(0);
- uninvertibleTransform.setM33(0);
- uninvertibleTransform.setM44(0);
- ASSERT_FALSE(uninvertibleTransform.isInvertible());
+ Transform uninvertibleTransform;
+ uninvertibleTransform.matrix().setDouble(0, 0, 0);
+ uninvertibleTransform.matrix().setDouble(1, 1, 0);
+ uninvertibleTransform.matrix().setDouble(2, 2, 0);
+ uninvertibleTransform.matrix().setDouble(3, 3, 0);
+ ASSERT_FALSE(uninvertibleTransform.IsInvertible());
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -2839,7 +2839,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
// Sanity check the scenario we just created.
ASSERT_EQ(1u, renderSurfaceLayerList.size());
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
- ASSERT_FALSE(root->screenSpaceTransform().isInvertible());
+ ASSERT_FALSE(root->screenSpaceTransform().IsInvertible());
// Hit testing any point should not hit the layer. If the invertible matrix is
// accidentally ignored and treated like an identity, then the hit testing will
@@ -2877,7 +2877,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
gfx::Size bounds(100, 100);
@@ -2918,11 +2918,11 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix rotation45DegreesAboutCenter;
- rotation45DegreesAboutCenter.translate(50, 50);
- rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
- rotation45DegreesAboutCenter.translate(-50, -50);
+ Transform identityMatrix;
+ Transform rotation45DegreesAboutCenter;
+ rotation45DegreesAboutCenter.PreconcatTranslate(50, 50);
+ MathUtil::rotateEulerAngles(&rotation45DegreesAboutCenter, 0, 0, 45);
+ rotation45DegreesAboutCenter.PreconcatTranslate(-50, -50);
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -2967,15 +2967,15 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
// perspectiveProjectionAboutCenter * translationByZ is designed so that the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
- WebTransformationMatrix perspectiveProjectionAboutCenter;
- perspectiveProjectionAboutCenter.translate(50, 50);
- perspectiveProjectionAboutCenter.applyPerspective(1);
- perspectiveProjectionAboutCenter.translate(-50, -50);
- WebTransformationMatrix translationByZ;
- translationByZ.translate3d(0, 0, -1);
+ Transform perspectiveProjectionAboutCenter;
+ perspectiveProjectionAboutCenter.PreconcatTranslate(50, 50);
+ perspectiveProjectionAboutCenter.PreconcatPerspectiveDepth(1);
+ perspectiveProjectionAboutCenter.PreconcatTranslate(-50, -50);
+ Transform translationByZ;
+ translationByZ.PreconcatTranslate3d(0, 0, -1);
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
@@ -3027,7 +3027,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
//
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
@@ -3086,7 +3086,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
{
// Test that hit-testing will only work for the visible portion of a layer, and not
// the entire layer bounds. Here we just test the simple axis-aligned case.
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
@@ -3154,7 +3154,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
//
scoped_ptr<LayerImpl> root = LayerImpl::create(123);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -3171,8 +3171,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setMasksToBounds(true);
- WebTransformationMatrix rotation45DegreesAboutCorner;
- rotation45DegreesAboutCorner.rotate3d(0, 0, 45);
+ Transform rotation45DegreesAboutCorner;
+ MathUtil::rotateEulerAngles(&rotation45DegreesAboutCorner, 0, 0, 45);
position = gfx::PointF(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
bounds = gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100.
@@ -3180,12 +3180,12 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
grandChild->setMasksToBounds(true);
// Rotates about the center of the layer
- WebTransformationMatrix rotatedLeafTransform;
- rotatedLeafTransform.translate(-10, -10); // cancel out the grandParent's position
- rotatedLeafTransform.rotate3d(0, 0, -45); // cancel out the corner 45-degree rotation of the parent.
- rotatedLeafTransform.translate(50, 50);
- rotatedLeafTransform.rotate3d(0, 0, 45);
- rotatedLeafTransform.translate(-50, -50);
+ Transform rotatedLeafTransform;
+ rotatedLeafTransform.PreconcatTranslate(-10, -10); // cancel out the grandParent's position
+ MathUtil::rotateEulerAngles(&rotatedLeafTransform, 0, 0, -45); // cancel out the corner 45-degree rotation of the parent.
+ rotatedLeafTransform.PreconcatTranslate(50, 50);
+ MathUtil::rotateEulerAngles(&rotatedLeafTransform, 0, 0, 45);
+ rotatedLeafTransform.PreconcatTranslate(-50, -50);
position = gfx::PointF(0, 0);
bounds = gfx::Size(100, 100);
setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, identityMatrix, anchor, position, bounds, false);
@@ -3250,7 +3250,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
{
// This test checks that hit testing code does not accidentally clip to layer
// bounds for a layer that actually does not clip.
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
@@ -3311,7 +3311,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -3414,7 +3414,7 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
//
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
gfx::Size bounds(100, 100);
@@ -3536,7 +3536,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
@@ -3592,14 +3592,14 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForUninvertibl
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix uninvertibleTransform;
- uninvertibleTransform.setM11(0);
- uninvertibleTransform.setM22(0);
- uninvertibleTransform.setM33(0);
- uninvertibleTransform.setM44(0);
- ASSERT_FALSE(uninvertibleTransform.isInvertible());
+ Transform uninvertibleTransform;
+ uninvertibleTransform.matrix().setDouble(0, 0, 0);
+ uninvertibleTransform.matrix().setDouble(1, 1, 0);
+ uninvertibleTransform.matrix().setDouble(2, 2, 0);
+ uninvertibleTransform.matrix().setDouble(3, 3, 0);
+ ASSERT_FALSE(uninvertibleTransform.IsInvertible());
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
gfx::PointF anchor(0, 0);
gfx::PointF position(0, 0);
@@ -3615,7 +3615,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForUninvertibl
// Sanity check the scenario we just created.
ASSERT_EQ(1u, renderSurfaceLayerList.size());
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
- ASSERT_FALSE(root->screenSpaceTransform().isInvertible());
+ ASSERT_FALSE(root->screenSpaceTransform().IsInvertible());
// Hit checking any point should not hit the touch handler region on the layer. If the invertible matrix is
// accidentally ignored and treated like an identity, then the hit testing will
@@ -3653,7 +3653,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSinglePosit
{
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
Region touchHandlerRegion(gfx::Rect(10, 10, 50, 50));
gfx::PointF anchor(0, 0);
gfx::PointF position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
@@ -3711,7 +3711,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
//
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
@@ -3783,7 +3783,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
// be able to hit the touch handler region by scaling the points accordingly.
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
// Set the bounds of the root layer big enough to fit the child when scaled.
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
@@ -3804,8 +3804,8 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSingleLayer
int dummyMaxTextureSize = 512;
float deviceScaleFactor = 3.0f;
float pageScaleFactor = 5.0f;
- WebTransformationMatrix pageScaleTransform;
- pageScaleTransform.scale(pageScaleFactor);
+ Transform pageScaleTransform;
+ pageScaleTransform.PreconcatScale(pageScaleFactor, pageScaleFactor);
root->setImplTransform(pageScaleTransform); // Applying the pageScaleFactor through implTransform.
gfx::Size scaledBoundsForRoot = gfx::ToCeiledSize(gfx::ScaleSize(root->bounds(), deviceScaleFactor * pageScaleFactor));
LayerTreeHostCommon::calculateDrawTransforms(root.get(), scaledBoundsForRoot, deviceScaleFactor, 1, 0, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -3864,7 +3864,7 @@ TEST(LayerTreeHostCommonTest, verifyHitCheckingTouchHandlerRegionsForSimpleClipp
{
// Test that hit-checking will only work for the visible portion of a layer, and not
// the entire layer bounds. Here we just test the simple axis-aligned case.
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
@@ -3949,7 +3949,7 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
{
// Verify draw and screen space transforms of layers not in a surface.
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
@@ -3983,7 +3983,7 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_EQ(1u, renderSurfaceLayerList.size());
// Verify parent transforms
- WebTransformationMatrix expectedParentTransform;
+ Transform expectedParentTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
@@ -3999,8 +3999,8 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
// Verify child and childEmpty transforms. They should match.
- WebTransformationMatrix expectedChildTransform;
- expectedChildTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
+ Transform expectedChildTransform;
+ expectedChildTransform.PreconcatTranslate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, childEmpty->drawTransform());
@@ -4023,10 +4023,10 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childEmptyScreenSpaceRect);
// Verify childNoScale transforms
- WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform();
+ Transform expectedChildNoScaleTransform = child->drawTransform();
// All transforms operate on content rects. The child's content rect
// incorporates device scale, but the childNoScale does not; add it here.
- expectedChildNoScaleTransform.scale(deviceScaleFactor);
+ expectedChildNoScaleTransform.PreconcatScale(deviceScaleFactor, deviceScaleFactor);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform());
}
@@ -4035,7 +4035,7 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
{
// Verify draw and screen space transforms of layers not in a surface.
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(133, 133), true);
@@ -4064,7 +4064,7 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_EQ(1u, renderSurfaceLayerList.size());
// Verify parent transforms
- WebTransformationMatrix expectedParentTransform;
+ Transform expectedParentTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
@@ -4082,7 +4082,7 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
// Verify child transforms
- WebTransformationMatrix expectedChildTransform;
+ Transform expectedChildTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
@@ -4100,10 +4100,10 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
// Verify childNoScale transforms
- WebTransformationMatrix expectedChildNoScaleTransform = child->drawTransform();
+ Transform expectedChildNoScaleTransform = child->drawTransform();
// All transforms operate on content rects. The child's content rect
// incorporates device scale, but the childNoScale does not; add it here.
- expectedChildNoScaleTransform.scale(deviceScaleFactor);
+ expectedChildNoScaleTransform.PreconcatScale(deviceScaleFactor, deviceScaleFactor);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildNoScaleTransform, childNoScale->screenSpaceTransform());
}
@@ -4111,15 +4111,15 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
TEST(LayerTreeHostCommonTest, verifyContentsScale)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
- WebTransformationMatrix parentScaleMatrix;
+ Transform parentScaleMatrix;
const double initialParentScale = 1.75;
- parentScaleMatrix.scale(initialParentScale);
+ parentScaleMatrix.PreconcatScale(initialParentScale, initialParentScale);
- WebTransformationMatrix childScaleMatrix;
+ Transform childScaleMatrix;
const double initialChildScale = 1.25;
- childScaleMatrix.scale(initialChildScale);
+ childScaleMatrix.PreconcatScale(initialChildScale, initialChildScale);
float fixedRasterScale = 2.5;
@@ -4156,8 +4156,8 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
double pageScaleFactor = 1.5;
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
- WebTransformationMatrix pageScaleMatrix;
- pageScaleMatrix.scale(pageScaleFactor);
+ Transform pageScaleMatrix;
+ pageScaleMatrix.PreconcatScale(pageScaleFactor, pageScaleFactor);
parent->setSublayerTransform(pageScaleMatrix);
LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -4170,16 +4170,16 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
// The parent is scaled up and shouldn't need to scale during draw. The child that can scale its contents should
// also not need to scale during draw. This shouldn't change if the child has empty bounds. The other children should.
- EXPECT_FLOAT_EQ(1, parent->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, parent->drawTransform().m22());
- EXPECT_FLOAT_EQ(1, childScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, childScale->drawTransform().m22());
- EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().m22());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, childNoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, childNoScale->drawTransform().m22());
- EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, childNoAutoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, childNoAutoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, childScale->drawTransform().matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, childEmpty->drawTransform().matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, childNoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, childNoScale->drawTransform().matrix().getDouble(1, 1));
+ EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, childNoAutoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(initialParentScale * initialChildScale / fixedRasterScale, childNoAutoScale->drawTransform().matrix().getDouble(1, 1));
// If the transform changes, we expect the contentsScale to remain unchanged.
childScale->setTransform(identityMatrix);
@@ -4199,7 +4199,7 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
pageScaleMatrix = identityMatrix;
- pageScaleMatrix.scale(pageScaleFactor);
+ pageScaleMatrix.PreconcatScale(pageScaleFactor, pageScaleFactor);
parent->setSublayerTransform(pageScaleMatrix);
renderSurfaceLayerList.clear();
@@ -4215,15 +4215,15 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
TEST(LayerTreeHostCommonTest, verifySmallContentsScale)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
- WebTransformationMatrix parentScaleMatrix;
+ Transform parentScaleMatrix;
const double initialParentScale = 1.75;
- parentScaleMatrix.scale(initialParentScale);
+ parentScaleMatrix.PreconcatScale(initialParentScale, initialParentScale);
- WebTransformationMatrix childScaleMatrix;
+ Transform childScaleMatrix;
const double initialChildScale = 0.25;
- childScaleMatrix.scale(initialChildScale);
+ childScaleMatrix.PreconcatScale(initialChildScale, initialChildScale);
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
@@ -4244,8 +4244,8 @@ TEST(LayerTreeHostCommonTest, verifySmallContentsScale)
double pageScaleFactor = 0.01;
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
- WebTransformationMatrix pageScaleMatrix;
- pageScaleMatrix.scale(pageScaleFactor);
+ Transform pageScaleMatrix;
+ pageScaleMatrix.PreconcatScale(pageScaleFactor, pageScaleFactor);
parent->setSublayerTransform(pageScaleMatrix);
LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -4255,9 +4255,9 @@ TEST(LayerTreeHostCommonTest, verifySmallContentsScale)
EXPECT_CONTENTS_SCALE_EQ(deviceScaleFactor * pageScaleFactor * 1, childScale);
// When chilld's total scale becomes >= 1, we should save and use that scale factor.
- childScaleMatrix.makeIdentity();
+ childScaleMatrix.matrix().setIdentity();
const double finalChildScale = 0.75;
- childScaleMatrix.scale(finalChildScale);
+ childScaleMatrix.PreconcatScale(finalChildScale, finalChildScale);
childScale->setTransform(childScaleMatrix);
renderSurfaceLayerList.clear();
@@ -4270,15 +4270,15 @@ TEST(LayerTreeHostCommonTest, verifySmallContentsScale)
TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
- WebTransformationMatrix parentScaleMatrix;
+ Transform parentScaleMatrix;
const double initialParentScale = 2;
- parentScaleMatrix.scale(initialParentScale);
+ parentScaleMatrix.PreconcatScale(initialParentScale, initialParentScale);
- WebTransformationMatrix childScaleMatrix;
+ Transform childScaleMatrix;
const double initialChildScale = 3;
- childScaleMatrix.scale(initialChildScale);
+ childScaleMatrix.PreconcatScale(initialChildScale, initialChildScale);
float fixedRasterScale = 4;
@@ -4341,8 +4341,8 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
double pageScaleFactor = 7;
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
- WebTransformationMatrix pageScaleMatrix;
- pageScaleMatrix.scale(pageScaleFactor);
+ Transform pageScaleMatrix;
+ pageScaleMatrix.PreconcatScale(pageScaleFactor, pageScaleFactor);
parent->setSublayerTransform(pageScaleMatrix);
LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, renderSurfaceLayerList);
@@ -4360,70 +4360,70 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
EXPECT_CONTENTS_SCALE_EQ(1, surfaceNoAutoScaleChildNoScale);
// The parent is scaled up and shouldn't need to scale during draw.
- EXPECT_FLOAT_EQ(1, parent->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, parent->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, parent->drawTransform().matrix().getDouble(1, 1));
// RenderSurfaces should always be 1:1 with their target.
- EXPECT_FLOAT_EQ(1, surfaceScale->renderSurface()->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceScale->renderSurface()->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceScale->renderSurface()->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceScale->renderSurface()->drawTransform().matrix().getDouble(1, 1));
// The surfaceScale can apply contents scale so the layer shouldn't need to scale during draw.
- EXPECT_FLOAT_EQ(1, surfaceScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildScale can apply contents scale so it shouldn't need to scale during draw.
- EXPECT_FLOAT_EQ(1, surfaceScaleChildScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceScaleChildScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceScaleChildScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceScaleChildScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildNoScale can not apply contents scale, so it needs to be scaled during draw.
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceScaleChildNoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceScaleChildNoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceScaleChildNoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceScaleChildNoScale->drawTransform().matrix().getDouble(1, 1));
// RenderSurfaces should always be 1:1 with their target.
- EXPECT_FLOAT_EQ(1, surfaceNoScale->renderSurface()->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceNoScale->renderSurface()->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceNoScale->renderSurface()->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceNoScale->renderSurface()->drawTransform().matrix().getDouble(1, 1));
// The surfaceNoScale layer can not apply contents scale, so it needs to be scaled during draw.
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, surfaceNoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, surfaceNoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, surfaceNoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale, surfaceNoScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildScale can apply contents scale so it shouldn't need to scale during draw.
- EXPECT_FLOAT_EQ(1, surfaceNoScaleChildScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceNoScaleChildScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceNoScaleChildScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceNoScaleChildScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildNoScale can not apply contents scale, so it needs to be scaled during draw.
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoScaleChildNoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoScaleChildNoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoScaleChildNoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoScaleChildNoScale->drawTransform().matrix().getDouble(1, 1));
// RenderSurfaces should always be 1:1 with their target.
- EXPECT_FLOAT_EQ(1, surfaceNoAutoScale->renderSurface()->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceNoAutoScale->renderSurface()->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceNoAutoScale->renderSurface()->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceNoAutoScale->renderSurface()->drawTransform().matrix().getDouble(1, 1));
// The surfaceNoAutoScale layer has a fixed contents scale, so it needs to be scaled during draw.
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale / (deviceScaleFactor * pageScaleFactor * fixedRasterScale), surfaceNoAutoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale / (deviceScaleFactor * pageScaleFactor * fixedRasterScale), surfaceNoAutoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale / (deviceScaleFactor * pageScaleFactor * fixedRasterScale), surfaceNoAutoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale / (deviceScaleFactor * pageScaleFactor * fixedRasterScale), surfaceNoAutoScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildScale can apply contents scale so it shouldn't need to scale during draw.
- EXPECT_FLOAT_EQ(1, surfaceNoAutoScaleChildScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(1, surfaceNoAutoScaleChildScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(1, surfaceNoAutoScaleChildScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(1, surfaceNoAutoScaleChildScale->drawTransform().matrix().getDouble(1, 1));
// The surfaceScaleChildNoScale can not apply contents scale, so it needs to be scaled during draw.
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoAutoScaleChildNoScale->drawTransform().m11());
- EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoAutoScaleChildNoScale->drawTransform().m22());
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoAutoScaleChildNoScale->drawTransform().matrix().getDouble(0, 0));
+ EXPECT_FLOAT_EQ(deviceScaleFactor * pageScaleFactor * initialParentScale * initialChildScale * initialChildScale, surfaceNoAutoScaleChildNoScale->drawTransform().matrix().getDouble(1, 1));
}
TEST(LayerTreeHostCommonTest, verifyContentsScaleForAnimatingLayer)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
- WebTransformationMatrix parentScaleMatrix;
+ Transform parentScaleMatrix;
const double initialParentScale = 1.75;
- parentScaleMatrix.scale(initialParentScale);
+ parentScaleMatrix.PreconcatScale(initialParentScale, initialParentScale);
- WebTransformationMatrix childScaleMatrix;
+ Transform childScaleMatrix;
const double initialChildScale = 1.25;
- childScaleMatrix.scale(initialChildScale);
+ childScaleMatrix.PreconcatScale(initialChildScale, initialChildScale);
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
@@ -4459,7 +4459,7 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForAnimatingLayer)
TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(30, 30), true);
@@ -4467,8 +4467,8 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
- WebTransformationMatrix replicaTransform;
- replicaTransform.scaleNonUniform(1, -1);
+ Transform replicaTransform;
+ replicaTransform.PreconcatScale(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
@@ -4496,45 +4496,45 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
// render surface (it needs one because it has a replica layer).
EXPECT_EQ(2u, renderSurfaceLayerList.size());
- WebTransformationMatrix expectedParentTransform;
+ Transform expectedParentTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->screenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
- WebTransformationMatrix expectedDrawTransform;
+ Transform expectedDrawTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, child->drawTransform());
- WebTransformationMatrix expectedScreenSpaceTransform;
- expectedScreenSpaceTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
+ Transform expectedScreenSpaceTransform;
+ expectedScreenSpaceTransform.PreconcatTranslate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedScreenSpaceTransform, child->screenSpaceTransform());
- WebTransformationMatrix expectedDuplicateChildDrawTransform = child->drawTransform();
+ Transform expectedDuplicateChildDrawTransform = child->drawTransform();
EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), duplicateChildNonOwner->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), duplicateChildNonOwner->screenSpaceTransform());
EXPECT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect());
EXPECT_EQ(child->contentBounds(), duplicateChildNonOwner->contentBounds());
- WebTransformationMatrix expectedRenderSurfaceDrawTransform;
- expectedRenderSurfaceDrawTransform.translate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
+ Transform expectedRenderSurfaceDrawTransform;
+ expectedRenderSurfaceDrawTransform.PreconcatTranslate(deviceScaleFactor * child->position().x(), deviceScaleFactor * child->position().y());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedRenderSurfaceDrawTransform, child->renderSurface()->drawTransform());
- WebTransformationMatrix expectedSurfaceDrawTransform;
- expectedSurfaceDrawTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2);
+ Transform expectedSurfaceDrawTransform;
+ expectedSurfaceDrawTransform.PreconcatTranslate(deviceScaleFactor * 2, deviceScaleFactor * 2);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceDrawTransform, child->renderSurface()->drawTransform());
- WebTransformationMatrix expectedSurfaceScreenSpaceTransform;
- expectedSurfaceScreenSpaceTransform.translate(deviceScaleFactor * 2, deviceScaleFactor * 2);
+ Transform expectedSurfaceScreenSpaceTransform;
+ expectedSurfaceScreenSpaceTransform.PreconcatTranslate(deviceScaleFactor * 2, deviceScaleFactor * 2);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedSurfaceScreenSpaceTransform, child->renderSurface()->screenSpaceTransform());
- WebTransformationMatrix expectedReplicaDrawTransform;
- expectedReplicaDrawTransform.setM22(-1);
- expectedReplicaDrawTransform.setM41(6);
- expectedReplicaDrawTransform.setM42(6);
+ Transform expectedReplicaDrawTransform;
+ expectedReplicaDrawTransform.matrix().setDouble(1, 1, -1);
+ expectedReplicaDrawTransform.matrix().setDouble(0, 3, 6);
+ expectedReplicaDrawTransform.matrix().setDouble(1, 3, 6);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaDrawTransform, child->renderSurface()->replicaDrawTransform());
- WebTransformationMatrix expectedReplicaScreenSpaceTransform;
- expectedReplicaScreenSpaceTransform.setM22(-1);
- expectedReplicaScreenSpaceTransform.setM41(6);
- expectedReplicaScreenSpaceTransform.setM42(6);
+ Transform expectedReplicaScreenSpaceTransform;
+ expectedReplicaScreenSpaceTransform.matrix().setDouble(1, 1, -1);
+ expectedReplicaScreenSpaceTransform.matrix().setDouble(0, 3, 6);
+ expectedReplicaScreenSpaceTransform.matrix().setDouble(1, 3, 6);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaScreenSpaceTransform, child->renderSurface()->replicaScreenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaScreenSpaceTransform, child->renderSurface()->replicaScreenSpaceTransform());
}
@@ -4542,7 +4542,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition)
{
MockContentLayerClient delegate;
- WebTransformationMatrix identityMatrix;
+ Transform identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(33, 31), true);
@@ -4550,8 +4550,8 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
- WebTransformationMatrix replicaTransform;
- replicaTransform.scaleNonUniform(1, -1);
+ Transform replicaTransform;
+ replicaTransform.PreconcatScale(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
@@ -4579,7 +4579,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
// render surface (it needs one because it has a replica layer).
EXPECT_EQ(2u, renderSurfaceLayerList.size());
- WebTransformationMatrix identityTransform;
+ Transform identityTransform;
EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->screenSpaceTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, parent->drawTransform());
@@ -4594,12 +4594,12 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->renderSurface()->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityTransform, child->renderSurface()->screenSpaceTransform());
- WebTransformationMatrix expectedReplicaDrawTransform;
- expectedReplicaDrawTransform.setM22(-1);
+ Transform expectedReplicaDrawTransform;
+ expectedReplicaDrawTransform.matrix().setDouble(1, 1, -1);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaDrawTransform, child->renderSurface()->replicaDrawTransform());
- WebTransformationMatrix expectedReplicaScreenSpaceTransform;
- expectedReplicaScreenSpaceTransform.setM22(-1);
+ Transform expectedReplicaScreenSpaceTransform;
+ expectedReplicaScreenSpaceTransform.matrix().setDouble(1, 1, -1);
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedReplicaScreenSpaceTransform, child->renderSurface()->replicaScreenSpaceTransform());
}

Powered by Google App Engine
This is Rietveld 408576698