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 for (size_t i = 0; i < source_to_destination.size(); ++i) { |
243 const TransformNode* node = Node(source_to_destination[i]); | 243 size_t index = source_to_destination.size() - 1 - i; |
| 244 const TransformNode* node = Node(source_to_destination[index]); |
244 if (node->data.flattens_inherited_transform) | 245 if (node->data.flattens_inherited_transform) |
245 combined_transform.FlattenTo2d(); | 246 combined_transform.FlattenTo2d(); |
246 combined_transform.PreconcatTransform(node->data.to_parent); | 247 combined_transform.PreconcatTransform(node->data.to_parent); |
247 } | 248 } |
248 | 249 |
249 transform->ConcatTransform(combined_transform); | 250 transform->ConcatTransform(combined_transform); |
250 return true; | 251 return true; |
251 } | 252 } |
252 | 253 |
253 bool TransformTree::CombineInversesBetween(int source_id, | 254 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(), | 389 node->data.from_screen.matrix().postTranslate(-translation.x(), |
389 -translation.y(), 0); | 390 -translation.y(), 0); |
390 | 391 |
391 node->data.scroll_snap = translation; | 392 node->data.scroll_snap = translation; |
392 } | 393 } |
393 | 394 |
394 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { | 395 PropertyTrees::PropertyTrees() : needs_rebuild(true), sequence_number(0) { |
395 } | 396 } |
396 | 397 |
397 } // namespace cc | 398 } // namespace cc |
OLD | NEW |