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

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

Issue 547723002: Reland of: cc: Add occlusion checker as a fixed view of occlusion tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « cc/trees/occlusion.cc ('k') | cc/trees/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 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 "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 16
16 namespace cc { 17 namespace cc {
17 class LayerImpl; 18 class LayerImpl;
18 class Region; 19 class Region;
19 class RenderSurfaceImpl; 20 class RenderSurfaceImpl;
20 class Layer; 21 class Layer;
21 class RenderSurface; 22 class RenderSurface;
22 23
23 // 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
24 // 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
25 // 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,
26 // 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
27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer 28 // methods such as Occluded() and UnoccludedContentRect(). If the current layer
28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also 29 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also
29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, 30 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally,
30 // once finished with the layer, occlusion behind the layer should be marked by 31 // once finished with the layer, occlusion behind the layer should be marked by
31 // calling MarkOccludedBehindLayer(). 32 // calling MarkOccludedBehindLayer().
32 template <typename LayerType> 33 template <typename LayerType>
33 class CC_EXPORT OcclusionTracker { 34 class CC_EXPORT OcclusionTracker {
34 public: 35 public:
35 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect); 36 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect);
36 ~OcclusionTracker(); 37 ~OcclusionTracker();
37 38
39 // Return an occlusion that retains the current state of the tracker
40 // and can be used outside of a layer walk to check occlusion.
41 Occlusion GetCurrentOcclusionForLayer(
42 const gfx::Transform& draw_transform) const;
43
38 // 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
39 // traversal. 45 // traversal.
40 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 46 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
41 // 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
42 // traversal. 48 // traversal.
43 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 49 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
44 50
45 // Returns true if the given rect in content space for a layer is fully 51 // Returns true if the given rect in content space for a layer is fully
46 // occluded in either screen space or the layer's target surface. 52 // occluded in either screen space or the layer's target surface.
47 // |render_target| is the contributing layer's render target, and 53 // |render_target| is the contributing layer's render target, and
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 143 };
138 144
139 #if !defined(COMPILER_MSVC) 145 #if !defined(COMPILER_MSVC)
140 extern template class OcclusionTracker<Layer>; 146 extern template class OcclusionTracker<Layer>;
141 extern template class OcclusionTracker<LayerImpl>; 147 extern template class OcclusionTracker<LayerImpl>;
142 #endif 148 #endif
143 149
144 } // namespace cc 150 } // namespace cc
145 151
146 #endif // CC_TREES_OCCLUSION_TRACKER_H_ 152 #endif // CC_TREES_OCCLUSION_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/trees/occlusion.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698