| 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 <cmath> | 5 #include <cmath> |
| 6 #include <limits> | 6 #include <limits> |
| 7 | 7 |
| 8 #include "cc/animation/transform_operation.h" | 8 #include "cc/animation/transform_operation.h" |
| 9 #include "ui/gfx/vector3d_f.h" | 9 #include "ui/gfx/vector3d_f.h" |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 *axis_y = to->rotate.axis.y; | 67 *axis_y = to->rotate.axis.y; |
| 68 *axis_z = to->rotate.axis.z; | 68 *axis_z = to->rotate.axis.z; |
| 69 // If the axes are pointing in opposite directions, we need to reverse | 69 // If the axes are pointing in opposite directions, we need to reverse |
| 70 // the angle. | 70 // the angle. |
| 71 *angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; | 71 *angle_from = dot > 0 ? from->rotate.angle : -from->rotate.angle; |
| 72 } | 72 } |
| 73 return result; | 73 return result; |
| 74 } | 74 } |
| 75 | 75 |
| 76 static double BlendDoubles(double from, double to, double progress) { | 76 static double BlendDoubles(double from, double to, double progress) { |
| 77 if (progress <= 0.0) | |
| 78 return from; | |
| 79 | |
| 80 if (progress >= 1.0) | |
| 81 return to; | |
| 82 | |
| 83 return from * (1 - progress) + to * progress; | 77 return from * (1 - progress) + to * progress; |
| 84 } | 78 } |
| 85 | 79 |
| 86 bool TransformOperation::BlendTransformOperations( | 80 bool TransformOperation::BlendTransformOperations( |
| 87 const TransformOperation* from, | 81 const TransformOperation* from, |
| 88 const TransformOperation* to, | 82 const TransformOperation* to, |
| 89 double progress, | 83 double progress, |
| 90 gfx::Transform* result) { | 84 gfx::Transform* result) { |
| 91 if (IsOperationIdentity(from) && IsOperationIdentity(to)) | 85 if (IsOperationIdentity(from) && IsOperationIdentity(to)) |
| 92 return true; | 86 return true; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 171 } |
| 178 case TransformOperation::TransformOperationIdentity: | 172 case TransformOperation::TransformOperationIdentity: |
| 179 // Do nothing. | 173 // Do nothing. |
| 180 break; | 174 break; |
| 181 } | 175 } |
| 182 | 176 |
| 183 return true; | 177 return true; |
| 184 } | 178 } |
| 185 | 179 |
| 186 } // namespace cc | 180 } // namespace cc |
| OLD | NEW |