OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TREES_PROPERTY_TREE_H_ | 5 #ifndef CC_TREES_PROPERTY_TREE_H_ |
6 #define CC_TREES_PROPERTY_TREE_H_ | 6 #define CC_TREES_PROPERTY_TREE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void SetPropertyTrees(PropertyTrees* property_trees) { | 93 void SetPropertyTrees(PropertyTrees* property_trees) { |
94 property_trees_ = property_trees; | 94 property_trees_ = property_trees; |
95 } | 95 } |
96 PropertyTrees* property_trees() const { return property_trees_; } | 96 PropertyTrees* property_trees() const { return property_trees_; } |
97 | 97 |
98 void AsValueInto(base::trace_event::TracedValue* value) const; | 98 void AsValueInto(base::trace_event::TracedValue* value) const; |
99 | 99 |
100 private: | 100 private: |
101 std::vector<T> nodes_; | 101 std::vector<T> nodes_; |
102 | 102 |
| 103 friend class ClipTree; |
103 friend class TransformTree; | 104 friend class TransformTree; |
104 bool needs_update_; | 105 bool needs_update_; |
105 PropertyTrees* property_trees_; | 106 PropertyTrees* property_trees_; |
106 }; | 107 }; |
107 | 108 |
108 struct StickyPositionNodeData { | 109 struct StickyPositionNodeData { |
109 int scroll_ancestor; | 110 int scroll_ancestor; |
110 LayerStickyPositionConstraint constraints; | 111 LayerStickyPositionConstraint constraints; |
111 | 112 |
112 // This is the offset that blink has already applied to counteract the main | 113 // This is the offset that blink has already applied to counteract the main |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 }; | 280 }; |
280 | 281 |
281 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { | 282 class CC_EXPORT ClipTree final : public PropertyTree<ClipNode> { |
282 public: | 283 public: |
283 bool operator==(const ClipTree& other) const; | 284 bool operator==(const ClipTree& other) const; |
284 | 285 |
285 static const int kViewportNodeId = 1; | 286 static const int kViewportNodeId = 1; |
286 | 287 |
287 void SetViewportClip(gfx::RectF viewport_rect); | 288 void SetViewportClip(gfx::RectF viewport_rect); |
288 gfx::RectF ViewportClip() const; | 289 gfx::RectF ViewportClip() const; |
| 290 void set_needs_update(bool needs_update); |
289 }; | 291 }; |
290 | 292 |
291 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> { | 293 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> { |
292 public: | 294 public: |
293 EffectTree(); | 295 EffectTree(); |
294 ~EffectTree(); | 296 ~EffectTree(); |
295 | 297 |
296 EffectTree& operator=(const EffectTree& from); | 298 EffectTree& operator=(const EffectTree& from); |
297 bool operator==(const EffectTree& other) const; | 299 bool operator==(const EffectTree& other) const; |
298 | 300 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 DrawTransforms transforms; | 529 DrawTransforms transforms; |
528 | 530 |
529 // TODO(sunxd): Move screen space transforms here if it can improve | 531 // TODO(sunxd): Move screen space transforms here if it can improve |
530 // performance. | 532 // performance. |
531 DrawTransformData() | 533 DrawTransformData() |
532 : update_number(-1), | 534 : update_number(-1), |
533 target_id(EffectTree::kInvalidNodeId), | 535 target_id(EffectTree::kInvalidNodeId), |
534 transforms(gfx::Transform(), gfx::Transform()) {} | 536 transforms(gfx::Transform(), gfx::Transform()) {} |
535 }; | 537 }; |
536 | 538 |
| 539 struct ConditionalClip { |
| 540 bool is_clipped; |
| 541 gfx::RectF clip_rect; |
| 542 }; |
| 543 |
| 544 struct ClipRectData { |
| 545 int update_number; |
| 546 int target_id; |
| 547 ConditionalClip clip; |
| 548 |
| 549 ClipRectData() : update_number(-1), target_id(-1) {} |
| 550 }; |
| 551 |
| 552 struct VisibleRectData { |
| 553 int update_number; |
| 554 gfx::RectF visible_rect; |
| 555 |
| 556 VisibleRectData() : update_number(-1) {} |
| 557 }; |
| 558 |
537 struct PropertyTreesCachedData { | 559 struct PropertyTreesCachedData { |
538 int transform_tree_update_number; | 560 int transform_tree_update_number; |
| 561 int clip_tree_update_number; |
539 std::vector<AnimationScaleData> animation_scales; | 562 std::vector<AnimationScaleData> animation_scales; |
540 mutable std::vector<std::vector<DrawTransformData>> draw_transforms; | 563 mutable std::vector<std::vector<DrawTransformData>> draw_transforms; |
| 564 mutable std::vector<std::vector<ClipRectData>> clip_rects; |
| 565 mutable std::vector<VisibleRectData> visible_rects; |
541 | 566 |
542 PropertyTreesCachedData(); | 567 PropertyTreesCachedData(); |
543 ~PropertyTreesCachedData(); | 568 ~PropertyTreesCachedData(); |
544 }; | 569 }; |
545 | 570 |
546 class CC_EXPORT PropertyTrees final { | 571 class CC_EXPORT PropertyTrees final { |
547 public: | 572 public: |
548 PropertyTrees(); | 573 PropertyTrees(); |
549 PropertyTrees(const PropertyTrees& other) = delete; | 574 PropertyTrees(const PropertyTrees& other) = delete; |
550 ~PropertyTrees(); | 575 ~PropertyTrees(); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 654 |
630 bool GetToTarget(int transform_id, | 655 bool GetToTarget(int transform_id, |
631 int effect_id, | 656 int effect_id, |
632 gfx::Transform* to_target) const; | 657 gfx::Transform* to_target) const; |
633 bool GetFromTarget(int transform_id, | 658 bool GetFromTarget(int transform_id, |
634 int effect_id, | 659 int effect_id, |
635 gfx::Transform* from_target) const; | 660 gfx::Transform* from_target) const; |
636 | 661 |
637 void ResetCachedData(); | 662 void ResetCachedData(); |
638 void UpdateTransformTreeUpdateNumber(); | 663 void UpdateTransformTreeUpdateNumber(); |
| 664 void UpdateClipTreeUpdateNumber(); |
639 gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale( | 665 gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale( |
640 int transform_id, | 666 int transform_id, |
641 int effect_id) const; | 667 int effect_id) const; |
642 | 668 |
643 bool ComputeTransformFromTarget(int transform_id, | 669 bool ComputeTransformFromTarget(int transform_id, |
644 int effect_id, | 670 int effect_id, |
645 gfx::Transform* transform) const; | 671 gfx::Transform* transform) const; |
646 | 672 |
| 673 ConditionalClip& FetchClipRectFromCache(int clip_id, |
| 674 int target_id, |
| 675 int cache_index) const; |
| 676 int ClipRectCacheId(int clip_id, int target_id) const; |
| 677 void AddToClipRectCache(int clip_id, |
| 678 int target_id, |
| 679 const ConditionalClip& clip); |
| 680 bool IsInVisibleRectCache(int clip_id) const; |
| 681 gfx::RectF FetchVisibleRectFromCache(int clip_id) const; |
| 682 void AddToVisibleRectCache(int clip_id, const gfx::RectF& rect); |
| 683 |
647 private: | 684 private: |
648 gfx::Vector2dF inner_viewport_container_bounds_delta_; | 685 gfx::Vector2dF inner_viewport_container_bounds_delta_; |
649 gfx::Vector2dF outer_viewport_container_bounds_delta_; | 686 gfx::Vector2dF outer_viewport_container_bounds_delta_; |
650 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; | 687 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; |
651 | 688 |
652 // GetDrawTransforms may change the value of cached_data_. | 689 // GetDrawTransforms may change the value of cached_data_. |
653 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; | 690 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; |
654 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, | 691 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, |
655 int effect_id) const; | 692 int effect_id) const; |
656 | 693 |
657 PropertyTreesCachedData cached_data_; | 694 PropertyTreesCachedData cached_data_; |
658 }; | 695 }; |
659 | 696 |
660 } // namespace cc | 697 } // namespace cc |
661 | 698 |
662 #endif // CC_TREES_PROPERTY_TREE_H_ | 699 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |