OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layers/append_quads_data.h" | 5 #include "cc/layers/append_quads_data.h" |
6 #include "cc/layers/layer_impl.h" | 6 #include "cc/layers/layer_impl.h" |
7 #include "cc/layers/render_pass_sink.h" | 7 #include "cc/layers/render_pass_sink.h" |
8 #include "cc/layers/render_surface_impl.h" | 8 #include "cc/layers/render_surface_impl.h" |
9 #include "cc/quads/shared_quad_state.h" | 9 #include "cc/quads/shared_quad_state.h" |
10 #include "cc/test/fake_compositor_frame_sink.h" | 10 #include "cc/test/fake_compositor_frame_sink.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 owning_layer->test_properties()->force_render_surface = true; | 47 owning_layer->test_properties()->force_render_surface = true; |
48 gfx::Rect test_rect(3, 4, 5, 6); | 48 gfx::Rect test_rect(3, 4, 5, 6); |
49 host_impl.active_tree()->ResetAllChangeTracking(); | 49 host_impl.active_tree()->ResetAllChangeTracking(); |
50 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); | 50 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); |
51 host_impl.SetVisible(true); | 51 host_impl.SetVisible(true); |
52 host_impl.InitializeRenderer(compositor_frame_sink.get()); | 52 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
53 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 53 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
54 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 54 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
55 | 55 |
56 RenderSurfaceImpl* render_surface = | 56 RenderSurfaceImpl* render_surface = |
57 host_impl.active_tree()->root_layer_for_testing()->render_surface(); | 57 host_impl.active_tree()->root_layer_for_testing()->GetRenderSurface(); |
58 ASSERT_TRUE(render_surface); | 58 ASSERT_TRUE(render_surface); |
59 | 59 |
60 // Currently, the content_rect, clip_rect, and | 60 // Currently, the content_rect, clip_rect, and |
61 // owning_layer->layerPropertyChanged() are the only sources of change. | 61 // owning_layer->layerPropertyChanged() are the only sources of change. |
62 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); | 62 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); |
63 EXECUTE_AND_VERIFY_SURFACE_CHANGED( | 63 EXECUTE_AND_VERIFY_SURFACE_CHANGED( |
64 render_surface->SetContentRectForTesting(test_rect)); | 64 render_surface->SetContentRectForTesting(test_rect)); |
65 | 65 |
66 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( | 66 host_impl.active_tree()->property_trees()->effect_tree.OnOpacityAnimated( |
67 0.5f, | 67 0.5f, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 owning_layer->test_properties()->blend_mode = blend_mode; | 110 owning_layer->test_properties()->blend_mode = blend_mode; |
111 | 111 |
112 root_layer->test_properties()->AddChild(std::move(owning_layer)); | 112 root_layer->test_properties()->AddChild(std::move(owning_layer)); |
113 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 113 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
114 host_impl.SetVisible(true); | 114 host_impl.SetVisible(true); |
115 host_impl.InitializeRenderer(compositor_frame_sink.get()); | 115 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
116 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 116 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
117 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 117 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
118 | 118 |
119 ASSERT_TRUE( | 119 ASSERT_TRUE( |
120 host_impl.active_tree()->LayerById(owning_layer_id)->render_surface()); | 120 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface()); |
121 RenderSurfaceImpl* render_surface = | 121 RenderSurfaceImpl* render_surface = |
122 host_impl.active_tree()->LayerById(owning_layer_id)->render_surface(); | 122 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface(); |
123 | 123 |
124 gfx::Rect content_rect(0, 0, 50, 50); | 124 gfx::Rect content_rect(0, 0, 50, 50); |
125 gfx::Rect clip_rect(5, 5, 40, 40); | 125 gfx::Rect clip_rect(5, 5, 40, 40); |
126 gfx::Transform origin; | 126 gfx::Transform origin; |
127 origin.Translate(30, 40); | 127 origin.Translate(30, 40); |
128 | 128 |
129 render_surface->SetContentRectForTesting(content_rect); | 129 render_surface->SetContentRectForTesting(content_rect); |
130 render_surface->SetClipRect(clip_rect); | 130 render_surface->SetClipRect(clip_rect); |
131 render_surface->SetDrawOpacity(1.f); | 131 render_surface->SetDrawOpacity(1.f); |
132 render_surface->SetDrawTransform(origin); | 132 render_surface->SetDrawTransform(origin); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 owning_layer->test_properties()->force_render_surface = true; | 181 owning_layer->test_properties()->force_render_surface = true; |
182 | 182 |
183 root_layer->test_properties()->AddChild(std::move(owning_layer)); | 183 root_layer->test_properties()->AddChild(std::move(owning_layer)); |
184 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); | 184 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); |
185 host_impl.SetVisible(true); | 185 host_impl.SetVisible(true); |
186 host_impl.InitializeRenderer(compositor_frame_sink.get()); | 186 host_impl.InitializeRenderer(compositor_frame_sink.get()); |
187 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 187 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
188 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 188 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
189 | 189 |
190 ASSERT_TRUE( | 190 ASSERT_TRUE( |
191 host_impl.active_tree()->LayerById(owning_layer_id)->render_surface()); | 191 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface()); |
192 RenderSurfaceImpl* render_surface = | 192 RenderSurfaceImpl* render_surface = |
193 host_impl.active_tree()->LayerById(owning_layer_id)->render_surface(); | 193 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface(); |
194 | 194 |
195 gfx::Rect content_rect(0, 0, 50, 50); | 195 gfx::Rect content_rect(0, 0, 50, 50); |
196 gfx::Transform origin; | 196 gfx::Transform origin; |
197 origin.Translate(30.0, 40.0); | 197 origin.Translate(30.0, 40.0); |
198 | 198 |
199 render_surface->SetScreenSpaceTransform(origin); | 199 render_surface->SetScreenSpaceTransform(origin); |
200 render_surface->SetContentRectForTesting(content_rect); | 200 render_surface->SetContentRectForTesting(content_rect); |
201 | 201 |
202 TestRenderPassSink pass_sink; | 202 TestRenderPassSink pass_sink; |
203 | 203 |
204 render_surface->AppendRenderPasses(&pass_sink); | 204 render_surface->AppendRenderPasses(&pass_sink); |
205 | 205 |
206 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); | 206 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); |
207 RenderPass* pass = pass_sink.RenderPasses()[0].get(); | 207 RenderPass* pass = pass_sink.RenderPasses()[0].get(); |
208 | 208 |
209 EXPECT_EQ(2, pass->id); | 209 EXPECT_EQ(2, pass->id); |
210 EXPECT_EQ(content_rect, pass->output_rect); | 210 EXPECT_EQ(content_rect, pass->output_rect); |
211 EXPECT_EQ(origin, pass->transform_to_root_target); | 211 EXPECT_EQ(origin, pass->transform_to_root_target); |
212 } | 212 } |
213 | 213 |
214 } // namespace | 214 } // namespace |
215 } // namespace cc | 215 } // namespace cc |
OLD | NEW |