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_OCCLUSION_TRACKER_H_ | 5 #ifndef CC_OCCLUSION_TRACKER_H_ |
6 #define CC_OCCLUSION_TRACKER_H_ | 6 #define CC_OCCLUSION_TRACKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
10 #include "cc/layer_iterator.h" | 10 #include "cc/layer_iterator.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame); | 29 OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame); |
30 ~OcclusionTrackerBase(); | 30 ~OcclusionTrackerBase(); |
31 | 31 |
32 // Called at the beginning of each step in the LayerIterator's front-to-back
traversal. | 32 // Called at the beginning of each step in the LayerIterator's front-to-back
traversal. |
33 void enterLayer(const LayerIteratorPosition<LayerType>&); | 33 void enterLayer(const LayerIteratorPosition<LayerType>&); |
34 // Called at the end of each step in the LayerIterator's front-to-back trave
rsal. | 34 // Called at the end of each step in the LayerIterator's front-to-back trave
rsal. |
35 void leaveLayer(const LayerIteratorPosition<LayerType>&); | 35 void leaveLayer(const LayerIteratorPosition<LayerType>&); |
36 | 36 |
37 // Returns true if the given rect in content space for a layer is fully occl
uded in either screen space or the layer's target surface. |renderTarget| is th
e contributing layer's render target, and |drawTransform|, |transformsToTargetKn
own| and |clippedRectInTarget| are relative to that. | 37 // Returns true if the given rect in content space for a layer is fully occl
uded in either screen space or the layer's target surface. |renderTarget| is th
e contributing layer's render target, and |drawTransform|, |transformsToTargetKn
own| and |clippedRectInTarget| are relative to that. |
38 bool occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, c
onst WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnk
nown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetS
urface = 0) const; | 38 bool occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, c
onst gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::
Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const
; |
39 // Gives an unoccluded sub-rect of |contentRect| in the content space of a l
ayer. Used when considering occlusion for a layer that paints/draws something. |
renderTarget| is the contributing layer's render target, and |drawTransform|, |t
ransformsToTargetKnown| and |clippedRectInTarget| are relative to that. | 39 // Gives an unoccluded sub-rect of |contentRect| in the content space of a l
ayer. Used when considering occlusion for a layer that paints/draws something. |
renderTarget| is the contributing layer's render target, and |drawTransform|, |t
ransformsToTargetKnown| and |clippedRectInTarget| are relative to that. |
40 gfx::Rect unoccludedContentRect(const LayerType* renderTarget, const gfx::Re
ct& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool impl
DrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusion
FromOutsideTargetSurface = 0) const; | 40 gfx::Rect unoccludedContentRect(const LayerType* renderTarget, const gfx::Re
ct& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUn
known, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTarget
Surface = 0) const; |
41 | 41 |
42 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
renderTarget owned by the layer. | 42 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
renderTarget owned by the layer. |
43 // Used when considering occlusion for a contributing surface that is render
ing into another target. | 43 // Used when considering occlusion for a contributing surface that is render
ing into another target. |
44 gfx::Rect unoccludedContributingSurfaceContentRect(const LayerType*, bool fo
rReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurfa
ce = 0) const; | 44 gfx::Rect unoccludedContributingSurfaceContentRect(const LayerType*, bool fo
rReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurfa
ce = 0) const; |
45 | 45 |
46 // Report operations for recording overdraw metrics. | 46 // Report operations for recording overdraw metrics. |
47 OverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get();
} | 47 OverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get();
} |
48 | 48 |
49 // Gives the region of the screen that is not occluded by something opaque. | 49 // Gives the region of the screen that is not occluded by something opaque. |
50 Region computeVisibleRegionInScreen() const { return SubtractRegions(m_rootT
argetRect, m_stack.back().occlusionInScreen); } | 50 Region computeVisibleRegionInScreen() const { return SubtractRegions(m_rootT
argetRect, m_stack.back().occlusionInScreen); } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; | 105 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; |
106 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; | 106 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; |
107 #if !defined(COMPILER_MSVC) | 107 #if !defined(COMPILER_MSVC) |
108 extern template class OcclusionTrackerBase<Layer, RenderSurface>; | 108 extern template class OcclusionTrackerBase<Layer, RenderSurface>; |
109 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 109 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
110 #endif | 110 #endif |
111 | 111 |
112 } // namespace cc | 112 } // namespace cc |
113 | 113 |
114 #endif // CC_OCCLUSION_TRACKER_H_ | 114 #endif // CC_OCCLUSION_TRACKER_H_ |
OLD | NEW |