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

Side by Side Diff: cc/layers/render_surface_unittest.cc

Issue 2857343002: Delete LayerImpl::GetRenderSurface. (Closed)
Patch Set: none Created 3 years, 7 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/layers/render_surface_impl_unittest.cc ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_surface_impl.h" 7 #include "cc/layers/render_surface_impl.h"
8 #include "cc/quads/shared_quad_state.h" 8 #include "cc/quads/shared_quad_state.h"
9 #include "cc/test/fake_compositor_frame_sink.h" 9 #include "cc/test/fake_compositor_frame_sink.h"
10 #include "cc/test/fake_impl_task_runner_provider.h" 10 #include "cc/test/fake_impl_task_runner_provider.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/geometry_test_utils.h" 12 #include "cc/test/geometry_test_utils.h"
13 #include "cc/test/layer_test_common.h"
13 #include "cc/test/mock_occlusion_tracker.h" 14 #include "cc/test/mock_occlusion_tracker.h"
14 #include "cc/test/test_task_graph_runner.h" 15 #include "cc/test/test_task_graph_runner.h"
15 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
16 #include "cc/trees/single_thread_proxy.h" 17 #include "cc/trees/single_thread_proxy.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/gfx/transform.h" 20 #include "ui/gfx/transform.h"
20 21
21 namespace cc { 22 namespace cc {
22 namespace { 23 namespace {
(...skipping 23 matching lines...) Expand all
46 owning_layer->test_properties()->force_render_surface = true; 47 owning_layer->test_properties()->force_render_surface = true;
47 gfx::Rect test_rect(3, 4, 5, 6); 48 gfx::Rect test_rect(3, 4, 5, 6);
48 host_impl.active_tree()->ResetAllChangeTracking(); 49 host_impl.active_tree()->ResetAllChangeTracking();
49 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer)); 50 host_impl.active_tree()->SetRootLayerForTesting(std::move(owning_layer));
50 host_impl.SetVisible(true); 51 host_impl.SetVisible(true);
51 host_impl.InitializeRenderer(compositor_frame_sink.get()); 52 host_impl.InitializeRenderer(compositor_frame_sink.get());
52 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 53 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
53 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); 54 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
54 55
55 RenderSurfaceImpl* render_surface = 56 RenderSurfaceImpl* render_surface =
56 host_impl.active_tree()->root_layer_for_testing()->GetRenderSurface(); 57 GetRenderSurface(host_impl.active_tree()->root_layer_for_testing());
57 ASSERT_TRUE(render_surface); 58 ASSERT_TRUE(render_surface);
58 59
59 // Currently, the content_rect, clip_rect, and 60 // Currently, the content_rect, clip_rect, and
60 // owning_layer->layerPropertyChanged() are the only sources of change. 61 // owning_layer->layerPropertyChanged() are the only sources of change.
61 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect)); 62 EXECUTE_AND_VERIFY_SURFACE_CHANGED(render_surface->SetClipRect(test_rect));
62 EXECUTE_AND_VERIFY_SURFACE_CHANGED( 63 EXECUTE_AND_VERIFY_SURFACE_CHANGED(
63 render_surface->SetContentRectForTesting(test_rect)); 64 render_surface->SetContentRectForTesting(test_rect));
64 65
65 host_impl.active_tree()->SetOpacityMutated( 66 host_impl.active_tree()->SetOpacityMutated(
66 host_impl.active_tree()->root_layer_for_testing()->element_id(), 0.5f); 67 host_impl.active_tree()->root_layer_for_testing()->element_id(), 0.5f);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 owning_layer->test_properties()->blend_mode = blend_mode; 107 owning_layer->test_properties()->blend_mode = blend_mode;
107 108
108 root_layer->test_properties()->AddChild(std::move(owning_layer)); 109 root_layer->test_properties()->AddChild(std::move(owning_layer));
109 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); 110 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer));
110 host_impl.SetVisible(true); 111 host_impl.SetVisible(true);
111 host_impl.InitializeRenderer(compositor_frame_sink.get()); 112 host_impl.InitializeRenderer(compositor_frame_sink.get());
112 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 113 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
113 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); 114 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
114 115
115 ASSERT_TRUE( 116 ASSERT_TRUE(
116 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface()); 117 GetRenderSurface(host_impl.active_tree()->LayerById(owning_layer_id)));
117 RenderSurfaceImpl* render_surface = 118 RenderSurfaceImpl* render_surface =
118 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface(); 119 GetRenderSurface(host_impl.active_tree()->LayerById(owning_layer_id));
119 120
120 gfx::Rect content_rect(0, 0, 50, 50); 121 gfx::Rect content_rect(0, 0, 50, 50);
121 gfx::Rect clip_rect(5, 5, 40, 40); 122 gfx::Rect clip_rect(5, 5, 40, 40);
122 gfx::Transform origin; 123 gfx::Transform origin;
123 origin.Translate(30, 40); 124 origin.Translate(30, 40);
124 125
125 render_surface->SetContentRectForTesting(content_rect); 126 render_surface->SetContentRectForTesting(content_rect);
126 render_surface->SetClipRect(clip_rect); 127 render_surface->SetClipRect(clip_rect);
127 render_surface->SetDrawOpacity(1.f); 128 render_surface->SetDrawOpacity(1.f);
128 render_surface->SetDrawTransform(origin); 129 render_surface->SetDrawTransform(origin);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 owning_layer->test_properties()->force_render_surface = true; 165 owning_layer->test_properties()->force_render_surface = true;
165 166
166 root_layer->test_properties()->AddChild(std::move(owning_layer)); 167 root_layer->test_properties()->AddChild(std::move(owning_layer));
167 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer)); 168 host_impl.active_tree()->SetRootLayerForTesting(std::move(root_layer));
168 host_impl.SetVisible(true); 169 host_impl.SetVisible(true);
169 host_impl.InitializeRenderer(compositor_frame_sink.get()); 170 host_impl.InitializeRenderer(compositor_frame_sink.get());
170 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 171 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
171 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */); 172 host_impl.active_tree()->UpdateDrawProperties(false /* update_lcd_text */);
172 173
173 ASSERT_TRUE( 174 ASSERT_TRUE(
174 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface()); 175 GetRenderSurface(host_impl.active_tree()->LayerById(owning_layer_id)));
175 RenderSurfaceImpl* render_surface = 176 RenderSurfaceImpl* render_surface =
176 host_impl.active_tree()->LayerById(owning_layer_id)->GetRenderSurface(); 177 GetRenderSurface(host_impl.active_tree()->LayerById(owning_layer_id));
177 178
178 gfx::Rect content_rect(0, 0, 50, 50); 179 gfx::Rect content_rect(0, 0, 50, 50);
179 gfx::Transform origin; 180 gfx::Transform origin;
180 origin.Translate(30.0, 40.0); 181 origin.Translate(30.0, 40.0);
181 182
182 render_surface->SetScreenSpaceTransform(origin); 183 render_surface->SetScreenSpaceTransform(origin);
183 render_surface->SetContentRectForTesting(content_rect); 184 render_surface->SetContentRectForTesting(content_rect);
184 185
185 auto pass = render_surface->CreateRenderPass(); 186 auto pass = render_surface->CreateRenderPass();
186 187
187 EXPECT_EQ(2, pass->id); 188 EXPECT_EQ(2, pass->id);
188 EXPECT_EQ(content_rect, pass->output_rect); 189 EXPECT_EQ(content_rect, pass->output_rect);
189 EXPECT_EQ(origin, pass->transform_to_root_target); 190 EXPECT_EQ(origin, pass->transform_to_root_target);
190 } 191 }
191 192
192 } // namespace 193 } // namespace
193 } // namespace cc 194 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_impl_unittest.cc ('k') | cc/test/layer_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698