OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 324 |
325 void set_use_parent_backface_visibility(bool use) { | 325 void set_use_parent_backface_visibility(bool use) { |
326 use_parent_backface_visibility_ = use; | 326 use_parent_backface_visibility_ = use; |
327 } | 327 } |
328 bool use_parent_backface_visibility() const { | 328 bool use_parent_backface_visibility() const { |
329 return use_parent_backface_visibility_; | 329 return use_parent_backface_visibility_; |
330 } | 330 } |
331 | 331 |
332 virtual void SetLayerTreeHost(LayerTreeHost* host); | 332 virtual void SetLayerTreeHost(LayerTreeHost* host); |
333 | 333 |
334 bool HasDelegatedContent() const { return false; } | 334 virtual bool HasDelegatedContent() const; |
335 bool HasContributingDelegatedRenderPasses() const { return false; } | 335 bool HasContributingDelegatedRenderPasses() const { return false; } |
336 | 336 |
337 void SetIsDrawable(bool is_drawable); | 337 void SetIsDrawable(bool is_drawable); |
338 | 338 |
339 void SetHideLayerAndSubtree(bool hide); | 339 void SetHideLayerAndSubtree(bool hide); |
340 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } | 340 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } |
341 | 341 |
342 void SetReplicaLayer(Layer* layer); | 342 void SetReplicaLayer(Layer* layer); |
343 Layer* replica_layer() { return replica_layer_.get(); } | 343 Layer* replica_layer() { return replica_layer_.get(); } |
344 const Layer* replica_layer() const { return replica_layer_.get(); } | 344 const Layer* replica_layer() const { return replica_layer_.get(); } |
345 | 345 |
346 bool has_mask() const { return !!mask_layer_.get(); } | 346 bool has_mask() const { return !!mask_layer_.get(); } |
347 bool has_replica() const { return !!replica_layer_.get(); } | 347 bool has_replica() const { return !!replica_layer_.get(); } |
348 bool replica_has_mask() const { | 348 bool replica_has_mask() const { |
349 return replica_layer_.get() && | 349 return replica_layer_.get() && |
350 (mask_layer_.get() || replica_layer_->mask_layer_.get()); | 350 (mask_layer_.get() || replica_layer_->mask_layer_.get()); |
351 } | 351 } |
352 | 352 |
353 // These methods typically need to be overwritten by derived classes. | 353 int NumDescendantsThatDrawContent() const; |
| 354 |
| 355 // This is only virtual for tests. |
| 356 // TODO(awoloszyn): Remove this once we no longer need it for tests |
354 virtual bool DrawsContent() const; | 357 virtual bool DrawsContent() const; |
| 358 |
| 359 // This methods typically need to be overwritten by derived classes. |
355 virtual void SavePaintProperties(); | 360 virtual void SavePaintProperties(); |
356 // Returns true iff any resources were updated that need to be committed. | 361 // Returns true iff any resources were updated that need to be committed. |
357 virtual bool Update(ResourceUpdateQueue* queue, | 362 virtual bool Update(ResourceUpdateQueue* queue, |
358 const OcclusionTracker<Layer>* occlusion); | 363 const OcclusionTracker<Layer>* occlusion); |
359 virtual bool NeedMoreUpdates(); | 364 virtual bool NeedMoreUpdates(); |
360 virtual void SetIsMask(bool is_mask) {} | 365 virtual void SetIsMask(bool is_mask) {} |
361 virtual void ReduceMemoryUsage() {} | 366 virtual void ReduceMemoryUsage() {} |
362 virtual void OnOutputSurfaceCreated() {} | 367 virtual void OnOutputSurfaceCreated() {} |
363 virtual bool IsSuitableForGpuRasterization() const; | 368 virtual bool IsSuitableForGpuRasterization() const; |
364 | 369 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 void SetNeedsCommit(); | 484 void SetNeedsCommit(); |
480 // Called when there's been a change in layer structure. Implies both | 485 // Called when there's been a change in layer structure. Implies both |
481 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. | 486 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. |
482 void SetNeedsFullTreeSync(); | 487 void SetNeedsFullTreeSync(); |
483 | 488 |
484 // Called when the next commit should wait until the pending tree is activated | 489 // Called when the next commit should wait until the pending tree is activated |
485 // before finishing the commit and unblocking the main thread. Used to ensure | 490 // before finishing the commit and unblocking the main thread. Used to ensure |
486 // unused resources on the impl thread are returned before commit completes. | 491 // unused resources on the impl thread are returned before commit completes. |
487 void SetNextCommitWaitsForActivation(); | 492 void SetNextCommitWaitsForActivation(); |
488 | 493 |
| 494 // Will recalculate whether the layer draws content and set draws_content_ |
| 495 // appropriately. |
| 496 void UpdateDrawsContent(bool has_drawable_content); |
| 497 virtual bool HasDrawableContent() const; |
| 498 |
| 499 // Called when the layer's number of drawable descendants changes. |
| 500 void AddDrawableDescendants(int num); |
| 501 |
489 void AddDependentNeedsPushProperties(); | 502 void AddDependentNeedsPushProperties(); |
490 void RemoveDependentNeedsPushProperties(); | 503 void RemoveDependentNeedsPushProperties(); |
491 bool parent_should_know_need_push_properties() const { | 504 bool parent_should_know_need_push_properties() const { |
492 return needs_push_properties() || descendant_needs_push_properties(); | 505 return needs_push_properties() || descendant_needs_push_properties(); |
493 } | 506 } |
494 | 507 |
495 bool IsPropertyChangeAllowed() const; | 508 bool IsPropertyChangeAllowed() const; |
496 | 509 |
497 // If this layer has a scroll parent, it removes |this| from its list of | 510 // If this layer has a scroll parent, it removes |this| from its list of |
498 // scroll children. | 511 // scroll children. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 scoped_refptr<LayerAnimationController> layer_animation_controller_; | 585 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
573 | 586 |
574 // Layer properties. | 587 // Layer properties. |
575 gfx::Size bounds_; | 588 gfx::Size bounds_; |
576 | 589 |
577 gfx::Vector2d scroll_offset_; | 590 gfx::Vector2d scroll_offset_; |
578 // This variable indicates which ancestor layer (if any) whose size, | 591 // This variable indicates which ancestor layer (if any) whose size, |
579 // transformed relative to this layer, defines the maximum scroll offset for | 592 // transformed relative to this layer, defines the maximum scroll offset for |
580 // this layer. | 593 // this layer. |
581 int scroll_clip_layer_id_; | 594 int scroll_clip_layer_id_; |
| 595 int num_descendants_that_draw_content_; |
582 bool should_scroll_on_main_thread_ : 1; | 596 bool should_scroll_on_main_thread_ : 1; |
583 bool have_wheel_event_handlers_ : 1; | 597 bool have_wheel_event_handlers_ : 1; |
584 bool have_scroll_event_handlers_ : 1; | 598 bool have_scroll_event_handlers_ : 1; |
585 bool user_scrollable_horizontal_ : 1; | 599 bool user_scrollable_horizontal_ : 1; |
586 bool user_scrollable_vertical_ : 1; | 600 bool user_scrollable_vertical_ : 1; |
587 bool is_root_for_isolated_group_ : 1; | 601 bool is_root_for_isolated_group_ : 1; |
588 bool is_container_for_fixed_position_layers_ : 1; | 602 bool is_container_for_fixed_position_layers_ : 1; |
589 bool is_drawable_ : 1; | 603 bool is_drawable_ : 1; |
| 604 bool draws_content_ : 1; |
590 bool hide_layer_and_subtree_ : 1; | 605 bool hide_layer_and_subtree_ : 1; |
591 bool masks_to_bounds_ : 1; | 606 bool masks_to_bounds_ : 1; |
592 bool contents_opaque_ : 1; | 607 bool contents_opaque_ : 1; |
593 bool double_sided_ : 1; | 608 bool double_sided_ : 1; |
594 bool should_flatten_transform_ : 1; | 609 bool should_flatten_transform_ : 1; |
595 bool use_parent_backface_visibility_ : 1; | 610 bool use_parent_backface_visibility_ : 1; |
596 bool draw_checkerboard_for_missing_tiles_ : 1; | 611 bool draw_checkerboard_for_missing_tiles_ : 1; |
597 bool force_render_surface_ : 1; | 612 bool force_render_surface_ : 1; |
598 bool transform_is_invertible_ : 1; | 613 bool transform_is_invertible_ : 1; |
599 Region non_fast_scrollable_region_; | 614 Region non_fast_scrollable_region_; |
(...skipping 29 matching lines...) Expand all Loading... |
629 DrawProperties<Layer> draw_properties_; | 644 DrawProperties<Layer> draw_properties_; |
630 | 645 |
631 PaintProperties paint_properties_; | 646 PaintProperties paint_properties_; |
632 | 647 |
633 DISALLOW_COPY_AND_ASSIGN(Layer); | 648 DISALLOW_COPY_AND_ASSIGN(Layer); |
634 }; | 649 }; |
635 | 650 |
636 } // namespace cc | 651 } // namespace cc |
637 | 652 |
638 #endif // CC_LAYERS_LAYER_H_ | 653 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |