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

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

Issue 332873005: Rendering context information added to SharedQuadState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rendering context now in Layers, removed is_3d_sorted Created 6 years, 6 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
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/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_impl.h"
6 6
7 #include "cc/layers/heads_up_display_layer_impl.h" 7 #include "cc/layers/heads_up_display_layer_impl.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 gfx::Size bounds(100, 100); 976 gfx::Size bounds(100, 100);
977 SetLayerPropertiesForTesting(root.get(), 977 SetLayerPropertiesForTesting(root.get(),
978 identity_matrix, 978 identity_matrix,
979 transform_origin, 979 transform_origin,
980 position, 980 position,
981 bounds, 981 bounds,
982 true, 982 true,
983 false); 983 false);
984 root->SetDrawsContent(true); 984 root->SetDrawsContent(true);
985 root->SetShouldFlattenTransform(false); 985 root->SetShouldFlattenTransform(false);
986 root->SetIs3dSorted(true); 986 root->SetRenderingContextId(1); // For 3D sorting
danakj 2014/06/15 18:15:36 If every call of this method needs a comment expla
troyhildebrandt 2014/06/17 00:29:43 Changed to Set3dSortingContextId for Layer/LayerIm
987 { 987 {
988 // child 1 and child2 are initialized to overlap between x=50 and x=60. 988 // child 1 and child2 are initialized to overlap between x=50 and x=60.
989 // grand_child is set to overlap both child1 and child2 between y=50 and 989 // grand_child is set to overlap both child1 and child2 between y=50 and
990 // y=60. The expected stacking order is: (front) child2, (second) 990 // y=60. The expected stacking order is: (front) child2, (second)
991 // grand_child, (third) child1, and (back) the root layer behind all other 991 // grand_child, (third) child1, and (back) the root layer behind all other
992 // layers. 992 // layers.
993 993
994 scoped_ptr<LayerImpl> child1 = 994 scoped_ptr<LayerImpl> child1 =
995 LayerImpl::Create(host_impl().active_tree(), 2); 995 LayerImpl::Create(host_impl().active_tree(), 2);
996 scoped_ptr<LayerImpl> child2 = 996 scoped_ptr<LayerImpl> child2 =
997 LayerImpl::Create(host_impl().active_tree(), 3); 997 LayerImpl::Create(host_impl().active_tree(), 3);
998 scoped_ptr<LayerImpl> grand_child1 = 998 scoped_ptr<LayerImpl> grand_child1 =
999 LayerImpl::Create(host_impl().active_tree(), 4); 999 LayerImpl::Create(host_impl().active_tree(), 4);
1000 1000
1001 position = gfx::PointF(10.f, 10.f); 1001 position = gfx::PointF(10.f, 10.f);
1002 bounds = gfx::Size(50, 50); 1002 bounds = gfx::Size(50, 50);
1003 SetLayerPropertiesForTesting(child1.get(), 1003 SetLayerPropertiesForTesting(child1.get(),
1004 identity_matrix, 1004 identity_matrix,
1005 transform_origin, 1005 transform_origin,
1006 position, 1006 position,
1007 bounds, 1007 bounds,
1008 true, 1008 true,
1009 false); 1009 false);
1010 child1->SetDrawsContent(true); 1010 child1->SetDrawsContent(true);
1011 child1->SetShouldFlattenTransform(false); 1011 child1->SetShouldFlattenTransform(false);
1012 child1->SetIs3dSorted(true); 1012 child1->SetRenderingContextId(1); // For 3D sorting
1013 1013
1014 position = gfx::PointF(50.f, 10.f); 1014 position = gfx::PointF(50.f, 10.f);
1015 bounds = gfx::Size(50, 50); 1015 bounds = gfx::Size(50, 50);
1016 gfx::Transform translate_z; 1016 gfx::Transform translate_z;
1017 translate_z.Translate3d(0, 0, -10.f); 1017 translate_z.Translate3d(0, 0, -10.f);
1018 SetLayerPropertiesForTesting(child2.get(), 1018 SetLayerPropertiesForTesting(child2.get(),
1019 translate_z, 1019 translate_z,
1020 transform_origin, 1020 transform_origin,
1021 position, 1021 position,
1022 bounds, 1022 bounds,
1023 true, 1023 true,
1024 false); 1024 false);
1025 child2->SetDrawsContent(true); 1025 child2->SetDrawsContent(true);
1026 child2->SetShouldFlattenTransform(false); 1026 child2->SetShouldFlattenTransform(false);
1027 child2->SetIs3dSorted(true); 1027 child2->SetRenderingContextId(1); // For 3D sorting;
1028 1028
1029 // Remember that grand_child is positioned with respect to its parent (i.e. 1029 // Remember that grand_child is positioned with respect to its parent (i.e.
1030 // child1). In screen space, the intended position is (10, 50), with size 1030 // child1). In screen space, the intended position is (10, 50), with size
1031 // 100 x 50. 1031 // 100 x 50.
1032 position = gfx::PointF(0.f, 40.f); 1032 position = gfx::PointF(0.f, 40.f);
1033 bounds = gfx::Size(100, 50); 1033 bounds = gfx::Size(100, 50);
1034 SetLayerPropertiesForTesting(grand_child1.get(), 1034 SetLayerPropertiesForTesting(grand_child1.get(),
1035 identity_matrix, 1035 identity_matrix,
1036 transform_origin, 1036 transform_origin,
1037 position, 1037 position,
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 1927
1928 test_point = gfx::Point(35, 65); 1928 test_point = gfx::Point(35, 65);
1929 result_layer = 1929 result_layer =
1930 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 1930 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
1931 test_point); 1931 test_point);
1932 EXPECT_FALSE(result_layer); 1932 EXPECT_FALSE(result_layer);
1933 } 1933 }
1934 1934
1935 } // namespace 1935 } // namespace
1936 } // namespace cc 1936 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698