Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: cc/occlusion_tracker.h

Issue 11365025: Make cc a component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/math_util.h ('k') | cc/occlusion_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "FloatQuad.h" 8 #include "FloatQuad.h"
9 #include "Region.h" 9 #include "Region.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "cc/cc_export.h"
11 #include "cc/layer_iterator.h" 12 #include "cc/layer_iterator.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 14
14 namespace cc { 15 namespace cc {
15 class OverdrawMetrics; 16 class OverdrawMetrics;
16 class LayerImpl; 17 class LayerImpl;
17 class RenderSurfaceImpl; 18 class RenderSurfaceImpl;
18 class Layer; 19 class Layer;
19 class RenderSurface; 20 class RenderSurface;
20 21
21 // 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 22 // 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
22 // methods in this class is called to notify it about the current target surface . 23 // methods in this class is called to notify it about the current target surface .
23 // Then, occlusion in the content space of the current layer may be queried, via methods such as occluded() and unoccludedContentRect(). 24 // Then, occlusion in the content space of the current layer may be queried, via methods such as occluded() and unoccludedContentRect().
24 // If the current layer owns a RenderSurfaceImpl, then occlusion on that RenderS urfaceImpl may also be queried via surfaceOccluded() and surfaceUnoccludedConten tRect(). 25 // If the current layer owns a RenderSurfaceImpl, then occlusion on that RenderS urfaceImpl may also be queried via surfaceOccluded() and surfaceUnoccludedConten tRect().
25 // Finally, once finished with the layer, occlusion behind the layer should be m arked by calling markOccludedBehindLayer(). 26 // Finally, once finished with the layer, occlusion behind the layer should be m arked by calling markOccludedBehindLayer().
26 template<typename LayerType, typename RenderSurfaceType> 27 template<typename LayerType, typename RenderSurfaceType>
27 class OcclusionTrackerBase { 28 class CC_EXPORT OcclusionTrackerBase {
28 public: 29 public:
29 OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame); 30 OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame);
31 ~OcclusionTrackerBase();
30 32
31 // Called at the beginning of each step in the LayerIterator's front-to-back traversal. 33 // Called at the beginning of each step in the LayerIterator's front-to-back traversal.
32 void enterLayer(const LayerIteratorPosition<LayerType>&); 34 void enterLayer(const LayerIteratorPosition<LayerType>&);
33 // Called at the end of each step in the LayerIterator's front-to-back trave rsal. 35 // Called at the end of each step in the LayerIterator's front-to-back trave rsal.
34 void leaveLayer(const LayerIteratorPosition<LayerType>&); 36 void leaveLayer(const LayerIteratorPosition<LayerType>&);
35 37
36 // 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 // 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 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; 39 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 // 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 // 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 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; 41 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;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 100
99 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase); 101 DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase);
100 }; 102 };
101 103
102 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; 104 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker;
103 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; 105 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl;
104 106
105 } // namespace cc 107 } // namespace cc
106 108
107 #endif // CCOcclusionTracker_h 109 #endif // CCOcclusionTracker_h
OLDNEW
« no previous file with comments | « cc/math_util.h ('k') | cc/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698