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_impl.h"
9 #include "cc/trees/occlusion_tracker.h"
13 // A subclass to expose the total current occlusion.
14 class TestOcclusionTracker
: public OcclusionTracker
{
16 explicit TestOcclusionTracker(const gfx::Rect
& screen_scissor_rect
)
17 : OcclusionTracker(screen_scissor_rect
) {}
19 SimpleEnclosedRegion
occlusion_from_inside_target() const {
20 return stack_
.back().occlusion_from_inside_target
;
22 SimpleEnclosedRegion
occlusion_from_outside_target() const {
23 return stack_
.back().occlusion_from_outside_target
;
26 SimpleEnclosedRegion
occlusion_on_contributing_surface_from_inside_target()
28 size_t stack_size
= stack_
.size();
30 return SimpleEnclosedRegion();
31 return stack_
[stack_size
- 2].occlusion_from_inside_target
;
33 SimpleEnclosedRegion
occlusion_on_contributing_surface_from_outside_target()
35 size_t stack_size
= stack_
.size();
37 return SimpleEnclosedRegion();
38 return stack_
[stack_size
- 2].occlusion_from_outside_target
;
41 void set_occlusion_from_outside_target(const SimpleEnclosedRegion
& region
) {
42 stack_
.back().occlusion_from_outside_target
= region
;
44 void set_occlusion_from_inside_target(const SimpleEnclosedRegion
& region
) {
45 stack_
.back().occlusion_from_inside_target
= region
;
48 void set_occlusion_on_contributing_surface_from_outside_target(
49 const SimpleEnclosedRegion
& region
) {
50 size_t stack_size
= stack_
.size();
51 DCHECK_GE(stack_size
, 2u);
52 stack_
[stack_size
- 2].occlusion_from_outside_target
= region
;
54 void set_occlusion_on_contributing_surface_from_inside_target(
55 const SimpleEnclosedRegion
& region
) {
56 size_t stack_size
= stack_
.size();
57 DCHECK_GE(stack_size
, 2u);
58 stack_
[stack_size
- 2].occlusion_from_inside_target
= region
;
64 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_