Chromium Code Reviews| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 // space transform. For layers in the subtree of the page scale layer, the | 148 // space transform. For layers in the subtree of the page scale layer, the |
| 149 // layer scale factor should include the page scale factor. | 149 // layer scale factor should include the page scale factor. |
| 150 bool in_subtree_of_page_scale_layer : 1; | 150 bool in_subtree_of_page_scale_layer : 1; |
| 151 | 151 |
| 152 // We need to track changes to to_screen transform to compute the damage rect. | 152 // We need to track changes to to_screen transform to compute the damage rect. |
| 153 bool transform_changed : 1; | 153 bool transform_changed : 1; |
| 154 | 154 |
| 155 // TODO(vollick): will be moved when accelerated effects are implemented. | 155 // TODO(vollick): will be moved when accelerated effects are implemented. |
| 156 float post_local_scale_factor; | 156 float post_local_scale_factor; |
| 157 | 157 |
| 158 // The maximum scale that that node's |local| transform will have during | |
|
jaydasika
2016/06/28 23:08:40
Can we retain the comments ? (move them inside Ani
sunxd
2016/06/30 15:29:44
Done.
| |
| 159 // current animations, considering only scales at keyframes not including the | |
| 160 // starting keyframe of each animation. | |
| 161 float local_maximum_animation_target_scale; | |
| 162 | |
| 163 // The maximum scale that this node's |local| transform will have during | |
| 164 // current animatons, considering only the starting scale of each animation. | |
| 165 float local_starting_animation_scale; | |
| 166 | |
| 167 // The maximum scale that this node's |to_target| transform will have during | |
| 168 // current animations, considering only scales at keyframes not incuding the | |
| 169 // starting keyframe of each animation. | |
| 170 float combined_maximum_animation_target_scale; | |
| 171 | |
| 172 // The maximum scale that this node's |to_target| transform will have during | |
| 173 // current animations, considering only the starting scale of each animation. | |
| 174 float combined_starting_animation_scale; | |
| 175 | |
| 176 gfx::Vector2dF sublayer_scale; | 158 gfx::Vector2dF sublayer_scale; |
| 177 | 159 |
| 178 // TODO(vollick): will be moved when accelerated effects are implemented. | 160 // TODO(vollick): will be moved when accelerated effects are implemented. |
| 179 gfx::ScrollOffset scroll_offset; | 161 gfx::ScrollOffset scroll_offset; |
| 180 | 162 |
| 181 // We scroll snap where possible, but this means fixed-pos elements must be | 163 // We scroll snap where possible, but this means fixed-pos elements must be |
| 182 // adjusted. This value stores the snapped amount for this purpose. | 164 // adjusted. This value stores the snapped amount for this purpose. |
| 183 gfx::Vector2dF scroll_snap; | 165 gfx::Vector2dF scroll_snap; |
| 184 | 166 |
| 185 // TODO(vollick): will be moved when accelerated effects are implemented. | 167 // TODO(vollick): will be moved when accelerated effects are implemented. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 197 | 179 |
| 198 void update_post_local_transform(const gfx::PointF& position, | 180 void update_post_local_transform(const gfx::PointF& position, |
| 199 const gfx::Point3F& transform_origin); | 181 const gfx::Point3F& transform_origin); |
| 200 | 182 |
| 201 void ToProtobuf(proto::TreeNode* proto) const; | 183 void ToProtobuf(proto::TreeNode* proto) const; |
| 202 void FromProtobuf(const proto::TreeNode& proto); | 184 void FromProtobuf(const proto::TreeNode& proto); |
| 203 | 185 |
| 204 void AsValueInto(base::trace_event::TracedValue* value) const; | 186 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 205 }; | 187 }; |
| 206 | 188 |
| 189 // TODO(sunxd): move this into PropertyTrees::cached_data_ | |
| 207 struct CC_EXPORT TransformCachedNodeData { | 190 struct CC_EXPORT TransformCachedNodeData { |
| 208 TransformCachedNodeData(); | 191 TransformCachedNodeData(); |
| 209 TransformCachedNodeData(const TransformCachedNodeData& other); | 192 TransformCachedNodeData(const TransformCachedNodeData& other); |
| 210 ~TransformCachedNodeData(); | 193 ~TransformCachedNodeData(); |
| 211 | 194 |
| 212 gfx::Transform from_target; | 195 gfx::Transform from_target; |
| 213 gfx::Transform to_target; | 196 gfx::Transform to_target; |
| 214 gfx::Transform from_screen; | 197 gfx::Transform from_screen; |
| 215 gfx::Transform to_screen; | 198 gfx::Transform to_screen; |
| 216 int target_id; | 199 int target_id; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 public: | 401 public: |
| 419 TransformTree(); | 402 TransformTree(); |
| 420 ~TransformTree(); | 403 ~TransformTree(); |
| 421 | 404 |
| 422 bool operator==(const TransformTree& other) const; | 405 bool operator==(const TransformTree& other) const; |
| 423 | 406 |
| 424 int Insert(const TransformNode& tree_node, int parent_id); | 407 int Insert(const TransformNode& tree_node, int parent_id); |
| 425 | 408 |
| 426 void clear(); | 409 void clear(); |
| 427 | 410 |
| 411 void set_needs_update(bool needs_update); | |
| 412 | |
| 428 // Computes the change of basis transform from node |source_id| to |dest_id|. | 413 // Computes the change of basis transform from node |source_id| to |dest_id|. |
| 429 // The function returns false iff the inverse of a singular transform was | 414 // The function returns false iff the inverse of a singular transform was |
| 430 // used (and the result should, therefore, not be trusted). Transforms may | 415 // used (and the result should, therefore, not be trusted). Transforms may |
| 431 // be computed between any pair of nodes that have an ancestor/descendant | 416 // be computed between any pair of nodes that have an ancestor/descendant |
| 432 // relationship. Transforms between other pairs of nodes may only be computed | 417 // relationship. Transforms between other pairs of nodes may only be computed |
| 433 // if the following condition holds: let id1 the larger id and let id2 be the | 418 // if the following condition holds: let id1 the larger id and let id2 be the |
| 434 // other id; then the nearest ancestor of node id1 whose id is smaller than | 419 // other id; then the nearest ancestor of node id1 whose id is smaller than |
| 435 // id2 is the lowest common ancestor of the pair of nodes, and the transform | 420 // id2 is the lowest common ancestor of the pair of nodes, and the transform |
| 436 // from this lowest common ancestor to node id2 is only a 2d translation. | 421 // from this lowest common ancestor to node id2 is only a 2d translation. |
| 437 bool ComputeTransform(int source_id, | 422 bool ComputeTransform(int source_id, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 ScrollOffsetMap layer_id_to_scroll_offset_map_; | 704 ScrollOffsetMap layer_id_to_scroll_offset_map_; |
| 720 | 705 |
| 721 SyncedScrollOffset* synced_scroll_offset(int layer_id); | 706 SyncedScrollOffset* synced_scroll_offset(int layer_id); |
| 722 const SyncedScrollOffset* synced_scroll_offset(int layer_id) const; | 707 const SyncedScrollOffset* synced_scroll_offset(int layer_id) const; |
| 723 gfx::ScrollOffset PullDeltaForMainThread(SyncedScrollOffset* scroll_offset); | 708 gfx::ScrollOffset PullDeltaForMainThread(SyncedScrollOffset* scroll_offset); |
| 724 void UpdateScrollOffsetMapEntry(int key, | 709 void UpdateScrollOffsetMapEntry(int key, |
| 725 ScrollOffsetMap* new_scroll_offset_map, | 710 ScrollOffsetMap* new_scroll_offset_map, |
| 726 LayerTreeImpl* layer_tree_impl); | 711 LayerTreeImpl* layer_tree_impl); |
| 727 }; | 712 }; |
| 728 | 713 |
| 714 struct AnimationScaleData { | |
| 715 int update_number; | |
| 716 float local_maximum_animation_target_scale; | |
| 717 float local_starting_animation_scale; | |
| 718 float combined_maximum_animation_target_scale; | |
| 719 float combined_starting_animation_scale; | |
| 720 | |
| 721 AnimationScaleData() { | |
| 722 update_number = -1; | |
| 723 local_maximum_animation_target_scale = 0.f; | |
| 724 local_starting_animation_scale = 0.f; | |
| 725 combined_maximum_animation_target_scale = 0.f; | |
| 726 combined_starting_animation_scale = 0.f; | |
| 727 } | |
| 728 }; | |
| 729 | |
| 730 struct CombinedAnimationScale { | |
| 731 float maximum_animation_scale; | |
| 732 float starting_animation_scale; | |
| 733 | |
| 734 CombinedAnimationScale(float maximum, float starting) | |
| 735 : maximum_animation_scale(maximum), starting_animation_scale(starting) {} | |
| 736 }; | |
| 737 | |
| 738 struct PropertyTreesCachedData { | |
| 739 int property_tree_update_number; | |
| 740 std::vector<AnimationScaleData> animation_scales; | |
| 741 | |
| 742 PropertyTreesCachedData(); | |
| 743 ~PropertyTreesCachedData(); | |
| 744 }; | |
| 745 | |
| 729 class CC_EXPORT PropertyTrees final { | 746 class CC_EXPORT PropertyTrees final { |
| 730 public: | 747 public: |
| 731 PropertyTrees(); | 748 PropertyTrees(); |
| 732 PropertyTrees(const PropertyTrees& other) = delete; | 749 PropertyTrees(const PropertyTrees& other) = delete; |
| 733 ~PropertyTrees(); | 750 ~PropertyTrees(); |
| 734 | 751 |
| 735 bool operator==(const PropertyTrees& other) const; | 752 bool operator==(const PropertyTrees& other) const; |
| 736 PropertyTrees& operator=(const PropertyTrees& from); | 753 PropertyTrees& operator=(const PropertyTrees& from); |
| 737 | 754 |
| 738 void ToProtobuf(proto::PropertyTrees* proto) const; | 755 void ToProtobuf(proto::PropertyTrees* proto) const; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 758 bool changed; | 775 bool changed; |
| 759 // We cache a global bool for full tree damages to avoid walking the entire | 776 // We cache a global bool for full tree damages to avoid walking the entire |
| 760 // tree. | 777 // tree. |
| 761 // TODO(jaydasika): Changes to transform and effects that damage the entire | 778 // TODO(jaydasika): Changes to transform and effects that damage the entire |
| 762 // tree should be tracked by this bool. Currently, they are tracked by the | 779 // tree should be tracked by this bool. Currently, they are tracked by the |
| 763 // individual nodes. | 780 // individual nodes. |
| 764 bool full_tree_damaged; | 781 bool full_tree_damaged; |
| 765 int sequence_number; | 782 int sequence_number; |
| 766 bool is_main_thread; | 783 bool is_main_thread; |
| 767 bool is_active; | 784 bool is_active; |
| 785 int property_tree_update_number; | |
|
jaydasika
2016/06/28 23:08:40
This is unused.
sunxd
2016/06/30 15:29:44
Done.
| |
| 768 | 786 |
| 769 void SetInnerViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta); | 787 void SetInnerViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta); |
| 770 void SetOuterViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta); | 788 void SetOuterViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta); |
| 771 void SetInnerViewportScrollBoundsDelta(gfx::Vector2dF bounds_delta); | 789 void SetInnerViewportScrollBoundsDelta(gfx::Vector2dF bounds_delta); |
| 772 void PushOpacityIfNeeded(PropertyTrees* target_tree); | 790 void PushOpacityIfNeeded(PropertyTrees* target_tree); |
| 773 void RemoveIdFromIdToIndexMaps(int id); | 791 void RemoveIdFromIdToIndexMaps(int id); |
| 774 bool IsInIdToIndexMap(TreeType tree_type, int id); | 792 bool IsInIdToIndexMap(TreeType tree_type, int id); |
| 775 void UpdateChangeTracking(); | 793 void UpdateChangeTracking(); |
| 776 void PushChangeTrackingTo(PropertyTrees* tree); | 794 void PushChangeTrackingTo(PropertyTrees* tree); |
| 777 void ResetAllChangeTracking(); | 795 void ResetAllChangeTracking(); |
| 778 | 796 |
| 779 gfx::Vector2dF inner_viewport_container_bounds_delta() const { | 797 gfx::Vector2dF inner_viewport_container_bounds_delta() const { |
| 780 return inner_viewport_container_bounds_delta_; | 798 return inner_viewport_container_bounds_delta_; |
| 781 } | 799 } |
| 782 | 800 |
| 783 gfx::Vector2dF outer_viewport_container_bounds_delta() const { | 801 gfx::Vector2dF outer_viewport_container_bounds_delta() const { |
| 784 return outer_viewport_container_bounds_delta_; | 802 return outer_viewport_container_bounds_delta_; |
| 785 } | 803 } |
| 786 | 804 |
| 787 gfx::Vector2dF inner_viewport_scroll_bounds_delta() const { | 805 gfx::Vector2dF inner_viewport_scroll_bounds_delta() const { |
| 788 return inner_viewport_scroll_bounds_delta_; | 806 return inner_viewport_scroll_bounds_delta_; |
| 789 } | 807 } |
| 790 | 808 |
| 791 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; | 809 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; |
| 792 | 810 |
| 811 CombinedAnimationScale GetAnimationScales(int transform_node_id, | |
| 812 LayerTreeImpl* layer_tree_impl); | |
| 813 void SetAnimationScalesForTesting(int transform_id, | |
| 814 float maximum_animation_scale, | |
| 815 float starting_animation_scale); | |
| 816 void ResetCachedData(); | |
| 817 void UpdateCachedNumber(); | |
| 818 | |
| 793 private: | 819 private: |
| 794 gfx::Vector2dF inner_viewport_container_bounds_delta_; | 820 gfx::Vector2dF inner_viewport_container_bounds_delta_; |
| 795 gfx::Vector2dF outer_viewport_container_bounds_delta_; | 821 gfx::Vector2dF outer_viewport_container_bounds_delta_; |
| 796 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; | 822 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; |
| 823 | |
| 824 PropertyTreesCachedData cached_data_; | |
| 797 }; | 825 }; |
| 798 | 826 |
| 799 } // namespace cc | 827 } // namespace cc |
| 800 | 828 |
| 801 #endif // CC_TREES_PROPERTY_TREE_H_ | 829 #endif // CC_TREES_PROPERTY_TREE_H_ |
| OLD | NEW |