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

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: 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_checker.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 checker that retains the current state of the tracker
40 // and can be used outside of a layer walk to check occlusion.
41 OcclusionChecker<LayerType> GenerateOcclusionChecker(
42 const LayerType* render_target,
43 const gfx::Transform& draw_transform);
44
38 // Called at the beginning of each step in the LayerIterator's front-to-back 45 // Called at the beginning of each step in the LayerIterator's front-to-back
39 // traversal. 46 // traversal.
40 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 47 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
41 // Called at the end of each step in the LayerIterator's front-to-back 48 // Called at the end of each step in the LayerIterator's front-to-back
42 // traversal. 49 // traversal.
43 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 50 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
44 51
45 // Returns true if the given rect in content space for a layer is fully 52 // 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. 53 // occluded in either screen space or the layer's target surface.
47 // |render_target| is the contributing layer's render target, and 54 // |render_target| is the contributing layer's render target, and
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 }; 144 };
138 145
139 #if !defined(COMPILER_MSVC) 146 #if !defined(COMPILER_MSVC)
140 extern template class OcclusionTracker<Layer>; 147 extern template class OcclusionTracker<Layer>;
141 extern template class OcclusionTracker<LayerImpl>; 148 extern template class OcclusionTracker<LayerImpl>;
142 #endif 149 #endif
143 150
144 } // namespace cc 151 } // namespace cc
145 152
146 #endif // CC_TREES_OCCLUSION_TRACKER_H_ 153 #endif // CC_TREES_OCCLUSION_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698