OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/animation/transform_operations.h" | 5 #include "cc/animation/transform_operations.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/gfx/animation/tween.h" | 9 #include "ui/gfx/animation/tween.h" |
10 #include "ui/gfx/box_f.h" | 10 #include "ui/gfx/box_f.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 bool to_identity = IsIdentity(); | 54 bool to_identity = IsIdentity(); |
55 if (from_identity && to_identity) | 55 if (from_identity && to_identity) |
56 return true; | 56 return true; |
57 | 57 |
58 if (!MatchesTypes(from)) | 58 if (!MatchesTypes(from)) |
59 return false; | 59 return false; |
60 | 60 |
61 size_t num_operations = | 61 size_t num_operations = |
62 std::max(from_identity ? 0 : from.operations_.size(), | 62 std::max(from_identity ? 0 : from.operations_.size(), |
63 to_identity ? 0 : operations_.size()); | 63 to_identity ? 0 : operations_.size()); |
64 for (size_t i = 0; i < num_operations; ++i) { | 64 |
| 65 // Because we are squashing all of the matrices together when applying |
| 66 // them to the animation, we must apply them in reverse order when |
| 67 // not squashing them. |
| 68 for (int i = num_operations - 1; i >= 0; --i) { |
65 gfx::BoxF bounds_for_operation; | 69 gfx::BoxF bounds_for_operation; |
66 const TransformOperation* from_op = | 70 const TransformOperation* from_op = |
67 from_identity ? NULL : &from.operations_[i]; | 71 from_identity ? NULL : &from.operations_[i]; |
68 const TransformOperation* to_op = to_identity ? NULL : &operations_[i]; | 72 const TransformOperation* to_op = to_identity ? NULL : &operations_[i]; |
69 if (!TransformOperation::BlendedBoundsForBox(*bounds, | 73 if (!TransformOperation::BlendedBoundsForBox(*bounds, |
70 from_op, | 74 from_op, |
71 to_op, | 75 to_op, |
72 min_progress, | 76 min_progress, |
73 max_progress, | 77 max_progress, |
74 &bounds_for_operation)) | 78 &bounds_for_operation)) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 decomposed_transform_.reset(new gfx::DecomposedTransform()); | 324 decomposed_transform_.reset(new gfx::DecomposedTransform()); |
321 gfx::Transform transform = Apply(); | 325 gfx::Transform transform = Apply(); |
322 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) | 326 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) |
323 return false; | 327 return false; |
324 decomposed_transform_dirty_ = false; | 328 decomposed_transform_dirty_ = false; |
325 } | 329 } |
326 return true; | 330 return true; |
327 } | 331 } |
328 | 332 |
329 } // namespace cc | 333 } // namespace cc |
OLD | NEW |