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 CCOcclusionTracker_h | 5 #ifndef CCOcclusionTracker_h |
6 #define CCOcclusionTracker_h | 6 #define CCOcclusionTracker_h |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "CCLayerIterator.h" | 9 #include "CCLayerIterator.h" |
9 #include "FloatQuad.h" | 10 #include "FloatQuad.h" |
10 #include "Region.h" | 11 #include "Region.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 class CCOverdrawMetrics; | 14 class CCOverdrawMetrics; |
14 class CCLayerImpl; | 15 class CCLayerImpl; |
15 class CCRenderSurface; | 16 class CCRenderSurface; |
16 class LayerChromium; | 17 class LayerChromium; |
17 class RenderSurfaceChromium; | 18 class RenderSurfaceChromium; |
18 | 19 |
19 // This class is used to track occlusion of layers while traversing them in a fr
ont-to-back order. As each layer is visited, one of the | 20 // This class is used to track occlusion of layers while traversing them in a fr
ont-to-back order. As each layer is visited, one of the |
20 // methods in this class is called to notify it about the current target surface
. | 21 // methods in this class is called to notify it about the current target surface
. |
21 // Then, occlusion in the content space of the current layer may be queried, via
methods such as occluded() and unoccludedContentRect(). | 22 // Then, occlusion in the content space of the current layer may be queried, via
methods such as occluded() and unoccludedContentRect(). |
22 // If the current layer owns a RenderSurface, then occlusion on that RenderSurfa
ce may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). | 23 // If the current layer owns a RenderSurface, then occlusion on that RenderSurfa
ce may also be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). |
23 // Finally, once finished with the layer, occlusion behind the layer should be m
arked by calling markOccludedBehindLayer(). | 24 // Finally, once finished with the layer, occlusion behind the layer should be m
arked by calling markOccludedBehindLayer(). |
24 template<typename LayerType, typename RenderSurfaceType> | 25 template<typename LayerType, typename RenderSurfaceType> |
25 class CCOcclusionTrackerBase { | 26 class CCOcclusionTrackerBase { |
26 WTF_MAKE_NONCOPYABLE(CCOcclusionTrackerBase); | |
27 public: | 27 public: |
28 CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); | 28 CCOcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame); |
29 | 29 |
30 // Called at the beginning of each step in the CCLayerIterator's front-to-ba
ck traversal. | 30 // Called at the beginning of each step in the CCLayerIterator's front-to-ba
ck traversal. |
31 void enterLayer(const CCLayerIteratorPosition<LayerType>&); | 31 void enterLayer(const CCLayerIteratorPosition<LayerType>&); |
32 // Called at the end of each step in the CCLayerIterator's front-to-back tra
versal. | 32 // Called at the end of each step in the CCLayerIterator's front-to-back tra
versal. |
33 void leaveLayer(const CCLayerIteratorPosition<LayerType>&); | 33 void leaveLayer(const CCLayerIteratorPosition<LayerType>&); |
34 | 34 |
35 // Returns true if the given rect in content space for the layer is fully oc
cluded in either screen space or the layer's target surface. | 35 // Returns true if the given rect in content space for the layer is fully oc
cluded in either screen space or the layer's target surface. |
36 bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusi
onFromOutsideTargetSurface = 0) const; | 36 bool occluded(const LayerType*, const IntRect& contentRect, bool* hasOcclusi
onFromOutsideTargetSurface = 0) const; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Add the layer's occlusion to the tracked state. | 88 // Add the layer's occlusion to the tracked state. |
89 void markOccludedBehindLayer(const LayerType*); | 89 void markOccludedBehindLayer(const LayerType*); |
90 | 90 |
91 IntRect m_rootTargetRect; | 91 IntRect m_rootTargetRect; |
92 OwnPtr<CCOverdrawMetrics> m_overdrawMetrics; | 92 OwnPtr<CCOverdrawMetrics> m_overdrawMetrics; |
93 IntSize m_minimumTrackingSize; | 93 IntSize m_minimumTrackingSize; |
94 | 94 |
95 // This is used for visualizing the occlusion tracking process. | 95 // This is used for visualizing the occlusion tracking process. |
96 Vector<IntRect>* m_occludingScreenSpaceRects; | 96 Vector<IntRect>* m_occludingScreenSpaceRects; |
| 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(CCOcclusionTrackerBase); |
97 }; | 99 }; |
98 | 100 |
99 typedef CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium> CCOcclusion
Tracker; | 101 typedef CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium> CCOcclusion
Tracker; |
100 typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerI
mpl; | 102 typedef CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface> CCOcclusionTrackerI
mpl; |
101 | 103 |
102 } | 104 } |
103 #endif // CCOcclusionTracker_h | 105 #endif // CCOcclusionTracker_h |
OLD | NEW |