diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/skia/skia/src/utils/SkMatrix22.cpp | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/skia/skia/src/utils/SkMatrix22.cpp')
-rw-r--r-- | gfx/skia/skia/src/utils/SkMatrix22.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/utils/SkMatrix22.cpp b/gfx/skia/skia/src/utils/SkMatrix22.cpp new file mode 100644 index 000000000..a13b72939 --- /dev/null +++ b/gfx/skia/skia/src/utils/SkMatrix22.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "SkMatrix.h" +#include "SkMatrix22.h" +#include "SkPoint.h" +#include "SkScalar.h" + +void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) { + const SkScalar& a = h.fX; + const SkScalar& b = h.fY; + SkScalar c, s; + if (0 == b) { + c = SkScalarCopySign(SK_Scalar1, a); + s = 0; + //r = SkScalarAbs(a); + } else if (0 == a) { + c = 0; + s = -SkScalarCopySign(SK_Scalar1, b); + //r = SkScalarAbs(b); + } else if (SkScalarAbs(b) > SkScalarAbs(a)) { + SkScalar t = a / b; + SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), b); + s = -SK_Scalar1 / u; + c = -s * t; + //r = b * u; + } else { + SkScalar t = b / a; + SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), a); + c = SK_Scalar1 / u; + s = -c * t; + //r = a * u; + } + + G->setSinCos(s, c); +} |