Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1372)

Side by Side Diff: src/utils/SkMatrix22.cpp

Issue 213153006: Fix size of rotated text with FreeType. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/utils/SkMatrix22.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkMatrix.h"
9 #include "SkPoint.h"
10 #include "SkScalar.h"
11
12 void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) {
13 const SkScalar& a = h.fX;
14 const SkScalar& b = h.fY;
15 SkScalar c, s;
16 if (0 == b) {
17 c = SkScalarCopySign(SK_Scalar1, a);
18 s = 0;
19 //r = SkScalarAbs(a);
20 } else if (0 == a) {
21 c = 0;
22 s = -SkScalarCopySign(SK_Scalar1, b);
23 //r = SkScalarAbs(b);
24 } else if (SkScalarAbs(b) > SkScalarAbs(a)) {
25 SkScalar t = a / b;
26 SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), b);
27 s = -SK_Scalar1 / u;
28 c = -s * t;
29 //r = b * u;
30 } else {
31 SkScalar t = b / a;
32 SkScalar u = SkScalarCopySign(SkScalarSqrt(SK_Scalar1 + t*t), a);
33 c = SK_Scalar1 / u;
34 s = -c * t;
35 //r = a * u;
36 }
37
38 G->setSinCos(s, c);
39 }
OLDNEW
« no previous file with comments | « src/utils/SkMatrix22.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698