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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « cc/trees/property_tree.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/property_tree.h" 5 #include "cc/trees/property_tree.h"
6 6
7 #include "cc/test/geometry_test_utils.h" 7 #include "cc/test/geometry_test_utils.h"
8 #include "cc/trees/draw_property_utils.h" 8 #include "cc/trees/draw_property_utils.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, 309 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale,
310 transform); 310 transform);
311 311
312 success = tree.ComputeTransformWithSourceSublayerScale( 312 success = tree.ComputeTransformWithSourceSublayerScale(
313 grand_child_id, grand_parent_id, &transform); 313 grand_child_id, grand_parent_id, &transform);
314 EXPECT_TRUE(success); 314 EXPECT_TRUE(success);
315 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_source_sublayer_scale, 315 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_source_sublayer_scale,
316 transform); 316 transform);
317 } 317 }
318 318
319 TEST(PropertyTreeTest, FlatteningWhenDestinationHasOnlyFlatAncestors) {
320 // This tests that flattening is performed correctly when
321 // destination and its ancestors are flat, but there are 3d transforms
322 // and flattening between the source and destination.
323 TransformTree tree;
324
325 int parent = tree.Insert(TransformNode(), 0);
326 tree.Node(parent)->data.content_target_id = parent;
327 tree.Node(parent)->data.target_id = parent;
328 tree.Node(parent)->data.local.Translate(2, 2);
329
330 gfx::Transform rotation_about_x;
331 rotation_about_x.RotateAboutXAxis(15);
332
333 int child = tree.Insert(TransformNode(), parent);
334 tree.Node(child)->data.content_target_id = child;
335 tree.Node(child)->data.target_id = child;
336 tree.Node(child)->data.local = rotation_about_x;
337
338
339 int grand_child = tree.Insert(TransformNode(), child);
340 tree.Node(grand_child)->data.content_target_id = grand_child;
341 tree.Node(grand_child)->data.target_id = grand_child;
342 tree.Node(grand_child)->data.flattens_inherited_transform = true;
343
344 ComputeTransforms(&tree);
345
346 gfx::Transform flattened_rotation_about_x = rotation_about_x;
347 flattened_rotation_about_x.FlattenTo2d();
348
349 gfx::Transform grand_child_to_parent;
350 bool success =
351 tree.ComputeTransform(grand_child, parent, &grand_child_to_parent);
352 EXPECT_TRUE(success);
353 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x,
354 grand_child_to_parent);
355 }
356
319 } // namespace cc 357 } // namespace cc
OLDNEW
« 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