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

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

Issue 1868003002: cc: Move RenderTarget Information to Effect Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/layers/picture_layer.h" 8 #include "cc/layers/picture_layer.h"
9 #include "cc/test/fake_content_layer_client.h" 9 #include "cc/test/fake_content_layer_client.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 101 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
102 102
103 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 103 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
104 LayerImpl* root = impl->active_tree()->root_layer(); 104 LayerImpl* root = impl->active_tree()->root_layer();
105 LayerImpl* child = root->children()[0]; 105 LayerImpl* child = root->children()[0];
106 RenderSurfaceImpl* surface = child->render_surface(); 106 RenderSurfaceImpl* surface = child->render_surface();
107 107
108 // Verify the draw properties are valid. 108 // Verify the draw properties are valid.
109 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); 109 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember());
110 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); 110 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember());
111 EXPECT_EQ(child, child->render_target()); 111 EXPECT_TRUE(child->has_render_surface());
112 EXPECT_EQ(child->render_surface(), child->render_target());
112 113
113 EXPECT_OCCLUSION_EQ( 114 EXPECT_OCCLUSION_EQ(
114 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), 115 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(),
115 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), 116 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))),
116 surface->occlusion_in_content_space()); 117 surface->occlusion_in_content_space());
117 EndTest(); 118 EndTest();
118 } 119 }
119 120
120 void AfterTest() override {} 121 void AfterTest() override {}
121 }; 122 };
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 166
166 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 167 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
167 LayerImpl* root = impl->active_tree()->root_layer(); 168 LayerImpl* root = impl->active_tree()->root_layer();
168 LayerImpl* child = root->children()[0]; 169 LayerImpl* child = root->children()[0];
169 RenderSurfaceImpl* surface = child->render_surface(); 170 RenderSurfaceImpl* surface = child->render_surface();
170 LayerImpl* mask = child->mask_layer(); 171 LayerImpl* mask = child->mask_layer();
171 172
172 // Verify the draw properties are valid. 173 // Verify the draw properties are valid.
173 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); 174 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember());
174 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); 175 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember());
175 EXPECT_EQ(child, child->render_target()); 176 EXPECT_TRUE(child->has_render_surface());
177 EXPECT_EQ(child->render_surface(), child->render_target());
176 178
177 gfx::Transform transform = surface->draw_transform(); 179 gfx::Transform transform = surface->draw_transform();
178 transform.PreconcatTransform(child->DrawTransform()); 180 transform.PreconcatTransform(child->DrawTransform());
179 181
180 EXPECT_OCCLUSION_EQ( 182 EXPECT_OCCLUSION_EQ(
181 Occlusion(transform, SimpleEnclosedRegion(), 183 Occlusion(transform, SimpleEnclosedRegion(),
182 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), 184 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))),
183 mask->draw_properties().occlusion_in_content_space); 185 mask->draw_properties().occlusion_in_content_space);
184 EndTest(); 186 EndTest();
185 } 187 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 304
303 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 305 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
304 LayerImpl* root = impl->active_tree()->root_layer(); 306 LayerImpl* root = impl->active_tree()->root_layer();
305 LayerImpl* child = root->children()[0]; 307 LayerImpl* child = root->children()[0];
306 RenderSurfaceImpl* surface = child->render_surface(); 308 RenderSurfaceImpl* surface = child->render_surface();
307 LayerImpl* mask = child->mask_layer(); 309 LayerImpl* mask = child->mask_layer();
308 310
309 // Verify the draw properties are valid. 311 // Verify the draw properties are valid.
310 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember()); 312 EXPECT_TRUE(root->IsDrawnRenderSurfaceLayerListMember());
311 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember()); 313 EXPECT_TRUE(child->IsDrawnRenderSurfaceLayerListMember());
312 EXPECT_EQ(child, child->render_target()); 314 EXPECT_TRUE(child->has_render_surface());
315 EXPECT_EQ(child->render_surface(), child->render_target());
313 316
314 // No occlusion from on child, which is part of the replica. 317 // No occlusion from on child, which is part of the replica.
315 EXPECT_OCCLUSION_EQ(Occlusion(), 318 EXPECT_OCCLUSION_EQ(Occlusion(),
316 child->draw_properties().occlusion_in_content_space); 319 child->draw_properties().occlusion_in_content_space);
317 // Occlusion on the surface is okay. 320 // Occlusion on the surface is okay.
318 EXPECT_OCCLUSION_EQ( 321 EXPECT_OCCLUSION_EQ(
319 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(), 322 Occlusion(surface->draw_transform(), SimpleEnclosedRegion(),
320 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))), 323 SimpleEnclosedRegion(gfx::Rect(13, 9, 10, 11))),
321 surface->occlusion_in_content_space()); 324 surface->occlusion_in_content_space());
322 // No occlusion on the replica'd mask. 325 // No occlusion on the replica'd mask.
323 EXPECT_OCCLUSION_EQ(Occlusion(), 326 EXPECT_OCCLUSION_EQ(Occlusion(),
324 mask->draw_properties().occlusion_in_content_space); 327 mask->draw_properties().occlusion_in_content_space);
325 EndTest(); 328 EndTest();
326 } 329 }
327 330
328 void AfterTest() override {} 331 void AfterTest() override {}
329 332
330 FakeContentLayerClient client_; 333 FakeContentLayerClient client_;
331 }; 334 };
332 335
333 SINGLE_AND_MULTI_THREAD_TEST_F( 336 SINGLE_AND_MULTI_THREAD_TEST_F(
334 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); 337 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica);
335 338
336 } // namespace 339 } // namespace
337 } // namespace cc 340 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698