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 template <typename LayerType
>
16 class TestOcclusionTracker
: public OcclusionTracker
<LayerType
> {
18 explicit TestOcclusionTracker(const gfx::Rect
& screen_scissor_rect
)
19 : OcclusionTracker
<LayerType
>(screen_scissor_rect
) {}
21 Region
occlusion_from_inside_target() const {
22 return OcclusionTracker
<LayerType
>::stack_
.back()
23 .occlusion_from_inside_target
;
25 Region
occlusion_from_outside_target() const {
26 return OcclusionTracker
<LayerType
>::stack_
.back()
27 .occlusion_from_outside_target
;
30 Region
occlusion_on_contributing_surface_from_inside_target() const {
31 size_t stack_size
= OcclusionTracker
<LayerType
>::stack_
.size();
34 return OcclusionTracker
<LayerType
>::stack_
[stack_size
- 2]
35 .occlusion_from_inside_target
;
37 Region
occlusion_on_contributing_surface_from_outside_target() const {
38 size_t stack_size
= OcclusionTracker
<LayerType
>::stack_
.size();
41 return OcclusionTracker
<LayerType
>::stack_
[stack_size
- 2]
42 .occlusion_from_outside_target
;
45 void set_occlusion_from_outside_target(const Region
& region
) {
46 OcclusionTracker
<LayerType
>::stack_
.back().occlusion_from_outside_target
=
49 void set_occlusion_from_inside_target(const Region
& region
) {
50 OcclusionTracker
<LayerType
>::stack_
.back().occlusion_from_inside_target
=
57 #endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_