OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "SkMatrix22.h" |
9 #include "SkPoint.h" | 10 #include "SkPoint.h" |
10 #include "SkScalar.h" | 11 #include "SkScalar.h" |
11 | 12 |
12 void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) { | 13 void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) { |
13 const SkScalar& a = h.fX; | 14 const SkScalar& a = h.fX; |
14 const SkScalar& b = h.fY; | 15 const SkScalar& b = h.fY; |
15 SkScalar c, s; | 16 SkScalar c, s; |
16 if (0 == b) { | 17 if (0 == b) { |
17 c = SkScalarCopySign(SK_Scalar1, a); | 18 c = SkScalarCopySign(SK_Scalar1, a); |
18 s = 0; | 19 s = 0; |
(...skipping 11 matching lines...) Expand all Loading... |
30 } else { | 31 } else { |
31 SkScalar t = b / a; | 32 SkScalar t = b / a; |
32 SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), a); | 33 SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), a); |
33 c = SK_Scalar1 / u; | 34 c = SK_Scalar1 / u; |
34 s = -c * t; | 35 s = -c * t; |
35 //r = a * u; | 36 //r = a * u; |
36 } | 37 } |
37 | 38 |
38 G->setSinCos(s, c); | 39 G->setSinCos(s, c); |
39 } | 40 } |
OLD | NEW |