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

Side by Side Diff: cc/trees/occlusion_tracker_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/trees/layer_tree_impl_unittest.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 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/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/base/filter_operation.h" 10 #include "cc/base/filter_operation.h"
11 #include "cc/base/filter_operations.h" 11 #include "cc/base/filter_operations.h"
12 #include "cc/base/math_util.h" 12 #include "cc/base/math_util.h"
13 #include "cc/layers/layer.h" 13 #include "cc/layers/layer.h"
14 #include "cc/layers/layer_impl.h" 14 #include "cc/layers/layer_impl.h"
15 #include "cc/output/copy_output_request.h" 15 #include "cc/output/copy_output_request.h"
16 #include "cc/output/copy_output_result.h" 16 #include "cc/output/copy_output_result.h"
17 #include "cc/test/animation_test_common.h" 17 #include "cc/test/animation_test_common.h"
18 #include "cc/test/fake_impl_task_runner_provider.h" 18 #include "cc/test/fake_impl_task_runner_provider.h"
19 #include "cc/test/fake_layer_tree_host.h" 19 #include "cc/test/fake_layer_tree_host.h"
20 #include "cc/test/fake_layer_tree_host_impl.h" 20 #include "cc/test/fake_layer_tree_host_impl.h"
21 #include "cc/test/geometry_test_utils.h" 21 #include "cc/test/geometry_test_utils.h"
22 #include "cc/test/layer_test_common.h"
22 #include "cc/test/test_occlusion_tracker.h" 23 #include "cc/test/test_occlusion_tracker.h"
23 #include "cc/test/test_task_graph_runner.h" 24 #include "cc/test/test_task_graph_runner.h"
24 #include "cc/trees/layer_tree_host_common.h" 25 #include "cc/trees/layer_tree_host_common.h"
25 #include "cc/trees/single_thread_proxy.h" 26 #include "cc/trees/single_thread_proxy.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 #include "ui/gfx/transform.h" 29 #include "ui/gfx/transform.h"
29 30
30 namespace cc { 31 namespace cc {
31 namespace { 32 namespace {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // layer. Simple wrapper around GetUnoccludedContentRect. 71 // layer. Simple wrapper around GetUnoccludedContentRect.
71 gfx::Rect UnoccludedLayerContentRect(const LayerImpl* layer, 72 gfx::Rect UnoccludedLayerContentRect(const LayerImpl* layer,
72 const gfx::Rect& content_rect) const { 73 const gfx::Rect& content_rect) const {
73 DCHECK(layer->visible_layer_rect().Contains(content_rect)); 74 DCHECK(layer->visible_layer_rect().Contains(content_rect));
74 return this->GetCurrentOcclusionForLayer(layer->DrawTransform()) 75 return this->GetCurrentOcclusionForLayer(layer->DrawTransform())
75 .GetUnoccludedContentRect(content_rect); 76 .GetUnoccludedContentRect(content_rect);
76 } 77 }
77 78
78 gfx::Rect UnoccludedSurfaceContentRect(const LayerImpl* layer, 79 gfx::Rect UnoccludedSurfaceContentRect(const LayerImpl* layer,
79 const gfx::Rect& content_rect) const { 80 const gfx::Rect& content_rect) const {
80 RenderSurfaceImpl* surface = layer->GetRenderSurface(); 81 const RenderSurfaceImpl* surface = GetRenderSurface(layer);
81 return this->GetCurrentOcclusionForContributingSurface( 82 return this->GetCurrentOcclusionForContributingSurface(
82 surface->draw_transform()) 83 surface->draw_transform())
83 .GetUnoccludedContentRect(content_rect); 84 .GetUnoccludedContentRect(content_rect);
84 } 85 }
85 }; 86 };
86 87
87 class OcclusionTrackerTest : public testing::Test { 88 class OcclusionTrackerTest : public testing::Test {
88 protected: 89 protected:
89 explicit OcclusionTrackerTest(bool opaque_layers) 90 explicit OcclusionTrackerTest(bool opaque_layers)
90 : opaque_layers_(opaque_layers), 91 : opaque_layers_(opaque_layers),
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ++(*layer_iterator_); 241 ++(*layer_iterator_);
241 } 242 }
242 243
243 void VisitLayer(LayerImpl* layer, OcclusionTracker* occlusion) { 244 void VisitLayer(LayerImpl* layer, OcclusionTracker* occlusion) {
244 EnterLayer(layer, occlusion); 245 EnterLayer(layer, occlusion);
245 LeaveLayer(layer, occlusion); 246 LeaveLayer(layer, occlusion);
246 } 247 }
247 248
248 void EnterContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) { 249 void EnterContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) {
249 ASSERT_EQ(layer_iterator_->target_render_surface(), 250 ASSERT_EQ(layer_iterator_->target_render_surface(),
250 layer->GetRenderSurface()); 251 GetRenderSurface(layer));
251 ASSERT_TRUE(layer_iterator_->state() == 252 ASSERT_TRUE(layer_iterator_->state() ==
252 EffectTreeLayerListIterator::State::TARGET_SURFACE); 253 EffectTreeLayerListIterator::State::TARGET_SURFACE);
253 occlusion->EnterLayer(*layer_iterator_); 254 occlusion->EnterLayer(*layer_iterator_);
254 occlusion->LeaveLayer(*layer_iterator_); 255 occlusion->LeaveLayer(*layer_iterator_);
255 ++(*layer_iterator_); 256 ++(*layer_iterator_);
256 ASSERT_TRUE(layer_iterator_->state() == 257 ASSERT_TRUE(layer_iterator_->state() ==
257 EffectTreeLayerListIterator::State::CONTRIBUTING_SURFACE); 258 EffectTreeLayerListIterator::State::CONTRIBUTING_SURFACE);
258 occlusion->EnterLayer(*layer_iterator_); 259 occlusion->EnterLayer(*layer_iterator_);
259 } 260 }
260 261
261 void LeaveContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) { 262 void LeaveContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) {
262 ASSERT_EQ(layer_iterator_->current_render_surface(), 263 ASSERT_EQ(layer_iterator_->current_render_surface(),
263 layer->GetRenderSurface()); 264 GetRenderSurface(layer));
264 ASSERT_TRUE(layer_iterator_->state() == 265 ASSERT_TRUE(layer_iterator_->state() ==
265 EffectTreeLayerListIterator::State::CONTRIBUTING_SURFACE); 266 EffectTreeLayerListIterator::State::CONTRIBUTING_SURFACE);
266 occlusion->LeaveLayer(*layer_iterator_); 267 occlusion->LeaveLayer(*layer_iterator_);
267 ++(*layer_iterator_); 268 ++(*layer_iterator_);
268 } 269 }
269 270
270 void VisitContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) { 271 void VisitContributingSurface(LayerImpl* layer, OcclusionTracker* occlusion) {
271 EnterContributingSurface(layer, occlusion); 272 EnterContributingSurface(layer, occlusion);
272 LeaveContributingSurface(layer, occlusion); 273 LeaveContributingSurface(layer, occlusion);
273 } 274 }
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 EXPECT_EQ(gfx::Rect(), 2433 EXPECT_EQ(gfx::Rect(),
2433 occlusion.UnoccludedSurfaceContentRect( 2434 occlusion.UnoccludedSurfaceContentRect(
2434 surface, gfx::Rect(80, 70, 50, 50))); 2435 surface, gfx::Rect(80, 70, 50, 50)));
2435 } 2436 }
2436 }; 2437 };
2437 2438
2438 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 2439 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
2439 2440
2440 } // namespace 2441 } // namespace
2441 } // namespace cc 2442 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698