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

Side by Side Diff: cc/trees/property_tree_unittest.cc

Issue 2168753002: cc : Use sublayer scale from effect tree (4) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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/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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 -15.f); 821 -15.f);
822 expected_transform_with_source_surface_contents_scale.Scale(0.5f, 0.5f); 822 expected_transform_with_source_surface_contents_scale.Scale(0.5f, 0.5f);
823 823
824 gfx::Transform transform; 824 gfx::Transform transform;
825 bool success = 825 bool success =
826 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); 826 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform);
827 EXPECT_TRUE(success); 827 EXPECT_TRUE(success);
828 EXPECT_TRANSFORMATION_MATRIX_EQ( 828 EXPECT_TRANSFORMATION_MATRIX_EQ(
829 expected_transform_without_surface_contents_scale, transform); 829 expected_transform_without_surface_contents_scale, transform);
830 830
831 success = tree.ComputeTransformWithDestinationSurfaceContentsScale( 831 success =
832 grand_parent_id, grand_child_id, &transform); 832 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform);
833 const TransformNode* grand_child_node = tree.Node(grand_child_id);
834 transform.matrix().postScale(grand_child_node->surface_contents_scale.x(),
835 grand_child_node->surface_contents_scale.y(),
836 1.f);
833 EXPECT_TRUE(success); 837 EXPECT_TRUE(success);
834 EXPECT_TRANSFORMATION_MATRIX_EQ( 838 EXPECT_TRANSFORMATION_MATRIX_EQ(
835 expected_transform_with_dest_surface_contents_scale, transform); 839 expected_transform_with_dest_surface_contents_scale, transform);
836 840
837 success = 841 success =
838 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); 842 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform);
839 const TransformNode* grand_parent_node = tree.Node(grand_parent_id); 843 const TransformNode* grand_parent_node = tree.Node(grand_parent_id);
840 EXPECT_NE(grand_parent_node->surface_contents_scale.x(), 0.f); 844 EXPECT_NE(grand_parent_node->surface_contents_scale.x(), 0.f);
841 EXPECT_NE(grand_parent_node->surface_contents_scale.y(), 0.f); 845 EXPECT_NE(grand_parent_node->surface_contents_scale.y(), 0.f);
842 transform.Scale(1.0 / grand_parent_node->surface_contents_scale.x(), 846 transform.Scale(1.0 / grand_parent_node->surface_contents_scale.x(),
(...skipping 17 matching lines...) Expand all
860 expected_transform_with_source_surface_contents_scale.Scale(15.f, 15.f); 864 expected_transform_with_source_surface_contents_scale.Scale(15.f, 15.f);
861 expected_transform_with_source_surface_contents_scale.Scale(1.f / 30.f, 865 expected_transform_with_source_surface_contents_scale.Scale(1.f / 30.f,
862 1.f / 30.f); 866 1.f / 30.f);
863 867
864 success = 868 success =
865 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); 869 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform);
866 EXPECT_TRUE(success); 870 EXPECT_TRUE(success);
867 EXPECT_TRANSFORMATION_MATRIX_EQ( 871 EXPECT_TRANSFORMATION_MATRIX_EQ(
868 expected_transform_without_surface_contents_scale, transform); 872 expected_transform_without_surface_contents_scale, transform);
869 873
870 success = tree.ComputeTransformWithDestinationSurfaceContentsScale( 874 success =
871 grand_child_id, grand_parent_id, &transform); 875 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform);
876 transform.matrix().postScale(grand_parent_node->surface_contents_scale.x(),
877 grand_parent_node->surface_contents_scale.y(),
878 1.f);
872 EXPECT_TRUE(success); 879 EXPECT_TRUE(success);
873 EXPECT_TRANSFORMATION_MATRIX_EQ( 880 EXPECT_TRANSFORMATION_MATRIX_EQ(
874 expected_transform_with_dest_surface_contents_scale, transform); 881 expected_transform_with_dest_surface_contents_scale, transform);
875 882
876 success = 883 success =
877 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); 884 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform);
878 const TransformNode* grand_child_node = tree.Node(grand_child_id);
879 EXPECT_NE(grand_child_node->surface_contents_scale.x(), 0.f); 885 EXPECT_NE(grand_child_node->surface_contents_scale.x(), 0.f);
880 EXPECT_NE(grand_child_node->surface_contents_scale.y(), 0.f); 886 EXPECT_NE(grand_child_node->surface_contents_scale.y(), 0.f);
881 transform.Scale(1.0 / grand_child_node->surface_contents_scale.x(), 887 transform.Scale(1.0 / grand_child_node->surface_contents_scale.x(),
882 1.0 / grand_child_node->surface_contents_scale.y()); 888 1.0 / grand_child_node->surface_contents_scale.y());
883 EXPECT_TRUE(success); 889 EXPECT_TRUE(success);
884 EXPECT_TRANSFORMATION_MATRIX_EQ( 890 EXPECT_TRANSFORMATION_MATRIX_EQ(
885 expected_transform_with_source_surface_contents_scale, transform); 891 expected_transform_with_source_surface_contents_scale, transform);
886 } 892 }
887 }; 893 };
888 894
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 1136
1131 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( 1137 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(
1132 PropertyTreeTestSingularTransformSnapTest); 1138 PropertyTreeTestSingularTransformSnapTest);
1133 1139
1134 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F 1140 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F
1135 #undef SERIALIZED_PROPERTY_TREE_TEST_F 1141 #undef SERIALIZED_PROPERTY_TREE_TEST_F
1136 #undef DIRECT_PROPERTY_TREE_TEST_F 1142 #undef DIRECT_PROPERTY_TREE_TEST_F
1137 1143
1138 } // namespace 1144 } // namespace
1139 } // namespace cc 1145 } // 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