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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 has_scale_component = true; | 156 has_scale_component = true; |
157 scale->Scale(operations_[i].scale.x, | 157 scale->Scale(operations_[i].scale.x, |
158 operations_[i].scale.y, | 158 operations_[i].scale.y, |
159 operations_[i].scale.z); | 159 operations_[i].scale.z); |
160 } | 160 } |
161 } | 161 } |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 bool TransformOperations::MatchesTypes(const TransformOperations& other) const { | 165 bool TransformOperations::MatchesTypes(const TransformOperations& other) const { |
166 if (IsIdentity() || other.IsIdentity()) | 166 if (operations_.size() == 0 || other.operations_.size() == 0) |
167 return true; | 167 return true; |
168 | 168 |
169 if (operations_.size() != other.operations_.size()) | 169 if (operations_.size() != other.operations_.size()) |
170 return false; | 170 return false; |
171 | 171 |
172 for (size_t i = 0; i < operations_.size(); ++i) { | 172 for (size_t i = 0; i < operations_.size(); ++i) { |
173 if (operations_[i].type != other.operations_[i].type | 173 if (operations_[i].type != other.operations_[i].type) |
174 && !operations_[i].IsIdentity() | |
175 && !other.operations_[i].IsIdentity()) | |
176 return false; | 174 return false; |
177 } | 175 } |
178 | 176 |
179 return true; | 177 return true; |
180 } | 178 } |
181 | 179 |
182 bool TransformOperations::CanBlendWith( | 180 bool TransformOperations::CanBlendWith( |
183 const TransformOperations& other) const { | 181 const TransformOperations& other) const { |
184 gfx::Transform dummy; | 182 gfx::Transform dummy; |
185 return BlendInternal(other, 0.5, &dummy); | 183 return BlendInternal(other, 0.5, &dummy); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 decomposed_transform_.reset(new gfx::DecomposedTransform()); | 307 decomposed_transform_.reset(new gfx::DecomposedTransform()); |
310 gfx::Transform transform = Apply(); | 308 gfx::Transform transform = Apply(); |
311 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) | 309 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) |
312 return false; | 310 return false; |
313 decomposed_transform_dirty_ = false; | 311 decomposed_transform_dirty_ = false; |
314 } | 312 } |
315 return true; | 313 return true; |
316 } | 314 } |
317 | 315 |
318 } // namespace cc | 316 } // namespace cc |
OLD | NEW |