OLD | NEW |
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_LAYERS_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_LAYER_IMPL_H_ |
6 #define CC_LAYERS_LAYER_IMPL_H_ | 6 #define CC_LAYERS_LAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 bool has_mask() const { return mask_layer_; } | 88 bool has_mask() const { return mask_layer_; } |
89 bool has_replica() const { return replica_layer_; } | 89 bool has_replica() const { return replica_layer_; } |
90 bool replica_has_mask() const { | 90 bool replica_has_mask() const { |
91 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); | 91 return replica_layer_ && (mask_layer_ || replica_layer_->mask_layer_); |
92 } | 92 } |
93 | 93 |
94 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } | 94 LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; } |
95 | 95 |
96 scoped_ptr<SharedQuadState> CreateSharedQuadState() const; | 96 scoped_ptr<SharedQuadState> CreateSharedQuadState() const; |
97 // willDraw must be called before appendQuads. If willDraw is called, | 97 // WillDraw must be called before AppendQuads. If WillDraw is called, |
98 // didDraw is guaranteed to be called before another willDraw or before | 98 // DidDraw is guaranteed to be called before another WillDraw or before |
99 // the layer is destroyed. To enforce this, any class that overrides | 99 // the layer is destroyed. To enforce this, any class that overrides |
100 // willDraw/didDraw must call the base class version. | 100 // WillDraw/DqidDraw must call the base class version. |
101 virtual void WillDraw(ResourceProvider* resource_provider); | 101 virtual void WillDraw(ResourceProvider* resource_provider); |
102 virtual void AppendQuads(QuadSink* quad_sink, | 102 virtual void AppendQuads(QuadSink* quad_sink, |
103 AppendQuadsData* append_quads_data) {} | 103 AppendQuadsData* append_quads_data) {} |
104 virtual void DidDraw(ResourceProvider* resource_provider); | 104 virtual void DidDraw(ResourceProvider* resource_provider); |
105 | 105 |
106 virtual ResourceProvider::ResourceId ContentsResourceId() const; | 106 virtual ResourceProvider::ResourceId ContentsResourceId() const; |
107 | 107 |
108 virtual bool HasDelegatedContent() const; | 108 virtual bool HasDelegatedContent() const; |
109 virtual bool HasContributingDelegatedRenderPasses() const; | 109 virtual bool HasContributingDelegatedRenderPasses() const; |
110 virtual RenderPass::Id FirstContributingRenderPassId() const; | 110 virtual RenderPass::Id FirstContributingRenderPassId() const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return sublayer_transform_; | 182 return sublayer_transform_; |
183 } | 183 } |
184 | 184 |
185 // Debug layer name. | 185 // Debug layer name. |
186 void SetDebugName(const std::string& debug_name) { debug_name_ = debug_name; } | 186 void SetDebugName(const std::string& debug_name) { debug_name_ = debug_name; } |
187 std::string debug_name() const { return debug_name_; } | 187 std::string debug_name() const { return debug_name_; } |
188 | 188 |
189 bool ShowDebugBorders() const; | 189 bool ShowDebugBorders() const; |
190 | 190 |
191 // These invalidate the host's render surface layer list. The caller | 191 // These invalidate the host's render surface layer list. The caller |
192 // is responsible for calling setNeedsUpdateDrawProperties on the host | 192 // is responsible for calling set_needs_update_draw_properties on the tree |
193 // so that its list can be recreated. | 193 // so that its list can be recreated. |
194 void CreateRenderSurface(); | 194 void CreateRenderSurface(); |
195 void ClearRenderSurface() { draw_properties_.render_surface.reset(); } | 195 void ClearRenderSurface() { draw_properties_.render_surface.reset(); } |
196 | 196 |
197 DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() { | 197 DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() { |
198 return draw_properties_; | 198 return draw_properties_; |
199 } | 199 } |
200 const DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() const { | 200 const DrawProperties<LayerImpl, RenderSurfaceImpl>& draw_properties() const { |
201 return draw_properties_; | 201 return draw_properties_; |
202 } | 202 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 const LayerImpl* render_target() const { | 239 const LayerImpl* render_target() const { |
240 DCHECK(!draw_properties_.render_target || | 240 DCHECK(!draw_properties_.render_target || |
241 draw_properties_.render_target->render_surface()); | 241 draw_properties_.render_target->render_surface()); |
242 return draw_properties_.render_target; | 242 return draw_properties_.render_target; |
243 } | 243 } |
244 RenderSurfaceImpl* render_surface() const { | 244 RenderSurfaceImpl* render_surface() const { |
245 return draw_properties_.render_surface.get(); | 245 return draw_properties_.render_surface.get(); |
246 } | 246 } |
247 | 247 |
248 // The client should be responsible for setting bounds, contentBounds and | 248 // The client should be responsible for setting bounds, content bounds and |
249 // contentsScale to appropriate values. LayerImpl doesn't calculate any of | 249 // contents scale to appropriate values. LayerImpl doesn't calculate any of |
250 // them from the other values. | 250 // them from the other values. |
251 | 251 |
252 void SetBounds(gfx::Size bounds); | 252 void SetBounds(gfx::Size bounds); |
253 gfx::Size bounds() const { return bounds_; } | 253 gfx::Size bounds() const { return bounds_; } |
254 | 254 |
255 void SetContentBounds(gfx::Size content_bounds); | 255 void SetContentBounds(gfx::Size content_bounds); |
256 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } | 256 gfx::Size content_bounds() const { return draw_properties_.content_bounds; } |
257 | 257 |
258 float contents_scale_x() const { return draw_properties_.contents_scale_x; } | 258 float contents_scale_x() const { return draw_properties_.contents_scale_x; } |
259 float contents_scale_y() const { return draw_properties_.contents_scale_y; } | 259 float contents_scale_y() const { return draw_properties_.contents_scale_y; } |
260 void SetContentsScale(float contents_scale_x, float contents_scale_y); | 260 void SetContentsScale(float contents_scale_x, float contents_scale_y); |
261 | 261 |
262 virtual void CalculateContentsScale(float ideal_contents_scale, | 262 virtual void CalculateContentsScale(float ideal_contents_scale, |
263 bool animating_transform_to_screen, | 263 bool animating_transform_to_screen, |
264 float* contents_scale_x, | 264 float* contents_scale_x, |
265 float* contents_scale_y, | 265 float* contents_scale_y, |
266 gfx::Size* contentBounds); | 266 gfx::Size* content_bounds); |
267 | 267 |
268 void SetScrollOffset(gfx::Vector2d scroll_offset); | 268 void SetScrollOffset(gfx::Vector2d scroll_offset); |
269 gfx::Vector2d scroll_offset() const { return scroll_offset_; } | 269 gfx::Vector2d scroll_offset() const { return scroll_offset_; } |
270 | 270 |
271 void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); | 271 void SetMaxScrollOffset(gfx::Vector2d max_scroll_offset); |
272 gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } | 272 gfx::Vector2d max_scroll_offset() const { return max_scroll_offset_; } |
273 | 273 |
274 void SetScrollDelta(gfx::Vector2dF scroll_delta); | 274 void SetScrollDelta(gfx::Vector2dF scroll_delta); |
275 gfx::Vector2dF scroll_delta() const { return scroll_delta_; } | 275 gfx::Vector2dF scroll_delta() const { return scroll_delta_; } |
276 | 276 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 bool stacking_order_changed_; | 448 bool stacking_order_changed_; |
449 | 449 |
450 // Whether the "back" of this layer should draw. | 450 // Whether the "back" of this layer should draw. |
451 bool double_sided_; | 451 bool double_sided_; |
452 | 452 |
453 // Tracks if drawing-related properties have changed since last redraw. | 453 // Tracks if drawing-related properties have changed since last redraw. |
454 bool layer_property_changed_; | 454 bool layer_property_changed_; |
455 | 455 |
456 // Indicates that a property has changed on this layer that would not | 456 // Indicates that a property has changed on this layer that would not |
457 // affect the pixels on its target surface, but would require redrawing | 457 // affect the pixels on its target surface, but would require redrawing |
458 // the targetSurface onto its ancestor targetSurface. | 458 // the target_surface onto its ancestor target_surface. |
459 // For layers that do not own a surface this flag acts as | 459 // For layers that do not own a surface this flag acts as |
460 // layer_property_changed_. | 460 // layer_property_changed_. |
461 bool layer_surface_property_changed_; | 461 bool layer_surface_property_changed_; |
462 | 462 |
463 bool masks_to_bounds_; | 463 bool masks_to_bounds_; |
464 bool contents_opaque_; | 464 bool contents_opaque_; |
465 float opacity_; | 465 float opacity_; |
466 gfx::PointF position_; | 466 gfx::PointF position_; |
467 bool preserves_3d_; | 467 bool preserves_3d_; |
468 bool use_parent_backface_visibility_; | 468 bool use_parent_backface_visibility_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // Group of properties that need to be computed based on the layer tree | 519 // Group of properties that need to be computed based on the layer tree |
520 // hierarchy before layers can be drawn. | 520 // hierarchy before layers can be drawn. |
521 DrawProperties<LayerImpl, RenderSurfaceImpl> draw_properties_; | 521 DrawProperties<LayerImpl, RenderSurfaceImpl> draw_properties_; |
522 | 522 |
523 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 523 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
524 }; | 524 }; |
525 | 525 |
526 } | 526 } |
527 | 527 |
528 #endif // CC_LAYERS_LAYER_IMPL_H_ | 528 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |