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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); | 211 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); |
212 | 212 |
213 // Returns true if this layer has content to draw. | 213 // Returns true if this layer has content to draw. |
214 void SetDrawsContent(bool draws_content); | 214 void SetDrawsContent(bool draws_content); |
215 bool DrawsContent() const { return draws_content_; } | 215 bool DrawsContent() const { return draws_content_; } |
216 | 216 |
217 int NumDescendantsThatDrawContent() const; | 217 int NumDescendantsThatDrawContent() const; |
218 void SetHideLayerAndSubtree(bool hide); | 218 void SetHideLayerAndSubtree(bool hide); |
219 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } | 219 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } |
220 | 220 |
221 bool force_render_surface() const { return force_render_surface_; } | |
222 void SetForceRenderSurface(bool force) { force_render_surface_ = force; } | |
223 | |
224 void SetTransformOrigin(const gfx::Point3F& transform_origin); | 221 void SetTransformOrigin(const gfx::Point3F& transform_origin); |
225 gfx::Point3F transform_origin() const { return transform_origin_; } | 222 gfx::Point3F transform_origin() const { return transform_origin_; } |
226 | 223 |
227 void SetBackgroundColor(SkColor background_color); | 224 void SetBackgroundColor(SkColor background_color); |
228 SkColor background_color() const { return background_color_; } | 225 SkColor background_color() const { return background_color_; } |
229 // If contents_opaque(), return an opaque color else return a | 226 // If contents_opaque(), return an opaque color else return a |
230 // non-opaque color. Tries to return background_color(), if possible. | 227 // non-opaque color. Tries to return background_color(), if possible. |
231 SkColor SafeOpaqueBackgroundColor() const; | 228 SkColor SafeOpaqueBackgroundColor() const; |
232 | 229 |
233 void SetFilters(const FilterOperations& filters); | 230 void SetFilters(const FilterOperations& filters); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
292 } | 289 } |
293 bool use_parent_backface_visibility() const { | 290 bool use_parent_backface_visibility() const { |
294 return use_parent_backface_visibility_; | 291 return use_parent_backface_visibility_; |
295 } | 292 } |
296 | 293 |
297 bool ShowDebugBorders() const; | 294 bool ShowDebugBorders() const; |
298 | 295 |
299 // These invalidate the host's render surface layer list. The caller | 296 // These invalidate the host's render surface layer list. The caller |
300 // is responsible for calling set_needs_update_draw_properties on the tree | 297 // is responsible for calling set_needs_update_draw_properties on the tree |
301 // so that its list can be recreated. | 298 // so that its list can be recreated. |
302 void CreateRenderSurface(); | |
303 void ClearRenderSurface(); | |
304 void ClearRenderSurfaceLayerList(); | 299 void ClearRenderSurfaceLayerList(); |
300 void SetHasRenderSurface(bool has_render_surface); | |
305 | 301 |
306 DrawProperties<LayerImpl>& draw_properties() { | 302 DrawProperties<LayerImpl>& draw_properties() { |
307 return draw_properties_; | 303 return draw_properties_; |
308 } | 304 } |
309 const DrawProperties<LayerImpl>& draw_properties() const { | 305 const DrawProperties<LayerImpl>& draw_properties() const { |
310 return draw_properties_; | 306 return draw_properties_; |
311 } | 307 } |
312 | 308 |
313 // The following are shortcut accessors to get various information from | 309 // The following are shortcut accessors to get various information from |
314 // draw_properties_ | 310 // draw_properties_ |
(...skipping 28 matching lines...) Expand all Loading... | |
343 LayerImpl* render_target() { | 339 LayerImpl* render_target() { |
344 DCHECK(!draw_properties_.render_target || | 340 DCHECK(!draw_properties_.render_target || |
345 draw_properties_.render_target->render_surface()); | 341 draw_properties_.render_target->render_surface()); |
346 return draw_properties_.render_target; | 342 return draw_properties_.render_target; |
347 } | 343 } |
348 const LayerImpl* render_target() const { | 344 const LayerImpl* render_target() const { |
349 DCHECK(!draw_properties_.render_target || | 345 DCHECK(!draw_properties_.render_target || |
350 draw_properties_.render_target->render_surface()); | 346 draw_properties_.render_target->render_surface()); |
351 return draw_properties_.render_target; | 347 return draw_properties_.render_target; |
352 } | 348 } |
353 RenderSurfaceImpl* render_surface() const { | 349 RenderSurfaceImpl* render_surface() const { return render_surface_.get(); } |
danakj
2014/09/03 19:30:33
nit: move this out of the set of draw_props getter
awoloszyn
2014/09/09 15:31:35
Done.
| |
354 return draw_properties_.render_surface.get(); | |
355 } | |
356 int num_unclipped_descendants() const { | 350 int num_unclipped_descendants() const { |
357 return draw_properties_.num_unclipped_descendants; | 351 return draw_properties_.num_unclipped_descendants; |
358 } | 352 } |
359 | 353 |
360 // The client should be responsible for setting bounds, content bounds and | 354 // The client should be responsible for setting bounds, content bounds and |
361 // contents scale to appropriate values. LayerImpl doesn't calculate any of | 355 // contents scale to appropriate values. LayerImpl doesn't calculate any of |
362 // them from the other values. | 356 // them from the other values. |
363 | 357 |
364 void SetBounds(const gfx::Size& bounds); | 358 void SetBounds(const gfx::Size& bounds); |
365 gfx::Size bounds() const; | 359 gfx::Size bounds() const; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 // Tracks if drawing-related properties have changed since last redraw. | 616 // Tracks if drawing-related properties have changed since last redraw. |
623 bool layer_property_changed_ : 1; | 617 bool layer_property_changed_ : 1; |
624 | 618 |
625 bool masks_to_bounds_ : 1; | 619 bool masks_to_bounds_ : 1; |
626 bool contents_opaque_ : 1; | 620 bool contents_opaque_ : 1; |
627 bool is_root_for_isolated_group_ : 1; | 621 bool is_root_for_isolated_group_ : 1; |
628 bool use_parent_backface_visibility_ : 1; | 622 bool use_parent_backface_visibility_ : 1; |
629 bool draw_checkerboard_for_missing_tiles_ : 1; | 623 bool draw_checkerboard_for_missing_tiles_ : 1; |
630 bool draws_content_ : 1; | 624 bool draws_content_ : 1; |
631 bool hide_layer_and_subtree_ : 1; | 625 bool hide_layer_and_subtree_ : 1; |
632 bool force_render_surface_ : 1; | |
633 | 626 |
634 // Cache transform_'s invertibility. | 627 // Cache transform_'s invertibility. |
635 bool transform_is_invertible_ : 1; | 628 bool transform_is_invertible_ : 1; |
636 | 629 |
637 // Set for the layer that other layers are fixed to. | 630 // Set for the layer that other layers are fixed to. |
638 bool is_container_for_fixed_position_layers_ : 1; | 631 bool is_container_for_fixed_position_layers_ : 1; |
639 Region non_fast_scrollable_region_; | 632 Region non_fast_scrollable_region_; |
640 Region touch_event_handler_region_; | 633 Region touch_event_handler_region_; |
641 SkColor background_color_; | 634 SkColor background_color_; |
642 | 635 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
696 | 689 |
697 scoped_ptr<ScrollbarSet> scrollbars_; | 690 scoped_ptr<ScrollbarSet> scrollbars_; |
698 | 691 |
699 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 692 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
700 | 693 |
701 // Group of properties that need to be computed based on the layer tree | 694 // Group of properties that need to be computed based on the layer tree |
702 // hierarchy before layers can be drawn. | 695 // hierarchy before layers can be drawn. |
703 DrawProperties<LayerImpl> draw_properties_; | 696 DrawProperties<LayerImpl> draw_properties_; |
704 | 697 |
705 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; | 698 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; |
706 | 699 scoped_ptr<RenderSurfaceImpl> render_surface_; |
707 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 700 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
708 }; | 701 }; |
709 | 702 |
710 } // namespace cc | 703 } // namespace cc |
711 | 704 |
712 #endif // CC_LAYERS_LAYER_IMPL_H_ | 705 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |