| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // This class is used to track occlusion of layers while traversing them in a | 23 // This class is used to track occlusion of layers while traversing them in a |
| 24 // front-to-back order. As each layer is visited, one of the methods in this | 24 // front-to-back order. As each layer is visited, one of the methods in this |
| 25 // class is called to notify it about the current target surface. Then, | 25 // class is called to notify it about the current target surface. Then, |
| 26 // occlusion in the content space of the current layer may be queried, via | 26 // occlusion in the content space of the current layer may be queried, via |
| 27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer | 27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer |
| 28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also | 28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also |
| 29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, | 29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, |
| 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> |
| 33 class CC_EXPORT OcclusionTrackerBase { | 33 class CC_EXPORT OcclusionTracker { |
| 34 public: | 34 public: |
| 35 OcclusionTrackerBase(const gfx::Rect& screen_space_clip_rect, | 35 OcclusionTracker(const gfx::Rect& screen_space_clip_rect, |
| 36 bool record_metrics_for_frame); | 36 bool record_metrics_for_frame); |
| 37 ~OcclusionTrackerBase(); | 37 ~OcclusionTracker(); |
| 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. | 40 // traversal. |
| 41 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); | 41 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); |
| 42 // 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 |
| 43 // traversal. | 43 // traversal. |
| 44 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); | 44 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); |
| 45 | 45 |
| 46 // 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 |
| 47 // occluded in either screen space or the layer's target surface. | 47 // occluded in either screen space or the layer's target surface. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void MarkOccludedBehindLayer(const LayerType* layer); | 142 void MarkOccludedBehindLayer(const LayerType* layer); |
| 143 | 143 |
| 144 gfx::Rect screen_space_clip_rect_; | 144 gfx::Rect screen_space_clip_rect_; |
| 145 scoped_ptr<class OverdrawMetrics> overdraw_metrics_; | 145 scoped_ptr<class OverdrawMetrics> overdraw_metrics_; |
| 146 gfx::Size minimum_tracking_size_; | 146 gfx::Size minimum_tracking_size_; |
| 147 | 147 |
| 148 // This is used for visualizing the occlusion tracking process. | 148 // This is used for visualizing the occlusion tracking process. |
| 149 std::vector<gfx::Rect>* occluding_screen_space_rects_; | 149 std::vector<gfx::Rect>* occluding_screen_space_rects_; |
| 150 std::vector<gfx::Rect>* non_occluding_screen_space_rects_; | 150 std::vector<gfx::Rect>* non_occluding_screen_space_rects_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); | 152 DISALLOW_COPY_AND_ASSIGN(OcclusionTracker); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; | |
| 156 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; | |
| 157 #if !defined(COMPILER_MSVC) | 155 #if !defined(COMPILER_MSVC) |
| 158 extern template class OcclusionTrackerBase<Layer, RenderSurface>; | 156 extern template class OcclusionTracker<Layer>; |
| 159 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 157 extern template class OcclusionTracker<LayerImpl>; |
| 160 #endif | 158 #endif |
| 161 | 159 |
| 162 } // namespace cc | 160 } // namespace cc |
| 163 | 161 |
| 164 #endif // CC_TREES_OCCLUSION_TRACKER_H_ | 162 #endif // CC_TREES_OCCLUSION_TRACKER_H_ |
| OLD | NEW |