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> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // once finished with the layer, occlusion behind the layer should be marked by | 30 // once finished with the layer, occlusion behind the layer should be marked by |
31 // calling MarkOccludedBehindLayer(). | 31 // calling MarkOccludedBehindLayer(). |
32 template <typename LayerType, typename RenderSurfaceType> | 32 template <typename LayerType, typename RenderSurfaceType> |
33 class CC_EXPORT OcclusionTrackerBase { | 33 class CC_EXPORT OcclusionTrackerBase { |
34 public: | 34 public: |
35 OcclusionTrackerBase(gfx::Rect screen_space_clip_rect, | 35 OcclusionTrackerBase(gfx::Rect screen_space_clip_rect, |
36 bool record_metrics_for_frame); | 36 bool record_metrics_for_frame); |
37 ~OcclusionTrackerBase(); | 37 ~OcclusionTrackerBase(); |
38 | 38 |
39 // Called at the beginning of each step in the LayerIterator's front-to-back | 39 // Called at the beginning of each step in the LayerIterator's front-to-back |
40 // traversal. If |prevent_occlusion| is true, the layer will be considered | 40 // traversal. |
41 // unoccluded. | 41 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); |
42 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator, | |
43 bool prevent_occlusion); | |
44 // Called at the end of each step in the LayerIterator's front-to-back | 42 // Called at the end of each step in the LayerIterator's front-to-back |
45 // traversal. | 43 // traversal. |
46 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); | 44 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); |
47 | 45 |
48 // Returns true if the given rect in content space for a layer is fully | 46 // Returns true if the given rect in content space for a layer is fully |
49 // occluded in either screen space or the layer's target surface. | 47 // occluded in either screen space or the layer's target surface. |
50 // |render_target| is the contributing layer's render target, and | 48 // |render_target| is the contributing layer's render target, and |
51 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. | 49 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. |
52 bool Occluded(const LayerType* render_target, | 50 bool Occluded(const LayerType* render_target, |
53 gfx::Rect content_rect, | 51 gfx::Rect content_rect, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // one. We then perform any operations required for merging results from the | 137 // one. We then perform any operations required for merging results from the |
140 // child subtree into its parent. | 138 // child subtree into its parent. |
141 void LeaveToRenderTarget(const LayerType* new_target); | 139 void LeaveToRenderTarget(const LayerType* new_target); |
142 | 140 |
143 // Add the layer's occlusion to the tracked state. | 141 // Add the layer's occlusion to the tracked state. |
144 void MarkOccludedBehindLayer(const LayerType* layer); | 142 void MarkOccludedBehindLayer(const LayerType* layer); |
145 | 143 |
146 gfx::Rect screen_space_clip_rect_; | 144 gfx::Rect screen_space_clip_rect_; |
147 scoped_ptr<class OverdrawMetrics> overdraw_metrics_; | 145 scoped_ptr<class OverdrawMetrics> overdraw_metrics_; |
148 gfx::Size minimum_tracking_size_; | 146 gfx::Size minimum_tracking_size_; |
149 bool prevent_occlusion_; | |
150 | 147 |
151 // This is used for visualizing the occlusion tracking process. | 148 // This is used for visualizing the occlusion tracking process. |
152 std::vector<gfx::Rect>* occluding_screen_space_rects_; | 149 std::vector<gfx::Rect>* occluding_screen_space_rects_; |
153 std::vector<gfx::Rect>* non_occluding_screen_space_rects_; | 150 std::vector<gfx::Rect>* non_occluding_screen_space_rects_; |
154 | 151 |
155 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); | 152 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); |
156 }; | 153 }; |
157 | 154 |
158 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; | 155 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; |
159 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; | 156 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; |
160 #if !defined(COMPILER_MSVC) | 157 #if !defined(COMPILER_MSVC) |
161 extern template class OcclusionTrackerBase<Layer, RenderSurface>; | 158 extern template class OcclusionTrackerBase<Layer, RenderSurface>; |
162 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 159 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
163 #endif | 160 #endif |
164 | 161 |
165 } // namespace cc | 162 } // namespace cc |
166 | 163 |
167 #endif // CC_TREES_OCCLUSION_TRACKER_H_ | 164 #endif // CC_TREES_OCCLUSION_TRACKER_H_ |
OLD | NEW |