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

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

Issue 145313006: [#7] Pass gfx structs by const ref (gfx::Size) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 10 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.cc ('k') | cc/trees/layer_tree_host_common_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_LAYER_TREE_HOST_COMMON_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_COMMON_H_
6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_ 6 #define CC_TREES_LAYER_TREE_HOST_COMMON_H_
7 7
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 14 matching lines...) Expand all
25 class CC_EXPORT LayerTreeHostCommon { 25 class CC_EXPORT LayerTreeHostCommon {
26 public: 26 public:
27 static gfx::Rect CalculateVisibleRect(const gfx::Rect& target_surface_rect, 27 static gfx::Rect CalculateVisibleRect(const gfx::Rect& target_surface_rect,
28 const gfx::Rect& layer_bound_rect, 28 const gfx::Rect& layer_bound_rect,
29 const gfx::Transform& transform); 29 const gfx::Transform& transform);
30 30
31 template <typename LayerType, typename RenderSurfaceLayerListType> 31 template <typename LayerType, typename RenderSurfaceLayerListType>
32 struct CalcDrawPropsInputs { 32 struct CalcDrawPropsInputs {
33 public: 33 public:
34 CalcDrawPropsInputs(LayerType* root_layer, 34 CalcDrawPropsInputs(LayerType* root_layer,
35 gfx::Size device_viewport_size, 35 const gfx::Size& device_viewport_size,
36 const gfx::Transform& device_transform, 36 const gfx::Transform& device_transform,
37 float device_scale_factor, 37 float device_scale_factor,
38 float page_scale_factor, 38 float page_scale_factor,
39 const LayerType* page_scale_application_layer, 39 const LayerType* page_scale_application_layer,
40 int max_texture_size, 40 int max_texture_size,
41 bool can_use_lcd_text, 41 bool can_use_lcd_text,
42 bool can_render_to_separate_surface, 42 bool can_render_to_separate_surface,
43 bool can_adjust_raster_scales, 43 bool can_adjust_raster_scales,
44 RenderSurfaceLayerListType* render_surface_layer_list) 44 RenderSurfaceLayerListType* render_surface_layer_list)
45 : root_layer(root_layer), 45 : root_layer(root_layer),
(...skipping 19 matching lines...) Expand all
65 bool can_render_to_separate_surface; 65 bool can_render_to_separate_surface;
66 bool can_adjust_raster_scales; 66 bool can_adjust_raster_scales;
67 RenderSurfaceLayerListType* render_surface_layer_list; 67 RenderSurfaceLayerListType* render_surface_layer_list;
68 }; 68 };
69 69
70 template <typename LayerType, typename RenderSurfaceLayerListType> 70 template <typename LayerType, typename RenderSurfaceLayerListType>
71 struct CalcDrawPropsInputsForTesting 71 struct CalcDrawPropsInputsForTesting
72 : public CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType> { 72 : public CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType> {
73 CalcDrawPropsInputsForTesting( 73 CalcDrawPropsInputsForTesting(
74 LayerType* root_layer, 74 LayerType* root_layer,
75 gfx::Size device_viewport_size, 75 const gfx::Size& device_viewport_size,
76 const gfx::Transform& device_transform, 76 const gfx::Transform& device_transform,
77 RenderSurfaceLayerListType* render_surface_layer_list); 77 RenderSurfaceLayerListType* render_surface_layer_list);
78 CalcDrawPropsInputsForTesting( 78 CalcDrawPropsInputsForTesting(
79 LayerType* root_layer, 79 LayerType* root_layer,
80 gfx::Size device_viewport_size, 80 const gfx::Size& device_viewport_size,
81 RenderSurfaceLayerListType* render_surface_layer_list); 81 RenderSurfaceLayerListType* render_surface_layer_list);
82 82
83 private: 83 private:
84 const gfx::Transform identity_transform_; 84 const gfx::Transform identity_transform_;
85 }; 85 };
86 86
87 typedef CalcDrawPropsInputs<Layer, RenderSurfaceLayerList> 87 typedef CalcDrawPropsInputs<Layer, RenderSurfaceLayerList>
88 CalcDrawPropsMainInputs; 88 CalcDrawPropsMainInputs;
89 typedef CalcDrawPropsInputsForTesting<Layer, RenderSurfaceLayerList> 89 typedef CalcDrawPropsInputsForTesting<Layer, RenderSurfaceLayerList>
90 CalcDrawPropsMainInputsForTesting; 90 CalcDrawPropsMainInputsForTesting;
(...skipping 28 matching lines...) Expand all
119 119
120 // Returns a layer with the given id if one exists in the subtree starting 120 // Returns a layer with the given id if one exists in the subtree starting
121 // from the given root layer (including mask and replica layers). 121 // from the given root layer (including mask and replica layers).
122 template <typename LayerType> 122 template <typename LayerType>
123 static LayerType* FindLayerInSubtree(LayerType* root_layer, int layer_id); 123 static LayerType* FindLayerInSubtree(LayerType* root_layer, int layer_id);
124 124
125 // Applies the layer's sublayer transform about its anchor point to the 125 // Applies the layer's sublayer transform about its anchor point to the
126 // given transform. 126 // given transform.
127 template <typename LayerType> 127 template <typename LayerType>
128 static void ApplySublayerTransformAboutAnchor(const LayerType& layer, 128 static void ApplySublayerTransformAboutAnchor(const LayerType& layer,
129 gfx::Size bounds, 129 const gfx::Size& bounds,
130 gfx::Transform* transform) { 130 gfx::Transform* transform) {
131 if (!layer.sublayer_transform().IsIdentity()) { 131 if (!layer.sublayer_transform().IsIdentity()) {
132 transform->Translate(layer.anchor_point().x() * bounds.width(), 132 transform->Translate(layer.anchor_point().x() * bounds.width(),
133 layer.anchor_point().y() * bounds.height()); 133 layer.anchor_point().y() * bounds.height());
134 transform->PreconcatTransform(layer.sublayer_transform()); 134 transform->PreconcatTransform(layer.sublayer_transform());
135 transform->Translate(-layer.anchor_point().x() * bounds.width(), 135 transform->Translate(-layer.anchor_point().x() * bounds.width(),
136 -layer.anchor_point().y() * bounds.height()); 136 -layer.anchor_point().y() * bounds.height());
137 } 137 }
138 } 138 }
139 139
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 CallFunctionForSubtree(get_child_as_raw_ptr(root_layer->children(), i), 220 CallFunctionForSubtree(get_child_as_raw_ptr(root_layer->children(), i),
221 function); 221 function);
222 } 222 }
223 } 223 }
224 224
225 template <typename LayerType, typename RenderSurfaceLayerListType> 225 template <typename LayerType, typename RenderSurfaceLayerListType>
226 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType, 226 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType,
227 RenderSurfaceLayerListType>:: 227 RenderSurfaceLayerListType>::
228 CalcDrawPropsInputsForTesting( 228 CalcDrawPropsInputsForTesting(
229 LayerType* root_layer, 229 LayerType* root_layer,
230 gfx::Size device_viewport_size, 230 const gfx::Size& device_viewport_size,
231 const gfx::Transform& device_transform, 231 const gfx::Transform& device_transform,
232 RenderSurfaceLayerListType* render_surface_layer_list) 232 RenderSurfaceLayerListType* render_surface_layer_list)
233 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( 233 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>(
234 root_layer, 234 root_layer,
235 device_viewport_size, 235 device_viewport_size,
236 device_transform, 236 device_transform,
237 1.f, 237 1.f,
238 1.f, 238 1.f,
239 NULL, 239 NULL,
240 std::numeric_limits<int>::max() / 2, 240 std::numeric_limits<int>::max() / 2,
241 false, 241 false,
242 true, 242 true,
243 false, 243 false,
244 render_surface_layer_list) { 244 render_surface_layer_list) {
245 DCHECK(root_layer); 245 DCHECK(root_layer);
246 DCHECK(render_surface_layer_list); 246 DCHECK(render_surface_layer_list);
247 } 247 }
248 248
249 template <typename LayerType, typename RenderSurfaceLayerListType> 249 template <typename LayerType, typename RenderSurfaceLayerListType>
250 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType, 250 LayerTreeHostCommon::CalcDrawPropsInputsForTesting<LayerType,
251 RenderSurfaceLayerListType>:: 251 RenderSurfaceLayerListType>::
252 CalcDrawPropsInputsForTesting( 252 CalcDrawPropsInputsForTesting(
253 LayerType* root_layer, 253 LayerType* root_layer,
254 gfx::Size device_viewport_size, 254 const gfx::Size& device_viewport_size,
255 RenderSurfaceLayerListType* render_surface_layer_list) 255 RenderSurfaceLayerListType* render_surface_layer_list)
256 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>( 256 : CalcDrawPropsInputs<LayerType, RenderSurfaceLayerListType>(
257 root_layer, 257 root_layer,
258 device_viewport_size, 258 device_viewport_size,
259 identity_transform_, 259 identity_transform_,
260 1.f, 260 1.f,
261 1.f, 261 1.f,
262 NULL, 262 NULL,
263 std::numeric_limits<int>::max() / 2, 263 std::numeric_limits<int>::max() / 2,
264 false, 264 false,
265 true, 265 true,
266 false, 266 false,
267 render_surface_layer_list) { 267 render_surface_layer_list) {
268 DCHECK(root_layer); 268 DCHECK(root_layer);
269 DCHECK(render_surface_layer_list); 269 DCHECK(render_surface_layer_list);
270 } 270 }
271 271
272 } // namespace cc 272 } // namespace cc
273 273
274 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_ 274 #endif // CC_TREES_LAYER_TREE_HOST_COMMON_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698