Chromium Code Reviews| 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 // These methods typically need to be overwritten by derived classes. |
| 354 virtual bool DrawsContent() const; | 354 virtual bool DrawsContent() const; |
| 355 int NumDescendantsThatDrawContent() const; | |
|
danakj
2014/07/14 20:22:02
move this up above the // These methods need to be
awoloszyn
2014/07/16 20:44:20
Done.
| |
| 355 virtual void SavePaintProperties(); | 356 virtual void SavePaintProperties(); |
| 356 // Returns true iff any resources were updated that need to be committed. | 357 // Returns true iff any resources were updated that need to be committed. |
| 357 virtual bool Update(ResourceUpdateQueue* queue, | 358 virtual bool Update(ResourceUpdateQueue* queue, |
| 358 const OcclusionTracker<Layer>* occlusion); | 359 const OcclusionTracker<Layer>* occlusion); |
| 359 virtual bool NeedMoreUpdates(); | 360 virtual bool NeedMoreUpdates(); |
| 360 virtual void SetIsMask(bool is_mask) {} | 361 virtual void SetIsMask(bool is_mask) {} |
| 361 virtual void ReduceMemoryUsage() {} | 362 virtual void ReduceMemoryUsage() {} |
| 362 virtual void OnOutputSurfaceCreated() {} | 363 virtual void OnOutputSurfaceCreated() {} |
| 363 virtual bool IsSuitableForGpuRasterization() const; | 364 virtual bool IsSuitableForGpuRasterization() const; |
| 364 | 365 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 void SetNeedsCommit(); | 480 void SetNeedsCommit(); |
| 480 // Called when there's been a change in layer structure. Implies both | 481 // Called when there's been a change in layer structure. Implies both |
| 481 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. | 482 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. |
| 482 void SetNeedsFullTreeSync(); | 483 void SetNeedsFullTreeSync(); |
| 483 | 484 |
| 484 // Called when the next commit should wait until the pending tree is activated | 485 // 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 | 486 // before finishing the commit and unblocking the main thread. Used to ensure |
| 486 // unused resources on the impl thread are returned before commit completes. | 487 // unused resources on the impl thread are returned before commit completes. |
| 487 void SetNextCommitWaitsForActivation(); | 488 void SetNextCommitWaitsForActivation(); |
| 488 | 489 |
| 490 // Will relcalculate whether or not we draw content and set draws_content_ | |
| 491 // appropriately. | |
| 492 void UpdateDrawsContent(); | |
| 493 virtual bool HasDrawableContent() const; | |
| 494 | |
| 495 // Called when our number of drawable descendants changes. | |
| 496 void AddDrawableDescendants(int num); | |
| 497 | |
| 489 void AddDependentNeedsPushProperties(); | 498 void AddDependentNeedsPushProperties(); |
| 490 void RemoveDependentNeedsPushProperties(); | 499 void RemoveDependentNeedsPushProperties(); |
| 491 bool parent_should_know_need_push_properties() const { | 500 bool parent_should_know_need_push_properties() const { |
| 492 return needs_push_properties() || descendant_needs_push_properties(); | 501 return needs_push_properties() || descendant_needs_push_properties(); |
| 493 } | 502 } |
| 494 | 503 |
| 495 bool IsPropertyChangeAllowed() const; | 504 bool IsPropertyChangeAllowed() const; |
| 496 | 505 |
| 497 // If this layer has a scroll parent, it removes |this| from its list of | 506 // If this layer has a scroll parent, it removes |this| from its list of |
| 498 // scroll children. | 507 // scroll children. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 scoped_refptr<LayerAnimationController> layer_animation_controller_; | 581 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| 573 | 582 |
| 574 // Layer properties. | 583 // Layer properties. |
| 575 gfx::Size bounds_; | 584 gfx::Size bounds_; |
| 576 | 585 |
| 577 gfx::Vector2d scroll_offset_; | 586 gfx::Vector2d scroll_offset_; |
| 578 // This variable indicates which ancestor layer (if any) whose size, | 587 // This variable indicates which ancestor layer (if any) whose size, |
| 579 // transformed relative to this layer, defines the maximum scroll offset for | 588 // transformed relative to this layer, defines the maximum scroll offset for |
| 580 // this layer. | 589 // this layer. |
| 581 int scroll_clip_layer_id_; | 590 int scroll_clip_layer_id_; |
| 591 int num_descendants_that_draw_content_; | |
| 582 bool should_scroll_on_main_thread_ : 1; | 592 bool should_scroll_on_main_thread_ : 1; |
| 583 bool have_wheel_event_handlers_ : 1; | 593 bool have_wheel_event_handlers_ : 1; |
| 584 bool have_scroll_event_handlers_ : 1; | 594 bool have_scroll_event_handlers_ : 1; |
| 585 bool user_scrollable_horizontal_ : 1; | 595 bool user_scrollable_horizontal_ : 1; |
| 586 bool user_scrollable_vertical_ : 1; | 596 bool user_scrollable_vertical_ : 1; |
| 587 bool is_root_for_isolated_group_ : 1; | 597 bool is_root_for_isolated_group_ : 1; |
| 588 bool is_container_for_fixed_position_layers_ : 1; | 598 bool is_container_for_fixed_position_layers_ : 1; |
| 589 bool is_drawable_ : 1; | 599 bool is_drawable_ : 1; |
| 600 bool draws_content_ : 1; | |
| 590 bool hide_layer_and_subtree_ : 1; | 601 bool hide_layer_and_subtree_ : 1; |
| 591 bool masks_to_bounds_ : 1; | 602 bool masks_to_bounds_ : 1; |
| 592 bool contents_opaque_ : 1; | 603 bool contents_opaque_ : 1; |
| 593 bool double_sided_ : 1; | 604 bool double_sided_ : 1; |
| 594 bool should_flatten_transform_ : 1; | 605 bool should_flatten_transform_ : 1; |
| 595 bool use_parent_backface_visibility_ : 1; | 606 bool use_parent_backface_visibility_ : 1; |
| 596 bool draw_checkerboard_for_missing_tiles_ : 1; | 607 bool draw_checkerboard_for_missing_tiles_ : 1; |
| 597 bool force_render_surface_ : 1; | 608 bool force_render_surface_ : 1; |
| 598 bool transform_is_invertible_ : 1; | 609 bool transform_is_invertible_ : 1; |
| 599 Region non_fast_scrollable_region_; | 610 Region non_fast_scrollable_region_; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 629 DrawProperties<Layer> draw_properties_; | 640 DrawProperties<Layer> draw_properties_; |
| 630 | 641 |
| 631 PaintProperties paint_properties_; | 642 PaintProperties paint_properties_; |
| 632 | 643 |
| 633 DISALLOW_COPY_AND_ASSIGN(Layer); | 644 DISALLOW_COPY_AND_ASSIGN(Layer); |
| 634 }; | 645 }; |
| 635 | 646 |
| 636 } // namespace cc | 647 } // namespace cc |
| 637 | 648 |
| 638 #endif // CC_LAYERS_LAYER_H_ | 649 #endif // CC_LAYERS_LAYER_H_ |
| OLD | NEW |