| 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/geometry/box_f.h" | 10 #include "ui/gfx/geometry/box_f.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 for (size_t i = 0; i < operations_.size(); ++i) { | 87 for (size_t i = 0; i < operations_.size(); ++i) { |
| 88 if (operations_[i].type == TransformOperation::TransformOperationScale) | 88 if (operations_[i].type == TransformOperation::TransformOperationScale) |
| 89 return true; | 89 return true; |
| 90 if (operations_[i].type == TransformOperation::TransformOperationMatrix && | 90 if (operations_[i].type == TransformOperation::TransformOperationMatrix && |
| 91 !operations_[i].matrix.IsIdentityOrTranslation()) | 91 !operations_[i].matrix.IsIdentityOrTranslation()) |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 return false; | 94 return false; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool TransformOperations::PreservesAxisAlignment() const { |
| 98 for (size_t i = 0; i < operations_.size(); ++i) { |
| 99 switch (operations_[i].type) { |
| 100 case TransformOperation::TransformOperationIdentity: |
| 101 case TransformOperation::TransformOperationTranslate: |
| 102 case TransformOperation::TransformOperationScale: |
| 103 continue; |
| 104 case TransformOperation::TransformOperationMatrix: |
| 105 if (!operations_[i].matrix.IsIdentity() && |
| 106 !operations_[i].matrix.IsScaleOrTranslation()) |
| 107 return false; |
| 108 continue; |
| 109 case TransformOperation::TransformOperationRotate: |
| 110 case TransformOperation::TransformOperationSkew: |
| 111 case TransformOperation::TransformOperationPerspective: |
| 112 return false; |
| 113 } |
| 114 } |
| 115 return true; |
| 116 } |
| 117 |
| 97 bool TransformOperations::IsTranslation() const { | 118 bool TransformOperations::IsTranslation() const { |
| 98 for (size_t i = 0; i < operations_.size(); ++i) { | 119 for (size_t i = 0; i < operations_.size(); ++i) { |
| 99 switch (operations_[i].type) { | 120 switch (operations_[i].type) { |
| 100 case TransformOperation::TransformOperationIdentity: | 121 case TransformOperation::TransformOperationIdentity: |
| 101 case TransformOperation::TransformOperationTranslate: | 122 case TransformOperation::TransformOperationTranslate: |
| 102 continue; | 123 continue; |
| 103 case TransformOperation::TransformOperationMatrix: | 124 case TransformOperation::TransformOperationMatrix: |
| 104 if (!operations_[i].matrix.IsIdentityOrTranslation()) | 125 if (!operations_[i].matrix.IsIdentityOrTranslation()) |
| 105 return false; | 126 return false; |
| 106 continue; | 127 continue; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 decomposed_transform_.reset(new gfx::DecomposedTransform()); | 310 decomposed_transform_.reset(new gfx::DecomposedTransform()); |
| 290 gfx::Transform transform = Apply(); | 311 gfx::Transform transform = Apply(); |
| 291 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) | 312 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) |
| 292 return false; | 313 return false; |
| 293 decomposed_transform_dirty_ = false; | 314 decomposed_transform_dirty_ = false; |
| 294 } | 315 } |
| 295 return true; | 316 return true; |
| 296 } | 317 } |
| 297 | 318 |
| 298 } // namespace cc | 319 } // namespace cc |
| OLD | NEW |