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 #include <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/trees/property_tree.h" | 10 #include "cc/trees/property_tree.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // 4. When walking up the ancestor chain from F, the first node with a | 232 // 4. When walking up the ancestor chain from F, the first node with a |
233 // smaller id than S will be T, the lowest common ancestor of these nodes. | 233 // smaller id than S will be T, the lowest common ancestor of these nodes. |
234 // We compute the transform from T to S here, and then from F to T in the | 234 // We compute the transform from T to S here, and then from F to T in the |
235 // loop below. | 235 // loop below. |
236 DCHECK(IsDescendant(dest_id, current->id)); | 236 DCHECK(IsDescendant(dest_id, current->id)); |
237 CombineInversesBetween(current->id, dest_id, &combined_transform); | 237 CombineInversesBetween(current->id, dest_id, &combined_transform); |
238 DCHECK(combined_transform.IsApproximatelyIdentityOrTranslation( | 238 DCHECK(combined_transform.IsApproximatelyIdentityOrTranslation( |
239 SkDoubleToMScalar(1e-4))); | 239 SkDoubleToMScalar(1e-4))); |
240 } | 240 } |
241 | 241 |
242 for (int i = source_to_destination.size() - 1; i >= 0; i--) { | 242 size_t source_to_destination_size = source_to_destination.size(); |
243 const TransformNode* node = Node(source_to_destination[i]); | 243 for (size_t i = 0; i < source_to_destination_size; ++i) { |
| 244 size_t index = source_to_destination_size - 1 - i; |
| 245 const TransformNode* node = Node(source_to_destination[index]); |
244 if (node->data.flattens_inherited_transform) | 246 if (node->data.flattens_inherited_transform) |
245 combined_transform.FlattenTo2d(); | 247 combined_transform.FlattenTo2d(); |
246 combined_transform.PreconcatTransform(node->data.to_parent); | 248 combined_transform.PreconcatTransform(node->data.to_parent); |
247 } | 249 } |
248 | 250 |
249 transform->ConcatTransform(combined_transform); | 251 transform->ConcatTransform(combined_transform); |
250 return true; | 252 return true; |
251 } | 253 } |
252 | 254 |
253 bool TransformTree::CombineInversesBetween(int source_id, | 255 bool TransformTree::CombineInversesBetween(int source_id, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 node->data.from_screen.matrix().postTranslate(-translation.x(), | 390 node->data.from_screen.matrix().postTranslate(-translation.x(), |
389 -translation.y(), 0); | 391 -translation.y(), 0); |
390 | 392 |
391 node->data.scroll_snap = translation; | 393 node->data.scroll_snap = translation; |
392 } | 394 } |
393 | 395 |
394 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { | 396 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { |
395 } | 397 } |
396 | 398 |
397 } // namespace cc | 399 } // namespace cc |
OLD | NEW |