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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // be computed between any pair of nodes that have an ancestor/descendant | 141 // be computed between any pair of nodes that have an ancestor/descendant |
142 // relationship. Transforms between other pairs of nodes may only be computed | 142 // relationship. Transforms between other pairs of nodes may only be computed |
143 // if the following condition holds: let id1 the larger id and let id2 be the | 143 // if the following condition holds: let id1 the larger id and let id2 be the |
144 // other id; then the nearest ancestor of node id1 whose id is smaller than | 144 // other id; then the nearest ancestor of node id1 whose id is smaller than |
145 // id2 is the lowest common ancestor of the pair of nodes, and the transform | 145 // id2 is the lowest common ancestor of the pair of nodes, and the transform |
146 // from this lowest common ancestor to node id2 is only a 2d translation. | 146 // from this lowest common ancestor to node id2 is only a 2d translation. |
147 bool ComputeTransform(int source_id, | 147 bool ComputeTransform(int source_id, |
148 int dest_id, | 148 int dest_id, |
149 gfx::Transform* transform) const; | 149 gfx::Transform* transform) const; |
150 | 150 |
151 // Computes the change of basis transform from node |source_id| to |dest_id|, | |
152 // including any sublayer scale at |dest_id|. The function returns false iff | |
153 // the inverse of a singular transform was used (and the result should, | |
154 // therefore, not be trusted). | |
155 bool ComputeTransformWithDestinationSurfaceContentsScale( | |
156 int source_id, | |
157 int dest_id, | |
158 gfx::Transform* transform) const; | |
159 | |
160 void ResetChangeTracking(); | 151 void ResetChangeTracking(); |
161 // Updates the parent, target, and screen space transforms and snapping. | 152 // Updates the parent, target, and screen space transforms and snapping. |
162 void UpdateTransforms(int id); | 153 void UpdateTransforms(int id); |
163 void UpdateTransformChanged(TransformNode* node, | 154 void UpdateTransformChanged(TransformNode* node, |
164 TransformNode* parent_node, | 155 TransformNode* parent_node, |
165 TransformNode* source_node); | 156 TransformNode* source_node); |
166 void UpdateNodeAndAncestorsAreAnimatedOrInvertible( | 157 void UpdateNodeAndAncestorsAreAnimatedOrInvertible( |
167 TransformNode* node, | 158 TransformNode* node, |
168 TransformNode* parent_node); | 159 TransformNode* parent_node); |
169 | 160 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 int TargetId(int node_id) const; | 226 int TargetId(int node_id) const; |
236 void SetTargetId(int node_id, int target_id); | 227 void SetTargetId(int node_id, int target_id); |
237 | 228 |
238 int ContentTargetId(int node_id) const; | 229 int ContentTargetId(int node_id) const; |
239 void SetContentTargetId(int node_id, int content_target_id); | 230 void SetContentTargetId(int node_id, int content_target_id); |
240 | 231 |
241 const std::vector<TransformCachedNodeData>& cached_data() const { | 232 const std::vector<TransformCachedNodeData>& cached_data() const { |
242 return cached_data_; | 233 return cached_data_; |
243 } | 234 } |
244 | 235 |
245 gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale( | |
246 int id) const; | |
247 | |
248 void ToProtobuf(proto::PropertyTree* proto) const; | 236 void ToProtobuf(proto::PropertyTree* proto) const; |
249 void FromProtobuf(const proto::PropertyTree& proto, | 237 void FromProtobuf(const proto::PropertyTree& proto, |
250 std::unordered_map<int, int>* node_id_to_index_map); | 238 std::unordered_map<int, int>* node_id_to_index_map); |
251 | 239 |
252 private: | 240 private: |
253 // Returns true iff the node at |desc_id| is a descendant of the node at | 241 // Returns true iff the node at |desc_id| is a descendant of the node at |
254 // |anc_id|. | 242 // |anc_id|. |
255 bool IsDescendant(int desc_id, int anc_id) const; | 243 bool IsDescendant(int desc_id, int anc_id) const; |
256 | 244 |
257 // Computes the combined transform between |source_id| and |dest_id| and | 245 // Computes the combined transform between |source_id| and |dest_id| and |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 534 |
547 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; | 535 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; |
548 | 536 |
549 CombinedAnimationScale GetAnimationScales(int transform_node_id, | 537 CombinedAnimationScale GetAnimationScales(int transform_node_id, |
550 LayerTreeImpl* layer_tree_impl); | 538 LayerTreeImpl* layer_tree_impl); |
551 void SetAnimationScalesForTesting(int transform_id, | 539 void SetAnimationScalesForTesting(int transform_id, |
552 float maximum_animation_scale, | 540 float maximum_animation_scale, |
553 float starting_animation_scale); | 541 float starting_animation_scale); |
554 void ResetCachedData(); | 542 void ResetCachedData(); |
555 void UpdateCachedNumber(); | 543 void UpdateCachedNumber(); |
| 544 gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale( |
| 545 int transform_id, |
| 546 int effect_id) const; |
556 | 547 |
557 private: | 548 private: |
558 gfx::Vector2dF inner_viewport_container_bounds_delta_; | 549 gfx::Vector2dF inner_viewport_container_bounds_delta_; |
559 gfx::Vector2dF outer_viewport_container_bounds_delta_; | 550 gfx::Vector2dF outer_viewport_container_bounds_delta_; |
560 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; | 551 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; |
561 | 552 |
562 PropertyTreesCachedData cached_data_; | 553 PropertyTreesCachedData cached_data_; |
563 }; | 554 }; |
564 | 555 |
565 } // namespace cc | 556 } // namespace cc |
566 | 557 |
567 #endif // CC_TREES_PROPERTY_TREE_H_ | 558 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |