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 // Needed on Windows to get |M_PI| from <cmath> | 5 // Needed on Windows to get |M_PI| from <cmath> |
6 #ifdef _WIN32 | 6 #ifdef _WIN32 |
7 #define _USE_MATH_DEFINES | 7 #define _USE_MATH_DEFINES |
8 #endif | 8 #endif |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 static bool ShareSameAxis(const TransformOperation* from, | 35 static bool ShareSameAxis(const TransformOperation* from, |
36 const TransformOperation* to, | 36 const TransformOperation* to, |
37 SkMScalar* axis_x, | 37 SkMScalar* axis_x, |
38 SkMScalar* axis_y, | 38 SkMScalar* axis_y, |
39 SkMScalar* axis_z, | 39 SkMScalar* axis_z, |
40 SkMScalar* angle_from) { | 40 SkMScalar* angle_from) { |
41 if (IsOperationIdentity(from) && IsOperationIdentity(to)) | 41 if (IsOperationIdentity(from) && IsOperationIdentity(to)) |
42 return false; | 42 return false; |
43 | 43 |
44 if (IsOperationIdentity(from) && !IsOperationIdentity(to)) { | 44 if (!from && !IsOperationIdentity(to)) { |
45 *axis_x = to->rotate.axis.x; | 45 *axis_x = to->rotate.axis.x; |
46 *axis_y = to->rotate.axis.y; | 46 *axis_y = to->rotate.axis.y; |
47 *axis_z = to->rotate.axis.z; | 47 *axis_z = to->rotate.axis.z; |
48 *angle_from = 0; | 48 *angle_from = 0; |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 if (!IsOperationIdentity(from) && IsOperationIdentity(to)) { | 52 if (!IsOperationIdentity(from) && !to) { |
53 *axis_x = from->rotate.axis.x; | 53 *axis_x = from->rotate.axis.x; |
54 *axis_y = from->rotate.axis.y; | 54 *axis_y = from->rotate.axis.y; |
55 *axis_z = from->rotate.axis.z; | 55 *axis_z = from->rotate.axis.z; |
56 *angle_from = from->rotate.angle; | 56 *angle_from = from->rotate.angle; |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 SkMScalar length_2 = from->rotate.axis.x * from->rotate.axis.x + | 60 SkMScalar length_2 = from->rotate.axis.x * from->rotate.axis.x + |
61 from->rotate.axis.y * from->rotate.axis.y + | 61 from->rotate.axis.y * from->rotate.axis.y + |
62 from->rotate.axis.z * from->rotate.axis.z; | 62 from->rotate.axis.z * from->rotate.axis.z; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 return true; | 430 return true; |
431 } | 431 } |
432 case TransformOperation::TRANSFORM_OPERATION_MATRIX: | 432 case TransformOperation::TRANSFORM_OPERATION_MATRIX: |
433 return false; | 433 return false; |
434 } | 434 } |
435 NOTREACHED(); | 435 NOTREACHED(); |
436 return false; | 436 return false; |
437 } | 437 } |
438 | 438 |
439 } // namespace cc | 439 } // namespace cc |
OLD | NEW |