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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 min_progress, max_progress, | 77 min_progress, max_progress, |
78 &bounds_for_operation)) { | 78 &bounds_for_operation)) { |
79 return false; | 79 return false; |
80 } | 80 } |
81 *bounds = bounds_for_operation; | 81 *bounds = bounds_for_operation; |
82 } | 82 } |
83 | 83 |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 bool TransformOperations::AffectsScale() const { | |
88 for (size_t i = 0; i < operations_.size(); ++i) { | |
89 if (operations_[i].type == TransformOperation::TRANSFORM_OPERATION_SCALE) | |
90 return true; | |
91 if (operations_[i].type == TransformOperation::TRANSFORM_OPERATION_MATRIX && | |
92 !operations_[i].matrix.IsIdentityOrTranslation()) | |
93 return true; | |
94 } | |
95 return false; | |
96 } | |
97 | |
98 bool TransformOperations::PreservesAxisAlignment() const { | 87 bool TransformOperations::PreservesAxisAlignment() const { |
99 for (size_t i = 0; i < operations_.size(); ++i) { | 88 for (size_t i = 0; i < operations_.size(); ++i) { |
100 switch (operations_[i].type) { | 89 switch (operations_[i].type) { |
101 case TransformOperation::TRANSFORM_OPERATION_IDENTITY: | 90 case TransformOperation::TRANSFORM_OPERATION_IDENTITY: |
102 case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: | 91 case TransformOperation::TRANSFORM_OPERATION_TRANSLATE: |
103 case TransformOperation::TRANSFORM_OPERATION_SCALE: | 92 case TransformOperation::TRANSFORM_OPERATION_SCALE: |
104 continue; | 93 continue; |
105 case TransformOperation::TRANSFORM_OPERATION_MATRIX: | 94 case TransformOperation::TRANSFORM_OPERATION_MATRIX: |
106 if (!operations_[i].matrix.IsIdentity() && | 95 if (!operations_[i].matrix.IsIdentity() && |
107 !operations_[i].matrix.IsScaleOrTranslation()) | 96 !operations_[i].matrix.IsScaleOrTranslation()) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 decomposed_transform_.reset(new gfx::DecomposedTransform()); | 297 decomposed_transform_.reset(new gfx::DecomposedTransform()); |
309 gfx::Transform transform = Apply(); | 298 gfx::Transform transform = Apply(); |
310 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) | 299 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) |
311 return false; | 300 return false; |
312 decomposed_transform_dirty_ = false; | 301 decomposed_transform_dirty_ = false; |
313 } | 302 } |
314 return true; | 303 return true; |
315 } | 304 } |
316 | 305 |
317 } // namespace cc | 306 } // namespace cc |
OLD | NEW |