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

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 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/layer_tree_host_unittest_delegated.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"
(...skipping 14 matching lines...) Expand all
25 // 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,
26 // 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
27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer 27 // methods such as Occluded() and UnoccludedContentRect(). If the current layer
28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also 28 // owns a RenderSurfaceImpl, then occlusion on that RenderSurfaceImpl may also
29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally, 29 // be queried via surfaceOccluded() and surfaceUnoccludedContentRect(). Finally,
30 // 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
31 // calling MarkOccludedBehindLayer(). 31 // calling MarkOccludedBehindLayer().
32 template <typename LayerType, typename RenderSurfaceType> 32 template <typename LayerType, typename RenderSurfaceType>
33 class CC_EXPORT OcclusionTrackerBase { 33 class CC_EXPORT OcclusionTrackerBase {
34 public: 34 public:
35 OcclusionTrackerBase(gfx::Rect screen_space_clip_rect, 35 OcclusionTrackerBase(const gfx::Rect& screen_space_clip_rect,
36 bool record_metrics_for_frame); 36 bool record_metrics_for_frame);
37 ~OcclusionTrackerBase(); 37 ~OcclusionTrackerBase();
38 38
39 // Called at the beginning of each step in the LayerIterator's front-to-back 39 // Called at the beginning of each step in the LayerIterator's front-to-back
40 // traversal. 40 // traversal.
41 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 41 void EnterLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
42 // Called at the end of each step in the LayerIterator's front-to-back 42 // Called at the end of each step in the LayerIterator's front-to-back
43 // traversal. 43 // traversal.
44 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator); 44 void LeaveLayer(const LayerIteratorPosition<LayerType>& layer_iterator);
45 45
46 // Returns true if the given rect in content space for a layer is fully 46 // Returns true if the given rect in content space for a layer is fully
47 // occluded in either screen space or the layer's target surface. 47 // occluded in either screen space or the layer's target surface.
48 // |render_target| is the contributing layer's render target, and 48 // |render_target| is the contributing layer's render target, and
49 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. 49 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that.
50 bool Occluded(const LayerType* render_target, 50 bool Occluded(const LayerType* render_target,
51 gfx::Rect content_rect, 51 const gfx::Rect& content_rect,
52 const gfx::Transform& draw_transform, 52 const gfx::Transform& draw_transform,
53 bool impl_draw_transform_is_unknown) const; 53 bool impl_draw_transform_is_unknown) const;
54 54
55 // Gives an unoccluded sub-rect of |content_rect| in the content space of a 55 // Gives an unoccluded sub-rect of |content_rect| in the content space of a
56 // layer. Used when considering occlusion for a layer that paints/draws 56 // layer. Used when considering occlusion for a layer that paints/draws
57 // something. |render_target| is the contributing layer's render target, and 57 // something. |render_target| is the contributing layer's render target, and
58 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that. 58 // |draw_transform| and |impl_draw_transform_is_unknown| are relative to that.
59 gfx::Rect UnoccludedContentRect( 59 gfx::Rect UnoccludedContentRect(
60 const LayerType* render_target, 60 const LayerType* render_target,
61 gfx::Rect content_rect, 61 const gfx::Rect& content_rect,
62 const gfx::Transform& draw_transform, 62 const gfx::Transform& draw_transform,
63 bool impl_draw_transform_is_unknown) const; 63 bool impl_draw_transform_is_unknown) const;
64 64
65 // Gives an unoccluded sub-rect of |content_rect| in the content space of the 65 // Gives an unoccluded sub-rect of |content_rect| in the content space of the
66 // render_target owned by the layer. Used when considering occlusion for a 66 // render_target owned by the layer. Used when considering occlusion for a
67 // contributing surface that is rendering into another target. 67 // contributing surface that is rendering into another target.
68 gfx::Rect UnoccludedContributingSurfaceContentRect( 68 gfx::Rect UnoccludedContributingSurfaceContentRect(
69 const LayerType* layer, 69 const LayerType* layer,
70 bool for_replica, 70 bool for_replica,
71 gfx::Rect content_rect) const; 71 const gfx::Rect& content_rect) const;
72 72
73 // Report operations for recording overdraw metrics. 73 // Report operations for recording overdraw metrics.
74 OverdrawMetrics* overdraw_metrics() const { 74 OverdrawMetrics* overdraw_metrics() const {
75 return overdraw_metrics_.get(); 75 return overdraw_metrics_.get();
76 } 76 }
77 77
78 // Gives the region of the screen that is not occluded by something opaque. 78 // Gives the region of the screen that is not occluded by something opaque.
79 Region ComputeVisibleRegionInScreen() const { 79 Region ComputeVisibleRegionInScreen() const {
80 DCHECK(!stack_.back().target->parent()); 80 DCHECK(!stack_.back().target->parent());
81 return SubtractRegions(screen_space_clip_rect_, 81 return SubtractRegions(screen_space_clip_rect_,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker; 155 typedef OcclusionTrackerBase<Layer, RenderSurface> OcclusionTracker;
156 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl; 156 typedef OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl> OcclusionTrackerImpl;
157 #if !defined(COMPILER_MSVC) 157 #if !defined(COMPILER_MSVC)
158 extern template class OcclusionTrackerBase<Layer, RenderSurface>; 158 extern template class OcclusionTrackerBase<Layer, RenderSurface>;
159 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; 159 extern template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>;
160 #endif 160 #endif
161 161
162 } // namespace cc 162 } // namespace cc
163 163
164 #endif // CC_TREES_OCCLUSION_TRACKER_H_ 164 #endif // CC_TREES_OCCLUSION_TRACKER_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_delegated.cc ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698