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

Unified Diff: cc/trees/property_tree_unittest.cc

Issue 1096493002: Make TransformTree::CombineTransformsBetween run faster (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment in unit test modified Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree_unittest.cc
diff --git a/cc/trees/property_tree_unittest.cc b/cc/trees/property_tree_unittest.cc
index 8eba77382654ea7f6b310e42d1582293ae3df863..37fd5233a4c6d0563acab59ede853739ce91bc62 100644
--- a/cc/trees/property_tree_unittest.cc
+++ b/cc/trees/property_tree_unittest.cc
@@ -316,4 +316,42 @@ TEST(PropertyTreeTest, ComputeTransformWithSublayerScale) {
transform);
}
+TEST(PropertyTreeTest, FlatteningWhenDestinationHasOnlyFlatAncestors) {
+ // This tests that flattening is performed correctly when
+ // destination and its ancestors are flat, but there are 3d transforms
+ // and flattening between the source and destination.
+ TransformTree tree;
+
+ int parent = tree.Insert(TransformNode(), 0);
+ tree.Node(parent)->data.content_target_id = parent;
+ tree.Node(parent)->data.target_id = parent;
+ tree.Node(parent)->data.local.Translate(2, 2);
+
+ gfx::Transform rotation_about_x;
+ rotation_about_x.RotateAboutXAxis(15);
+
+ int child = tree.Insert(TransformNode(), parent);
+ tree.Node(child)->data.content_target_id = child;
+ tree.Node(child)->data.target_id = child;
+ tree.Node(child)->data.local = rotation_about_x;
+
+
+ int grand_child = tree.Insert(TransformNode(), child);
+ tree.Node(grand_child)->data.content_target_id = grand_child;
+ tree.Node(grand_child)->data.target_id = grand_child;
+ tree.Node(grand_child)->data.flattens_inherited_transform = true;
+
+ ComputeTransforms(&tree);
+
+ gfx::Transform flattened_rotation_about_x = rotation_about_x;
+ flattened_rotation_about_x.FlattenTo2d();
+
+ gfx::Transform grand_child_to_parent;
+ bool success =
+ tree.ComputeTransform(grand_child, parent, &grand_child_to_parent);
+ EXPECT_TRUE(success);
+ EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x,
+ grand_child_to_parent);
+}
+
} // namespace cc
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698