OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_TREES_OCCLUSION_TRACKER_H_ | 5 #ifndef CC_TREES_OCCLUSION_TRACKER_H_ |
6 #define CC_TREES_OCCLUSION_TRACKER_H_ | 6 #define CC_TREES_OCCLUSION_TRACKER_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
10 #include "cc/base/region.h" | 12 #include "cc/base/region.h" |
11 #include "cc/layers/layer_iterator.h" | 13 #include "cc/layers/layer_iterator.h" |
12 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
13 | 15 |
14 namespace cc { | 16 namespace cc { |
15 class OverdrawMetrics; | 17 class OverdrawMetrics; |
16 class LayerImpl; | 18 class LayerImpl; |
17 class RenderSurfaceImpl; | 19 class RenderSurfaceImpl; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 Region ComputeVisibleRegionInScreen() const { | 88 Region ComputeVisibleRegionInScreen() const { |
87 DCHECK(!stack_.back().target->parent()); | 89 DCHECK(!stack_.back().target->parent()); |
88 return SubtractRegions(screen_space_clip_rect_, | 90 return SubtractRegions(screen_space_clip_rect_, |
89 stack_.back().occlusion_from_inside_target); | 91 stack_.back().occlusion_from_inside_target); |
90 } | 92 } |
91 | 93 |
92 void set_minimum_tracking_size(gfx::Size size) { | 94 void set_minimum_tracking_size(gfx::Size size) { |
93 minimum_tracking_size_ = size; | 95 minimum_tracking_size_ = size; |
94 } | 96 } |
95 | 97 |
96 // The following is used for visualization purposes. | 98 // The following is used for visualization purposes. |
97 void set_occluding_screen_space_rects_container( | 99 void set_occluding_screen_space_rects_container( |
98 std::vector<gfx::Rect>* rects) { | 100 std::vector<gfx::Rect>* rects) { |
99 occluding_screen_space_rects_ = rects; | 101 occluding_screen_space_rects_ = rects; |
100 } | 102 } |
101 void set_non_occluding_screen_space_rects_container( | 103 void set_non_occluding_screen_space_rects_container( |
102 std::vector<gfx::Rect>* rects) { | 104 std::vector<gfx::Rect>* rects) { |
103 non_occluding_screen_space_rects_ = rects; | 105 non_occluding_screen_space_rects_ = rects; |
104 } | 106 } |
105 | 107 |
106 protected: | 108 protected: |
107 struct StackObject { | 109 struct StackObject { |
108 StackObject() : target(0) {} | 110 StackObject() : target(0) {} |
109 StackObject(const LayerType* target) : target(target) {} | 111 explicit StackObject(const LayerType* target) : target(target) {} |
110 const LayerType* target; | 112 const LayerType* target; |
111 Region occlusion_from_outside_target; | 113 Region occlusion_from_outside_target; |
112 Region occlusion_from_inside_target; | 114 Region occlusion_from_inside_target; |
113 }; | 115 }; |
114 | 116 |
115 // The stack holds occluded regions for subtrees in the | 117 // The stack holds occluded regions for subtrees in the |
116 // RenderSurfaceImpl-Layer tree, so that when we leave a subtree we may apply | 118 // RenderSurfaceImpl-Layer tree, so that when we leave a subtree we may apply |
117 // a mask to it, but not to the parts outside the subtree. | 119 // a mask to it, but not to the parts outside the subtree. |
118 // - The first time we see a new subtree under a target, we add that target to | 120 // - The first time we see a new subtree under a target, we add that target to |
119 // the top of the stack. This can happen as a layer representing itself, or as | 121 // the top of the stack. This can happen as a layer representing itself, or as |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; | 164 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; |
163 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; | 165 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; |
164 #if !defined(COMPILER_MSVC) | 166 #if !defined(COMPILER_MSVC) |
165 extern template class OcclusionTrackerBase<Layer, RenderSurface>; | 167 extern template class OcclusionTrackerBase<Layer, RenderSurface>; |
166 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 168 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
167 #endif | 169 #endif |
168 | 170 |
169 } // namespace cc | 171 } // namespace cc |
170 | 172 |
171 #endif // CC_TREES_OCCLUSION_TRACKER_H_ | 173 #endif // CC_TREES_OCCLUSION_TRACKER_H_ |
OLD | NEW |