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

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

Issue 551463005: Revert 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: 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"
15 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
16 15
17 namespace cc { 16 namespace cc {
18 class LayerImpl; 17 class LayerImpl;
19 class Region; 18 class Region;
20 class RenderSurfaceImpl; 19 class RenderSurfaceImpl;
21 class Layer; 20 class Layer;
22 class RenderSurface; 21 class RenderSurface;
23 22
24 // This class is used to track occlusion of layers while traversing them in a 23 // 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 24 // 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, 25 // 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 26 // occlusion in the content space of the current layer may be queried, via
28 // methods such as Occluded() and UnoccludedContentRect(). If the current layer 27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer
29 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also 28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also
30 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, 29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally,
31 // once finished with the layer, occlusion behind the layer should be marked by 30 // once finished with the layer, occlusion behind the layer should be marked by
32 // calling MarkOccludedBehindLayer(). 31 // calling MarkOccludedBehindLayer().
33 template <typename LayerType> 32 template <typename LayerType>
34 class CC_EXPORT OcclusionTracker { 33 class CC_EXPORT OcclusionTracker {
35 public: 34 public:
36 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect); 35 explicit OcclusionTracker(const gfx::Rect& screen_space_clip_rect);
37 ~OcclusionTracker(); 36 ~OcclusionTracker();
38 37
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
44 // Called at the beginning of each step in the LayerIterator's front-to-back 38 // Called at the beginning of each step in the LayerIterator's front-to-back
45 // traversal. 39 // traversal.
46 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 40 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
47 // Called at the end of each step in the LayerIterator's front-to-back 41 // Called at the end of each step in the LayerIterator's front-to-back
48 // traversal. 42 // traversal.
49 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 43 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
50 44
51 // Returns true if the given rect in content space for a layer is fully 45 // Returns true if the given rect in content space for a layer is fully
52 // occluded in either screen space or the layer's target surface. 46 // occluded in either screen space or the layer's target surface.
53 // |render_target| is the contributing layer's render target, and 47 // |render_target| is the contributing layer's render target, and
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 }; 137 };
144 138
145 #if !defined(COMPILER_MSVC) 139 #if !defined(COMPILER_MSVC)
146 extern template class OcclusionTracker<Layer>; 140 extern template class OcclusionTracker<Layer>;
147 extern template class OcclusionTracker<LayerImpl>; 141 extern template class OcclusionTracker<LayerImpl>;
148 #endif 142 #endif
149 143
150 } // namespace cc 144 } // namespace cc
151 145
152 #endif // CC_TREES_OCCLUSION_TRACKER_H_ 146 #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