| OLD | NEW |
| 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/input/main_thread_scrolling_reason.h" | 7 #include "cc/input/main_thread_scrolling_reason.h" |
| 8 #include "cc/proto/property_tree.pb.h" | 8 #include "cc/proto/property_tree.pb.h" |
| 9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 10 #include "cc/trees/clip_node.h" | 10 #include "cc/trees/clip_node.h" |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 EXPECT_TRUE(success); | 823 EXPECT_TRUE(success); |
| 824 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, | 824 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, |
| 825 transform); | 825 transform); |
| 826 | 826 |
| 827 success = tree.ComputeTransformWithDestinationSublayerScale( | 827 success = tree.ComputeTransformWithDestinationSublayerScale( |
| 828 grand_parent_id, grand_child_id, &transform); | 828 grand_parent_id, grand_child_id, &transform); |
| 829 EXPECT_TRUE(success); | 829 EXPECT_TRUE(success); |
| 830 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, | 830 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, |
| 831 transform); | 831 transform); |
| 832 | 832 |
| 833 success = tree.ComputeTransformWithSourceSublayerScale( | 833 success = |
| 834 grand_parent_id, grand_child_id, &transform); | 834 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); |
| 835 const TransformNode* grand_parent_node = tree.Node(grand_parent_id); |
| 836 EXPECT_NE(grand_parent_node->sublayer_scale.x(), 0.f); |
| 837 EXPECT_NE(grand_parent_node->sublayer_scale.y(), 0.f); |
| 838 transform.Scale(1.0 / grand_parent_node->sublayer_scale.x(), |
| 839 1.0 / grand_parent_node->sublayer_scale.y()); |
| 835 EXPECT_TRUE(success); | 840 EXPECT_TRUE(success); |
| 836 EXPECT_TRANSFORMATION_MATRIX_EQ( | 841 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 837 expected_transform_with_source_sublayer_scale, transform); | 842 expected_transform_with_source_sublayer_scale, transform); |
| 838 | 843 |
| 839 // Now compute transform from grand_child to grand_parent. | 844 // Now compute transform from grand_child to grand_parent. |
| 840 expected_transform_without_sublayer_scale.MakeIdentity(); | 845 expected_transform_without_sublayer_scale.MakeIdentity(); |
| 841 expected_transform_without_sublayer_scale.Translate(15.f, 15.f); | 846 expected_transform_without_sublayer_scale.Translate(15.f, 15.f); |
| 842 expected_transform_without_sublayer_scale.Scale(15.f, 15.f); | 847 expected_transform_without_sublayer_scale.Scale(15.f, 15.f); |
| 843 | 848 |
| 844 expected_transform_with_dest_sublayer_scale.MakeIdentity(); | 849 expected_transform_with_dest_sublayer_scale.MakeIdentity(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 856 EXPECT_TRUE(success); | 861 EXPECT_TRUE(success); |
| 857 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, | 862 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, |
| 858 transform); | 863 transform); |
| 859 | 864 |
| 860 success = tree.ComputeTransformWithDestinationSublayerScale( | 865 success = tree.ComputeTransformWithDestinationSublayerScale( |
| 861 grand_child_id, grand_parent_id, &transform); | 866 grand_child_id, grand_parent_id, &transform); |
| 862 EXPECT_TRUE(success); | 867 EXPECT_TRUE(success); |
| 863 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, | 868 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, |
| 864 transform); | 869 transform); |
| 865 | 870 |
| 866 success = tree.ComputeTransformWithSourceSublayerScale( | 871 success = |
| 867 grand_child_id, grand_parent_id, &transform); | 872 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); |
| 873 const TransformNode* grand_child_node = tree.Node(grand_child_id); |
| 874 EXPECT_NE(grand_child_node->sublayer_scale.x(), 0.f); |
| 875 EXPECT_NE(grand_child_node->sublayer_scale.y(), 0.f); |
| 876 transform.Scale(1.0 / grand_child_node->sublayer_scale.x(), |
| 877 1.0 / grand_child_node->sublayer_scale.y()); |
| 868 EXPECT_TRUE(success); | 878 EXPECT_TRUE(success); |
| 869 EXPECT_TRANSFORMATION_MATRIX_EQ( | 879 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 870 expected_transform_with_source_sublayer_scale, transform); | 880 expected_transform_with_source_sublayer_scale, transform); |
| 871 } | 881 } |
| 872 }; | 882 }; |
| 873 | 883 |
| 874 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 884 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 875 PropertyTreeTestComputeTransformWithSublayerScale); | 885 PropertyTreeTestComputeTransformWithSublayerScale); |
| 876 | 886 |
| 877 class PropertyTreeTestComputeTransformToTargetWithZeroSublayerScale | 887 class PropertyTreeTestComputeTransformToTargetWithZeroSublayerScale |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 | 1125 |
| 1116 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1126 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1117 PropertyTreeTestSingularTransformSnapTest); | 1127 PropertyTreeTestSingularTransformSnapTest); |
| 1118 | 1128 |
| 1119 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1129 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1120 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1130 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1121 #undef DIRECT_PROPERTY_TREE_TEST_F | 1131 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1122 | 1132 |
| 1123 } // namespace | 1133 } // namespace |
| 1124 } // namespace cc | 1134 } // namespace cc |
| OLD | NEW |