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
3 // found in the LICENSE file.
5 #ifndef CC_TEST_TEST_OCCLUSION_TRACKER_H_
6 #define CC_TEST_TEST_OCCLUSION_TRACKER_H_
8 #include "cc/layers/render_surface.h"
9 #include "cc/layers/render_surface_impl.h"
10 #include "cc/trees/occlusion_tracker.h"
14 // A subclass to expose the total current occlusion.
15 class TestOcclusionTracker
: public OcclusionTracker
{
17 explicit TestOcclusionTracker(const gfx::Rect
& screen_scissor_rect
)
18 : OcclusionTracker(screen_scissor_rect
) {}
20 SimpleEnclosedRegion
occlusion_from_inside_target() const {
21 return stack_
.back().occlusion_from_inside_target
;
23 SimpleEnclosedRegion
occlusion_from_outside_target() const {
24 return stack_
.back().occlusion_from_outside_target
;
27 SimpleEnclosedRegion
occlusion_on_contributing_surface_from_inside_target()
29 size_t stack_size
= stack_
.size();
31 return SimpleEnclosedRegion();
32 return stack_
[stack_size
- 2].occlusion_from_inside_target
;
34 SimpleEnclosedRegion
occlusion_on_contributing_surface_from_outside_target()
36 size_t stack_size
= stack_
.size();
38 return SimpleEnclosedRegion();
39 return stack_
[stack_size
- 2].occlusion_from_outside_target
;
42 void set_occlusion_from_outside_target(const SimpleEnclosedRegion
& region
) {
43 stack_
.back().occlusion_from_outside_target
= region
;
45 void set_occlusion_from_inside_target(const SimpleEnclosedRegion
& region
) {
46 stack_
.back().occlusion_from_inside_target
= region
;
49 void set_occlusion_on_contributing_surface_from_outside_target(
50 const SimpleEnclosedRegion
& region
) {
51 size_t stack_size
= stack_
.size();
52 DCHECK_GE(stack_size
, 2u);
53 stack_
[stack_size
- 2].occlusion_from_outside_target
= region
;
55 void set_occlusion_on_contributing_surface_from_inside_target(
56 const SimpleEnclosedRegion
& region
) {
57 size_t stack_size
= stack_
.size();
58 DCHECK_GE(stack_size
, 2u);
59 stack_
[stack_size
- 2].occlusion_from_inside_target
= region
;
65 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_