| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 bool is_clipped() const { return draw_properties_.is_clipped; } | 154 bool is_clipped() const { return draw_properties_.is_clipped; } |
| 155 | 155 |
| 156 void UpdatePropertyTreeTransform(); | 156 void UpdatePropertyTreeTransform(); |
| 157 void UpdatePropertyTreeTransformIsAnimated(bool is_animated); | 157 void UpdatePropertyTreeTransformIsAnimated(bool is_animated); |
| 158 void UpdatePropertyTreeOpacity(); | 158 void UpdatePropertyTreeOpacity(); |
| 159 void UpdatePropertyTreeScrollOffset(); | 159 void UpdatePropertyTreeScrollOffset(); |
| 160 | 160 |
| 161 // For compatibility with Layer. | 161 // For compatibility with Layer. |
| 162 bool has_render_surface() const { return !!render_surface(); } | 162 bool has_render_surface() const { return !!render_surface(); } |
| 163 void SetNumDescendantsThatDrawContent(int num_descendants); | |
| 164 void SetClipParent(LayerImpl* ancestor); | 163 void SetClipParent(LayerImpl* ancestor); |
| 165 | 164 |
| 166 LayerImpl* clip_parent() { | 165 LayerImpl* clip_parent() { |
| 167 return clip_parent_; | 166 return clip_parent_; |
| 168 } | 167 } |
| 169 | 168 |
| 170 void SetClipChildren(std::set<LayerImpl*>* children); | 169 void SetClipChildren(std::set<LayerImpl*>* children); |
| 171 | 170 |
| 172 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); } | 171 std::set<LayerImpl*>* clip_children() { return clip_children_.get(); } |
| 173 const std::set<LayerImpl*>* clip_children() const { | 172 const std::set<LayerImpl*>* clip_children() const { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 gfx::Size* resource_size) const; | 224 gfx::Size* resource_size) const; |
| 226 | 225 |
| 227 virtual void NotifyTileStateChanged(const Tile* tile) {} | 226 virtual void NotifyTileStateChanged(const Tile* tile) {} |
| 228 | 227 |
| 229 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); | 228 virtual ScrollbarLayerImplBase* ToScrollbarLayer(); |
| 230 | 229 |
| 231 // Returns true if this layer has content to draw. | 230 // Returns true if this layer has content to draw. |
| 232 void SetDrawsContent(bool draws_content); | 231 void SetDrawsContent(bool draws_content); |
| 233 bool DrawsContent() const { return draws_content_; } | 232 bool DrawsContent() const { return draws_content_; } |
| 234 | 233 |
| 235 int NumDescendantsThatDrawContent() const; | |
| 236 void SetHideLayerAndSubtree(bool hide); | 234 void SetHideLayerAndSubtree(bool hide); |
| 237 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } | 235 bool hide_layer_and_subtree() const { return hide_layer_and_subtree_; } |
| 238 | 236 |
| 239 LayerImplTestProperties* test_properties() { | 237 LayerImplTestProperties* test_properties() { |
| 240 if (!test_properties_) | 238 if (!test_properties_) |
| 241 test_properties_.reset(new LayerImplTestProperties()); | 239 test_properties_.reset(new LayerImplTestProperties()); |
| 242 return test_properties_.get(); | 240 return test_properties_.get(); |
| 243 } | 241 } |
| 244 | 242 |
| 245 void SetBackgroundColor(SkColor background_color); | 243 void SetBackgroundColor(SkColor background_color); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 if (draw_blend_mode_ == blend_mode) | 283 if (draw_blend_mode_ == blend_mode) |
| 286 return; | 284 return; |
| 287 draw_blend_mode_ = blend_mode; | 285 draw_blend_mode_ = blend_mode; |
| 288 SetNeedsPushProperties(); | 286 SetNeedsPushProperties(); |
| 289 } | 287 } |
| 290 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; } | 288 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; } |
| 291 bool uses_default_blend_mode() const { | 289 bool uses_default_blend_mode() const { |
| 292 return blend_mode_ == SkXfermode::kSrcOver_Mode; | 290 return blend_mode_ == SkXfermode::kSrcOver_Mode; |
| 293 } | 291 } |
| 294 | 292 |
| 295 void SetIsRootForIsolatedGroup(bool root); | |
| 296 bool is_root_for_isolated_group() const { | |
| 297 return is_root_for_isolated_group_; | |
| 298 } | |
| 299 | |
| 300 void SetPosition(const gfx::PointF& position); | 293 void SetPosition(const gfx::PointF& position); |
| 301 gfx::PointF position() const { return position_; } | 294 gfx::PointF position() const { return position_; } |
| 302 | 295 |
| 303 void SetIsContainerForFixedPositionLayers(bool container) { | |
| 304 is_container_for_fixed_position_layers_ = container; | |
| 305 } | |
| 306 // This is a non-trivial function in Layer. | |
| 307 bool IsContainerForFixedPositionLayers() const { | |
| 308 return is_container_for_fixed_position_layers_; | |
| 309 } | |
| 310 | |
| 311 bool IsAffectedByPageScale() const; | 296 bool IsAffectedByPageScale() const; |
| 312 | 297 |
| 313 gfx::Vector2dF FixedContainerSizeDelta() const; | 298 gfx::Vector2dF FixedContainerSizeDelta() const; |
| 314 | 299 |
| 315 void SetPositionConstraint(const LayerPositionConstraint& constraint) { | |
| 316 position_constraint_ = constraint; | |
| 317 } | |
| 318 const LayerPositionConstraint& position_constraint() const { | |
| 319 return position_constraint_; | |
| 320 } | |
| 321 | |
| 322 void SetShouldFlattenTransform(bool flatten); | |
| 323 bool should_flatten_transform() const { return should_flatten_transform_; } | |
| 324 | |
| 325 bool Is3dSorted() const { return sorting_context_id_ != 0; } | 300 bool Is3dSorted() const { return sorting_context_id_ != 0; } |
| 326 | 301 |
| 327 void SetUseParentBackfaceVisibility(bool use) { | 302 void SetUseParentBackfaceVisibility(bool use) { |
| 328 use_parent_backface_visibility_ = use; | 303 use_parent_backface_visibility_ = use; |
| 329 } | 304 } |
| 330 bool use_parent_backface_visibility() const { | 305 bool use_parent_backface_visibility() const { |
| 331 return use_parent_backface_visibility_; | 306 return use_parent_backface_visibility_; |
| 332 } | 307 } |
| 333 | 308 |
| 334 void SetUseLocalTransformForBackfaceVisibility(bool use_local) { | 309 void SetUseLocalTransformForBackfaceVisibility(bool use_local) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 return touch_event_handler_region_; | 429 return touch_event_handler_region_; |
| 455 } | 430 } |
| 456 | 431 |
| 457 void SetTransform(const gfx::Transform& transform); | 432 void SetTransform(const gfx::Transform& transform); |
| 458 const gfx::Transform& transform() const { return transform_; } | 433 const gfx::Transform& transform() const { return transform_; } |
| 459 bool TransformIsAnimating() const; | 434 bool TransformIsAnimating() const; |
| 460 bool HasPotentiallyRunningTransformAnimation() const; | 435 bool HasPotentiallyRunningTransformAnimation() const; |
| 461 bool TransformIsAnimatingOnImplOnly() const; | 436 bool TransformIsAnimatingOnImplOnly() const; |
| 462 bool HasOnlyTranslationTransforms() const; | 437 bool HasOnlyTranslationTransforms() const; |
| 463 bool AnimationsPreserveAxisAlignment() const; | 438 bool AnimationsPreserveAxisAlignment() const; |
| 464 void SetTransformAndInvertibility(const gfx::Transform& transform, | |
| 465 bool transform_is_invertible); | |
| 466 bool transform_is_invertible() const { return transform_is_invertible_; } | |
| 467 | 439 |
| 468 bool MaximumTargetScale(float* max_scale) const; | 440 bool MaximumTargetScale(float* max_scale) const; |
| 469 bool AnimationStartScale(float* start_scale) const; | 441 bool AnimationStartScale(float* start_scale) const; |
| 470 | 442 |
| 471 // This includes all animations, even those that are finished but haven't yet | 443 // This includes all animations, even those that are finished but haven't yet |
| 472 // been deleted. | 444 // been deleted. |
| 473 bool HasAnyAnimationTargetingProperty(TargetProperty::Type property) const; | 445 bool HasAnyAnimationTargetingProperty(TargetProperty::Type property) const; |
| 474 | 446 |
| 475 bool HasFilterAnimationThatInflatesBounds() const; | 447 bool HasFilterAnimationThatInflatesBounds() const; |
| 476 bool HasTransformAnimationThatInflatesBounds() const; | 448 bool HasTransformAnimationThatInflatesBounds() const; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 613 |
| 642 // Properties synchronized from the associated Layer. | 614 // Properties synchronized from the associated Layer. |
| 643 gfx::Size bounds_; | 615 gfx::Size bounds_; |
| 644 int scroll_clip_layer_id_; | 616 int scroll_clip_layer_id_; |
| 645 | 617 |
| 646 gfx::Vector2dF offset_to_transform_parent_; | 618 gfx::Vector2dF offset_to_transform_parent_; |
| 647 uint32_t main_thread_scrolling_reasons_; | 619 uint32_t main_thread_scrolling_reasons_; |
| 648 | 620 |
| 649 bool user_scrollable_horizontal_ : 1; | 621 bool user_scrollable_horizontal_ : 1; |
| 650 bool user_scrollable_vertical_ : 1; | 622 bool user_scrollable_vertical_ : 1; |
| 651 bool should_flatten_transform_ : 1; | |
| 652 bool should_flatten_transform_from_property_tree_ : 1; | 623 bool should_flatten_transform_from_property_tree_ : 1; |
| 653 | 624 |
| 654 // Tracks if drawing-related properties have changed since last redraw. | 625 // Tracks if drawing-related properties have changed since last redraw. |
| 655 bool layer_property_changed_ : 1; | 626 bool layer_property_changed_ : 1; |
| 656 | 627 |
| 657 bool masks_to_bounds_ : 1; | 628 bool masks_to_bounds_ : 1; |
| 658 bool contents_opaque_ : 1; | 629 bool contents_opaque_ : 1; |
| 659 bool is_root_for_isolated_group_ : 1; | |
| 660 bool use_parent_backface_visibility_ : 1; | 630 bool use_parent_backface_visibility_ : 1; |
| 661 bool use_local_transform_for_backface_visibility_ : 1; | 631 bool use_local_transform_for_backface_visibility_ : 1; |
| 662 bool should_check_backface_visibility_ : 1; | 632 bool should_check_backface_visibility_ : 1; |
| 663 bool draws_content_ : 1; | 633 bool draws_content_ : 1; |
| 664 bool hide_layer_and_subtree_ : 1; | 634 bool hide_layer_and_subtree_ : 1; |
| 665 | 635 |
| 666 // Cache transform_'s invertibility. | |
| 667 bool transform_is_invertible_ : 1; | |
| 668 | |
| 669 // Set for the layer that other layers are fixed to. | |
| 670 bool is_container_for_fixed_position_layers_ : 1; | |
| 671 | |
| 672 bool is_affected_by_page_scale_ : 1; | 636 bool is_affected_by_page_scale_ : 1; |
| 673 | 637 |
| 674 // This is true if and only if the layer was ever ready since it last animated | 638 // This is true if and only if the layer was ever ready since it last animated |
| 675 // (all content was complete). | 639 // (all content was complete). |
| 676 bool was_ever_ready_since_last_transform_animation_ : 1; | 640 bool was_ever_ready_since_last_transform_animation_ : 1; |
| 677 | 641 |
| 678 Region non_fast_scrollable_region_; | 642 Region non_fast_scrollable_region_; |
| 679 Region touch_event_handler_region_; | 643 Region touch_event_handler_region_; |
| 680 SkColor background_color_; | 644 SkColor background_color_; |
| 681 SkColor safe_opaque_background_color_; | 645 SkColor safe_opaque_background_color_; |
| 682 | 646 |
| 683 float opacity_; | 647 float opacity_; |
| 684 SkXfermode::Mode blend_mode_; | 648 SkXfermode::Mode blend_mode_; |
| 685 // draw_blend_mode may be different than blend_mode_, | 649 // draw_blend_mode may be different than blend_mode_, |
| 686 // when a RenderSurface re-parents the layer's blend_mode. | 650 // when a RenderSurface re-parents the layer's blend_mode. |
| 687 SkXfermode::Mode draw_blend_mode_; | 651 SkXfermode::Mode draw_blend_mode_; |
| 688 gfx::PointF position_; | 652 gfx::PointF position_; |
| 689 gfx::Transform transform_; | 653 gfx::Transform transform_; |
| 690 | 654 |
| 691 LayerPositionConstraint position_constraint_; | |
| 692 | |
| 693 int num_descendants_that_draw_content_; | |
| 694 | |
| 695 gfx::Rect clip_rect_in_target_space_; | 655 gfx::Rect clip_rect_in_target_space_; |
| 696 int transform_tree_index_; | 656 int transform_tree_index_; |
| 697 int effect_tree_index_; | 657 int effect_tree_index_; |
| 698 int clip_tree_index_; | 658 int clip_tree_index_; |
| 699 int scroll_tree_index_; | 659 int scroll_tree_index_; |
| 700 | 660 |
| 701 FilterOperations filters_; | 661 FilterOperations filters_; |
| 702 FilterOperations background_filters_; | 662 FilterOperations background_filters_; |
| 703 | 663 |
| 704 protected: | 664 protected: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 bool scrolls_drawn_descendant_; | 698 bool scrolls_drawn_descendant_; |
| 739 // If true, the layer or one of its descendants has a touch handler. | 699 // If true, the layer or one of its descendants has a touch handler. |
| 740 bool layer_or_descendant_has_touch_handler_; | 700 bool layer_or_descendant_has_touch_handler_; |
| 741 | 701 |
| 742 DISALLOW_COPY_AND_ASSIGN(LayerImpl); | 702 DISALLOW_COPY_AND_ASSIGN(LayerImpl); |
| 743 }; | 703 }; |
| 744 | 704 |
| 745 } // namespace cc | 705 } // namespace cc |
| 746 | 706 |
| 747 #endif // CC_LAYERS_LAYER_IMPL_H_ | 707 #endif // CC_LAYERS_LAYER_IMPL_H_ |
| OLD | NEW |