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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); | 215 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); |
216 | 216 |
217 // Returns true if this layer has content to draw. | 217 // Returns true if this layer has content to draw. |
218 void SetDrawsContent(bool draws_content); | 218 void SetDrawsContent(bool draws_content); |
219 bool DrawsContent() const { return draws_content_; } | 219 bool DrawsContent() const { return draws_content_; } |
220 | 220 |
221 int NumDescendantsThatDrawContent() const; | 221 int NumDescendantsThatDrawContent() const; |
222 void SetHideLayerAndSubtree(bool hide); | 222 void SetHideLayerAndSubtree(bool hide); |
223 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } | 223 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } |
224 | 224 |
225 bool force_render_surface() const { return force_render_surface_; } | |
226 void SetForceRenderSurface(bool force) { force_render_surface_ = force; } | |
227 | |
228 void SetTransformOrigin(const gfx::Point3F& transform_origin); | 225 void SetTransformOrigin(const gfx::Point3F& transform_origin); |
229 gfx::Point3F transform_origin() const { return transform_origin_; } | 226 gfx::Point3F transform_origin() const { return transform_origin_; } |
230 | 227 |
231 void SetBackgroundColor(SkColor background_color); | 228 void SetBackgroundColor(SkColor background_color); |
232 SkColor background_color() const { return background_color_; } | 229 SkColor background_color() const { return background_color_; } |
233 // If contents_opaque(), return an opaque color else return a | 230 // If contents_opaque(), return an opaque color else return a |
234 // non-opaque color. Tries to return background_color(), if possible. | 231 // non-opaque color. Tries to return background_color(), if possible. |
235 SkColor SafeOpaqueBackgroundColor() const; | 232 SkColor SafeOpaqueBackgroundColor() const; |
236 | 233 |
237 void SetFilters(const FilterOperations& filters); | 234 void SetFilters(const FilterOperations& filters); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 293 } |
297 bool use_parent_backface_visibility() const { | 294 bool use_parent_backface_visibility() const { |
298 return use_parent_backface_visibility_; | 295 return use_parent_backface_visibility_; |
299 } | 296 } |
300 | 297 |
301 bool ShowDebugBorders() const; | 298 bool ShowDebugBorders() const; |
302 | 299 |
303 // These invalidate the host's render surface layer list. The caller | 300 // These invalidate the host's render surface layer list. The caller |
304 // is responsible for calling set_needs_update_draw_properties on the tree | 301 // is responsible for calling set_needs_update_draw_properties on the tree |
305 // so that its list can be recreated. | 302 // so that its list can be recreated. |
306 void CreateRenderSurface(); | |
307 void ClearRenderSurface(); | |
308 void ClearRenderSurfaceLayerList(); | 303 void ClearRenderSurfaceLayerList(); |
| 304 void SetHasRenderSurface(bool has_render_surface); |
| 305 |
| 306 RenderSurfaceImpl* render_surface() const { return render_surface_.get(); } |
309 | 307 |
310 DrawProperties<LayerImpl>& draw_properties() { | 308 DrawProperties<LayerImpl>& draw_properties() { |
311 return draw_properties_; | 309 return draw_properties_; |
312 } | 310 } |
313 const DrawProperties<LayerImpl>& draw_properties() const { | 311 const DrawProperties<LayerImpl>& draw_properties() const { |
314 return draw_properties_; | 312 return draw_properties_; |
315 } | 313 } |
316 | 314 |
317 // The following are shortcut accessors to get various information from | 315 // The following are shortcut accessors to get various information from |
318 // draw_properties_ | 316 // draw_properties_ |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 LayerImpl* render_target() { | 348 LayerImpl* render_target() { |
351 DCHECK(!draw_properties_.render_target || | 349 DCHECK(!draw_properties_.render_target || |
352 draw_properties_.render_target->render_surface()); | 350 draw_properties_.render_target->render_surface()); |
353 return draw_properties_.render_target; | 351 return draw_properties_.render_target; |
354 } | 352 } |
355 const LayerImpl* render_target() const { | 353 const LayerImpl* render_target() const { |
356 DCHECK(!draw_properties_.render_target || | 354 DCHECK(!draw_properties_.render_target || |
357 draw_properties_.render_target->render_surface()); | 355 draw_properties_.render_target->render_surface()); |
358 return draw_properties_.render_target; | 356 return draw_properties_.render_target; |
359 } | 357 } |
360 RenderSurfaceImpl* render_surface() const { | 358 |
361 return draw_properties_.render_surface.get(); | |
362 } | |
363 int num_unclipped_descendants() const { | 359 int num_unclipped_descendants() const { |
364 return draw_properties_.num_unclipped_descendants; | 360 return draw_properties_.num_unclipped_descendants; |
365 } | 361 } |
366 | 362 |
367 // The client should be responsible for setting bounds, content bounds and | 363 // The client should be responsible for setting bounds, content bounds and |
368 // contents scale to appropriate values. LayerImpl doesn't calculate any of | 364 // contents scale to appropriate values. LayerImpl doesn't calculate any of |
369 // them from the other values. | 365 // them from the other values. |
370 | 366 |
371 void SetBounds(const gfx::Size& bounds); | 367 void SetBounds(const gfx::Size& bounds); |
372 gfx::Size bounds() const; | 368 gfx::Size bounds() const; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark); | 556 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark); |
561 | 557 |
562 virtual void SetDebugInfo( | 558 virtual void SetDebugInfo( |
563 scoped_refptr<base::debug::ConvertableToTraceFormat> other); | 559 scoped_refptr<base::debug::ConvertableToTraceFormat> other); |
564 | 560 |
565 bool IsDrawnRenderSurfaceLayerListMember() const; | 561 bool IsDrawnRenderSurfaceLayerListMember() const; |
566 | 562 |
567 void Set3dSortingContextId(int id); | 563 void Set3dSortingContextId(int id); |
568 int sorting_context_id() { return sorting_context_id_; } | 564 int sorting_context_id() { return sorting_context_id_; } |
569 | 565 |
570 // TODO(vollick): These is temporary and will be removed as soon as render | |
571 // surface determinations are moved out of CDP. They only exist because | |
572 // certain logic depends on whether or not a layer would render to a separate | |
573 // surface, but CDP destroys surfaces and targets it doesn't need, so without | |
574 // this boolean, this is impossible to determine after the fact without | |
575 // wastefully recomputing it. | |
576 void SetHasRenderSurface(bool value) {} | |
577 | |
578 protected: | 566 protected: |
579 LayerImpl(LayerTreeImpl* layer_impl, int id); | 567 LayerImpl(LayerTreeImpl* layer_impl, int id); |
580 | 568 |
581 // Get the color and size of the layer's debug border. | 569 // Get the color and size of the layer's debug border. |
582 virtual void GetDebugBorderProperties(SkColor* color, float* width) const; | 570 virtual void GetDebugBorderProperties(SkColor* color, float* width) const; |
583 | 571 |
584 void AppendDebugBorderQuad(RenderPass* render_pass, | 572 void AppendDebugBorderQuad(RenderPass* render_pass, |
585 const gfx::Size& content_bounds, | 573 const gfx::Size& content_bounds, |
586 const SharedQuadState* shared_quad_state, | 574 const SharedQuadState* shared_quad_state, |
587 AppendQuadsData* append_quads_data) const; | 575 AppendQuadsData* append_quads_data) const; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // Tracks if drawing-related properties have changed since last redraw. | 636 // Tracks if drawing-related properties have changed since last redraw. |
649 bool layer_property_changed_ : 1; | 637 bool layer_property_changed_ : 1; |
650 | 638 |
651 bool masks_to_bounds_ : 1; | 639 bool masks_to_bounds_ : 1; |
652 bool contents_opaque_ : 1; | 640 bool contents_opaque_ : 1; |
653 bool is_root_for_isolated_group_ : 1; | 641 bool is_root_for_isolated_group_ : 1; |
654 bool use_parent_backface_visibility_ : 1; | 642 bool use_parent_backface_visibility_ : 1; |
655 bool draw_checkerboard_for_missing_tiles_ : 1; | 643 bool draw_checkerboard_for_missing_tiles_ : 1; |
656 bool draws_content_ : 1; | 644 bool draws_content_ : 1; |
657 bool hide_layer_and_subtree_ : 1; | 645 bool hide_layer_and_subtree_ : 1; |
658 bool force_render_surface_ : 1; | |
659 | 646 |
660 // Cache transform_'s invertibility. | 647 // Cache transform_'s invertibility. |
661 bool transform_is_invertible_ : 1; | 648 bool transform_is_invertible_ : 1; |
662 | 649 |
663 // Set for the layer that other layers are fixed to. | 650 // Set for the layer that other layers are fixed to. |
664 bool is_container_for_fixed_position_layers_ : 1; | 651 bool is_container_for_fixed_position_layers_ : 1; |
665 Region non_fast_scrollable_region_; | 652 Region non_fast_scrollable_region_; |
666 Region touch_event_handler_region_; | 653 Region touch_event_handler_region_; |
667 SkColor background_color_; | 654 SkColor background_color_; |
668 | 655 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 | 709 |
723 scoped_ptr<ScrollbarSet> scrollbars_; | 710 scoped_ptr<ScrollbarSet> scrollbars_; |
724 | 711 |
725 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 712 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
726 | 713 |
727 // Group of properties that need to be computed based on the layer tree | 714 // Group of properties that need to be computed based on the layer tree |
728 // hierarchy before layers can be drawn. | 715 // hierarchy before layers can be drawn. |
729 DrawProperties<LayerImpl> draw_properties_; | 716 DrawProperties<LayerImpl> draw_properties_; |
730 | 717 |
731 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; | 718 scoped_refptr<base::debug::ConvertableToTraceFormat> debug_info_; |
732 | 719 scoped_ptr<RenderSurfaceImpl> render_surface_; |
733 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 720 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
734 }; | 721 }; |
735 | 722 |
736 } // namespace cc | 723 } // namespace cc |
737 | 724 |
738 #endif // CC_LAYERS_LAYER_IMPL_H_ | 725 #endif // CC_LAYERS_LAYER_IMPL_H_ |
OLD | NEW |