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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 BlendDoubles(from_y, to_y, progress), | 108 BlendDoubles(from_y, to_y, progress), |
109 BlendDoubles(from_z, to_z, progress)); | 109 BlendDoubles(from_z, to_z, progress)); |
110 break; | 110 break; |
111 } | 111 } |
112 case TransformOperation::TransformOperationRotate: { | 112 case TransformOperation::TransformOperationRotate: { |
113 double axis_x = 0; | 113 double axis_x = 0; |
114 double axis_y = 0; | 114 double axis_y = 0; |
115 double axis_z = 1; | 115 double axis_z = 1; |
116 double from_angle = 0; | 116 double from_angle = 0; |
117 double to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle; | 117 double to_angle = IsOperationIdentity(to) ? 0 : to->rotate.angle; |
118 if (ShareSameAxis(from, to, axis_x, axis_y, axis_z, from_angle)) | 118 if (ShareSameAxis(from, to, axis_x, axis_y, axis_z, from_angle)) { |
119 result.RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), | 119 result.RotateAbout(gfx::Vector3dF(axis_x, axis_y, axis_z), |
120 BlendDoubles(from_angle, to_angle, progress)); | 120 BlendDoubles(from_angle, to_angle, progress)); |
121 else { | 121 } else { |
122 gfx::Transform to_matrix; | 122 gfx::Transform to_matrix; |
123 if (!IsOperationIdentity(to)) | 123 if (!IsOperationIdentity(to)) |
124 to_matrix = to->matrix; | 124 to_matrix = to->matrix; |
125 gfx::Transform from_matrix; | 125 gfx::Transform from_matrix; |
126 if (!IsOperationIdentity(from)) | 126 if (!IsOperationIdentity(from)) |
127 from_matrix = from->matrix; | 127 from_matrix = from->matrix; |
128 result = to_matrix; | 128 result = to_matrix; |
129 if (!result.Blend(from_matrix, progress)) | 129 if (!result.Blend(from_matrix, progress)) |
130 return false; | 130 return false; |
131 } | 131 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 case TransformOperation::TransformOperationIdentity: | 176 case TransformOperation::TransformOperationIdentity: |
177 // Do nothing. | 177 // Do nothing. |
178 break; | 178 break; |
179 } | 179 } |
180 | 180 |
181 return true; | 181 return true; |
182 } | 182 } |
183 | 183 |
184 } // namespace cc | 184 } // namespace cc |
OLD | NEW |