blob: ca8a664fbd7960020a40949baffb3876d00e0e19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_TEST_TEST_OCCLUSION_TRACKER_H_
#define CC_TEST_TEST_OCCLUSION_TRACKER_H_
#include "cc/layers/render_surface.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/trees/occlusion_tracker.h"
namespace cc {
// A subclass to expose the total current occlusion.
template <typename LayerType>
class TestOcclusionTracker : public OcclusionTracker<LayerType> {
public:
explicit TestOcclusionTracker(const gfx::Rect& screen_scissor_rect)
: OcclusionTracker<LayerType>(screen_scissor_rect) {}
SimpleEnclosedRegion occlusion_from_inside_target() const {
return OcclusionTracker<LayerType>::stack_.back()
.occlusion_from_inside_target;
}
SimpleEnclosedRegion occlusion_from_outside_target() const {
return OcclusionTracker<LayerType>::stack_.back()
.occlusion_from_outside_target;
}
SimpleEnclosedRegion occlusion_on_contributing_surface_from_inside_target()
const {
size_t stack_size = OcclusionTracker<LayerType>::stack_.size();
if (stack_size < 2)
return SimpleEnclosedRegion();
return OcclusionTracker<LayerType>::stack_[stack_size - 2]
.occlusion_from_inside_target;
}
SimpleEnclosedRegion occlusion_on_contributing_surface_from_outside_target()
const {
size_t stack_size = OcclusionTracker<LayerType>::stack_.size();
if (stack_size < 2)
return SimpleEnclosedRegion();
return OcclusionTracker<LayerType>::stack_[stack_size - 2]
.occlusion_from_outside_target;
}
void set_occlusion_from_outside_target(const SimpleEnclosedRegion& region) {
OcclusionTracker<LayerType>::stack_.back().occlusion_from_outside_target =
region;
}
void set_occlusion_from_inside_target(const SimpleEnclosedRegion& region) {
OcclusionTracker<LayerType>::stack_.back().occlusion_from_inside_target =
region;
}
void set_occlusion_on_contributing_surface_from_outside_target(
const SimpleEnclosedRegion& region) {
size_t stack_size = OcclusionTracker<LayerType>::stack_.size();
DCHECK_GE(stack_size, 2u);
OcclusionTracker<LayerType>::stack_[stack_size - 2]
.occlusion_from_outside_target = region;
}
void set_occlusion_on_contributing_surface_from_inside_target(
const SimpleEnclosedRegion& region) {
size_t stack_size = OcclusionTracker<LayerType>::stack_.size();
DCHECK_GE(stack_size, 2u);
OcclusionTracker<LayerType>::stack_[stack_size - 2]
.occlusion_from_inside_target = region;
}
};
} // namespace cc
#endif // CC_TEST_TEST_OCCLUSION_TRACKER_H_
|