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

Side by Side Diff: cc/trees/occlusion_tracker.h

Issue 576173003: cc: Move UnoccludedContentRect to Occlusion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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
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 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"
11 #include "cc/base/cc_export.h" 11 #include "cc/base/cc_export.h"
12 #include "cc/base/simple_enclosed_region.h" 12 #include "cc/base/simple_enclosed_region.h"
13 #include "cc/layers/layer_iterator.h" 13 #include "cc/layers/layer_iterator.h"
14 #include "cc/trees/occlusion.h" 14 #include "cc/trees/occlusion.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 16
17 namespace cc { 17 namespace cc {
18 class LayerImpl; 18 class LayerImpl;
19 class Region; 19 class Region;
20 class RenderSurfaceImpl; 20 class RenderSurfaceImpl;
21 class Layer; 21 class Layer;
22 class RenderSurface; 22 class RenderSurface;
23 23
24 // This class is used to track occlusion of layers while traversing them in a 24 // This class is used to track occlusion of layers while traversing them in a
25 // front-to-back order. As each layer is visited, one of the methods in this 25 // front-to-back order. As each layer is visited, one of the methods in this
26 // class is called to notify it about the current target surface. Then, 26 // class is called to notify it about the current target surface. Then,
27 // occlusion in the content space of the current layer may be queried, via 27 // occlusion in the content space of the current layer may be queried, via
28 // methods such UnoccludedContentRect(), or using Occlusion from 28 // Occlusion from GetCurrentOcclusionForLayer(). If the current layer owns a
29 // GetCurrentOcclusionForLayer. If the current layer owns a RenderSurfaceImpl, 29 // RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also be
30 // then occlusion on that RenderSurfaceImpl may also be queried via 30 // queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally,
31 // surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, once finished 31 // once finished with the layer, occlusion behind the layer should be marked by
32 // with the layer, occlusion behind the layer should be marked by calling 32 // calling MarkOccludedBehindLayer().
33 // MarkOccludedBehindLayer().
34 template <typename LayerType> 33 template <typename LayerType>
35 class CC_EXPORT OcclusionTracker { 34 class CC_EXPORT OcclusionTracker {
36 public: 35 public:
37 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect); 36 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect);
38 ~OcclusionTracker(); 37 ~OcclusionTracker();
39 38
40 // Return an occlusion that retains the current state of the tracker 39 // Return an occlusion that retains the current state of the tracker
41 // and can be used outside of a layer walk to check occlusion. 40 // and can be used outside of a layer walk to check occlusion.
42 Occlusion GetCurrentOcclusionForLayer( 41 Occlusion GetCurrentOcclusionForLayer(
43 const gfx::Transform& draw_transform) const; 42 const gfx::Transform& draw_transform) const;
44 43
45 // Called at the beginning of each step in the LayerIterator's front-to-back 44 // Called at the beginning of each step in the LayerIterator's front-to-back
46 // traversal. 45 // traversal.
47 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 46 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
48 // Called at the end of each step in the LayerIterator's front-to-back 47 // Called at the end of each step in the LayerIterator's front-to-back
49 // traversal. 48 // traversal.
50 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 49 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
51 50
52 // Gives an unoccluded sub-rect of |content_rect| in the content space of a
53 // layer. Used when considering occlusion for a layer that paints/draws
54 // something. |render_target| is the contributing layer's render target, and
55 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that.
56 gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect,
57 const gfx::Transform& draw_transform) const;
58
59 // Gives an unoccluded sub-rect of |content_rect| in the content space of the 51 // Gives an unoccluded sub-rect of |content_rect| in the content space of the
60 // render_target owned by the layer. Used when considering occlusion for a 52 // render_target owned by the layer. Used when considering occlusion for a
61 // contributing surface that is rendering into another target. 53 // contributing surface that is rendering into another target.
62 gfx::Rect UnoccludedContributingSurfaceContentRect( 54 gfx::Rect UnoccludedContributingSurfaceContentRect(
63 const gfx::Rect& content_rect, 55 const gfx::Rect& content_rect,
64 const gfx::Transform& draw_transform) const; 56 const gfx::Transform& draw_transform) const;
65 57
66 // Gives the region of the screen that is not occluded by something opaque. 58 // Gives the region of the screen that is not occluded by something opaque.
67 Region ComputeVisibleRegionInScreen() const; 59 Region ComputeVisibleRegionInScreen() const;
68 60
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }; 128 };
137 129
138 #if !defined(COMPILER_MSVC) 130 #if !defined(COMPILER_MSVC)
139 extern template class OcclusionTracker<Layer>; 131 extern template class OcclusionTracker<Layer>;
140 extern template class OcclusionTracker<LayerImpl>; 132 extern template class OcclusionTracker<LayerImpl>;
141 #endif 133 #endif
142 134
143 } // namespace cc 135 } // namespace cc
144 136
145 #endif // CC_TREES_OCCLUSION_TRACKER_H_ 137 #endif // CC_TREES_OCCLUSION_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698