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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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|, | 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 | 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, | 153 // the inverse of a singular transform was used (and the result should, |
154 // therefore, not be trusted). | 154 // therefore, not be trusted). |
155 bool ComputeTransformWithDestinationSublayerScale( | 155 bool ComputeTransformWithDestinationSurfaceContentsScale( |
156 int source_id, | 156 int source_id, |
157 int dest_id, | 157 int dest_id, |
158 gfx::Transform* transform) const; | 158 gfx::Transform* transform) const; |
159 | 159 |
160 // Computes the change of basis transform from node |source_id| to |dest_id|, | |
161 // including any sublayer scale at |source_id|. The function returns false | |
162 // iff the inverse of a singular transform was used (and the result should, | |
163 // therefore, not be trusted). | |
164 bool ComputeTransformWithSourceSublayerScale(int source_id, | |
165 int dest_id, | |
166 gfx::Transform* transform) const; | |
167 | |
168 // Returns true iff the nodes indexed by |source_id| and |dest_id| are 2D axis | 160 // Returns true iff the nodes indexed by |source_id| and |dest_id| are 2D axis |
169 // aligned with respect to one another. | 161 // aligned with respect to one another. |
170 bool Are2DAxisAligned(int source_id, int dest_id) const; | 162 bool Are2DAxisAligned(int source_id, int dest_id) const; |
171 | 163 |
172 void ResetChangeTracking(); | 164 void ResetChangeTracking(); |
173 // Updates the parent, target, and screen space transforms and snapping. | 165 // Updates the parent, target, and screen space transforms and snapping. |
174 void UpdateTransforms(int id); | 166 void UpdateTransforms(int id); |
175 void UpdateTransformChanged(TransformNode* node, | 167 void UpdateTransformChanged(TransformNode* node, |
176 TransformNode* parent_node, | 168 TransformNode* parent_node, |
177 TransformNode* source_node); | 169 TransformNode* source_node); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 int TargetId(int node_id) const; | 239 int TargetId(int node_id) const; |
248 void SetTargetId(int node_id, int target_id); | 240 void SetTargetId(int node_id, int target_id); |
249 | 241 |
250 int ContentTargetId(int node_id) const; | 242 int ContentTargetId(int node_id) const; |
251 void SetContentTargetId(int node_id, int content_target_id); | 243 void SetContentTargetId(int node_id, int content_target_id); |
252 | 244 |
253 const std::vector<TransformCachedNodeData>& cached_data() const { | 245 const std::vector<TransformCachedNodeData>& cached_data() const { |
254 return cached_data_; | 246 return cached_data_; |
255 } | 247 } |
256 | 248 |
257 gfx::Transform ToScreenSpaceTransformWithoutSublayerScale(int id) const; | 249 gfx::Transform ToScreenSpaceTransformWithoutSurfaceContentsScale( |
| 250 int id) const; |
258 | 251 |
259 void ToProtobuf(proto::PropertyTree* proto) const; | 252 void ToProtobuf(proto::PropertyTree* proto) const; |
260 void FromProtobuf(const proto::PropertyTree& proto, | 253 void FromProtobuf(const proto::PropertyTree& proto, |
261 std::unordered_map<int, int>* node_id_to_index_map); | 254 std::unordered_map<int, int>* node_id_to_index_map); |
262 | 255 |
263 private: | 256 private: |
264 // Returns true iff the node at |desc_id| is a descendant of the node at | 257 // Returns true iff the node at |desc_id| is a descendant of the node at |
265 // |anc_id|. | 258 // |anc_id|. |
266 bool IsDescendant(int desc_id, int anc_id) const; | 259 bool IsDescendant(int desc_id, int anc_id) const; |
267 | 260 |
268 // Computes the combined transform between |source_id| and |dest_id| and | 261 // Computes the combined transform between |source_id| and |dest_id| and |
269 // returns false if the inverse of a singular transform was used. These two | 262 // returns false if the inverse of a singular transform was used. These two |
270 // nodes must be on the same ancestor chain. | 263 // nodes must be on the same ancestor chain. |
271 bool CombineTransformsBetween(int source_id, | 264 bool CombineTransformsBetween(int source_id, |
272 int dest_id, | 265 int dest_id, |
273 gfx::Transform* transform) const; | 266 gfx::Transform* transform) const; |
274 | 267 |
275 // Computes the combined inverse transform between |source_id| and |dest_id| | 268 // Computes the combined inverse transform between |source_id| and |dest_id| |
276 // and returns false if the inverse of a singular transform was used. These | 269 // and returns false if the inverse of a singular transform was used. These |
277 // two nodes must be on the same ancestor chain. | 270 // two nodes must be on the same ancestor chain. |
278 bool CombineInversesBetween(int source_id, | 271 bool CombineInversesBetween(int source_id, |
279 int dest_id, | 272 int dest_id, |
280 gfx::Transform* transform) const; | 273 gfx::Transform* transform) const; |
281 | 274 |
282 void UpdateLocalTransform(TransformNode* node); | 275 void UpdateLocalTransform(TransformNode* node); |
283 void UpdateScreenSpaceTransform(TransformNode* node, | 276 void UpdateScreenSpaceTransform(TransformNode* node, |
284 TransformNode* parent_node, | 277 TransformNode* parent_node, |
285 TransformNode* target_node); | 278 TransformNode* target_node); |
286 void UpdateSublayerScale(TransformNode* node); | 279 void UpdateSurfaceContentsScale(TransformNode* node); |
287 void UpdateTargetSpaceTransform(TransformNode* node, | 280 void UpdateTargetSpaceTransform(TransformNode* node, |
288 TransformNode* target_node); | 281 TransformNode* target_node); |
289 void UpdateAnimationProperties(TransformNode* node, | 282 void UpdateAnimationProperties(TransformNode* node, |
290 TransformNode* parent_node); | 283 TransformNode* parent_node); |
291 void UndoSnapping(TransformNode* node); | 284 void UndoSnapping(TransformNode* node); |
292 void UpdateSnapping(TransformNode* node); | 285 void UpdateSnapping(TransformNode* node); |
293 void UpdateNodeAndAncestorsHaveIntegerTranslations( | 286 void UpdateNodeAndAncestorsHaveIntegerTranslations( |
294 TransformNode* node, | 287 TransformNode* node, |
295 TransformNode* parent_node); | 288 TransformNode* parent_node); |
296 bool NeedsSourceToParentUpdate(TransformNode* node); | 289 bool NeedsSourceToParentUpdate(TransformNode* node); |
(...skipping 27 matching lines...) Expand all Loading... |
324 EffectTree(); | 317 EffectTree(); |
325 ~EffectTree(); | 318 ~EffectTree(); |
326 | 319 |
327 EffectTree& operator=(const EffectTree& from); | 320 EffectTree& operator=(const EffectTree& from); |
328 bool operator==(const EffectTree& other) const; | 321 bool operator==(const EffectTree& other) const; |
329 | 322 |
330 void clear(); | 323 void clear(); |
331 | 324 |
332 float EffectiveOpacity(const EffectNode* node) const; | 325 float EffectiveOpacity(const EffectNode* node) const; |
333 | 326 |
334 void UpdateSublayerScale(EffectNode* node); | 327 void UpdateSurfaceContentsScale(EffectNode* node); |
335 | 328 |
336 void UpdateEffects(int id); | 329 void UpdateEffects(int id); |
337 | 330 |
338 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node); | 331 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node); |
339 | 332 |
340 void AddCopyRequest(int node_id, std::unique_ptr<CopyOutputRequest> request); | 333 void AddCopyRequest(int node_id, std::unique_ptr<CopyOutputRequest> request); |
341 void PushCopyRequestsTo(EffectTree* other_tree); | 334 void PushCopyRequestsTo(EffectTree* other_tree); |
342 void TakeCopyRequestsAndTransformToSurface( | 335 void TakeCopyRequestsAndTransformToSurface( |
343 int node_id, | 336 int node_id, |
344 std::vector<std::unique_ptr<CopyOutputRequest>>* requests); | 337 std::vector<std::unique_ptr<CopyOutputRequest>>* requests); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 gfx::Vector2dF inner_viewport_container_bounds_delta_; | 561 gfx::Vector2dF inner_viewport_container_bounds_delta_; |
569 gfx::Vector2dF outer_viewport_container_bounds_delta_; | 562 gfx::Vector2dF outer_viewport_container_bounds_delta_; |
570 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; | 563 gfx::Vector2dF inner_viewport_scroll_bounds_delta_; |
571 | 564 |
572 PropertyTreesCachedData cached_data_; | 565 PropertyTreesCachedData cached_data_; |
573 }; | 566 }; |
574 | 567 |
575 } // namespace cc | 568 } // namespace cc |
576 | 569 |
577 #endif // CC_TREES_PROPERTY_TREE_H_ | 570 #endif // CC_TREES_PROPERTY_TREE_H_ |
OLD | NEW |