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

Side by Side Diff: cc/test/mock_occlusion_tracker.h

Issue 306683002: MockQC stops create its own RP and MockOcclusionTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testocclusiontracking
Patch Set: rebase 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
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/test/mock_quad_culler.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 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 #ifndef CC_TEST_MOCK_OCCLUSION_TRACKER_H_ 5 #ifndef CC_TEST_MOCK_OCCLUSION_TRACKER_H_
6 #define CC_TEST_MOCK_OCCLUSION_TRACKER_H_ 6 #define CC_TEST_MOCK_OCCLUSION_TRACKER_H_
7 7
8 #include "cc/trees/occlusion_tracker.h" 8 #include "cc/trees/occlusion_tracker.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 template <typename LayerType> 12 template <typename LayerType>
13 class MockOcclusionTracker : public OcclusionTracker<LayerType> { 13 class MockOcclusionTracker : public OcclusionTracker<LayerType> {
14 // This class is used for testing only. It fakes just enough information to 14 // This class is used for testing only. It fakes just enough information to
15 // calculate unoccluded content rect and unoccluded contributing surface 15 // calculate unoccluded content rect and unoccluded contributing surface
16 // content rect. It calls the helper function of occlusion tracker to avoid 16 // content rect. It calls the helper function of occlusion tracker to avoid
17 // DCHECKs since testing environment won't be set up properly to pass those. 17 // DCHECKs since testing environment won't be set up properly to pass those.
18 public: 18 public:
19 MockOcclusionTracker()
20 : OcclusionTracker<LayerType>(gfx::Rect(0, 0, 1000, 1000)) {
21 typename OcclusionTracker<LayerType>::StackObject stack_obj;
22 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
23 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
24 }
25
19 explicit MockOcclusionTracker(const gfx::Rect& screen_scissor_rect) 26 explicit MockOcclusionTracker(const gfx::Rect& screen_scissor_rect)
20 : OcclusionTracker<LayerType>(screen_scissor_rect) { 27 : OcclusionTracker<LayerType>(screen_scissor_rect) {
21 typename OcclusionTracker<LayerType>::StackObject stack_obj; 28 typename OcclusionTracker<LayerType>::StackObject stack_obj;
22 OcclusionTracker<LayerType>::stack_.push_back(stack_obj); 29 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
23 OcclusionTracker<LayerType>::stack_.push_back(stack_obj); 30 OcclusionTracker<LayerType>::stack_.push_back(stack_obj);
24 } 31 }
25 32
26 void set_occluded_target_rect(const gfx::Rect& occluded) { 33 void set_occluded_target_rect(const gfx::Rect& occluded) {
27 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target = 34 OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target =
28 occluded; 35 occluded;
29 } 36 }
30 37
31 void set_occluded_target_rect_for_contributing_surface( 38 void set_occluded_target_rect_for_contributing_surface(
32 const gfx::Rect& occluded) { 39 const gfx::Rect& occluded) {
33 OcclusionTracker< 40 OcclusionTracker<
34 LayerType>::stack_[OcclusionTracker<LayerType>::stack_.size() - 2] 41 LayerType>::stack_[OcclusionTracker<LayerType>::stack_.size() - 2]
35 .occlusion_from_inside_target = occluded; 42 .occlusion_from_inside_target = occluded;
36 } 43 }
37 }; 44 };
38 45
39 } // namespace cc 46 } // namespace cc
40 47
41 #endif // CC_TEST_MOCK_OCCLUSION_TRACKER_H_ 48 #endif // CC_TEST_MOCK_OCCLUSION_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/test/mock_quad_culler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698