Flutter Engine
The Flutter Engine
third_party
skia
src
utils
SkMatrix22.cpp
Go to the documentation of this file.
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 "
src/utils/SkMatrix22.h
"
9
10
#include "
include/core/SkMatrix.h
"
11
#include "
include/core/SkPoint.h
"
12
#include "
include/core/SkScalar.h
"
13
14
void
SkComputeGivensRotation
(
const
SkVector
&
h
,
SkMatrix
*
G
) {
15
const
SkScalar
&
a
=
h
.fX;
16
const
SkScalar
&
b
=
h
.fY;
17
SkScalar
c,
s
;
18
if
(0 ==
b
) {
19
c =
SkScalarCopySign
(
SK_Scalar1
,
a
);
20
s
= 0;
21
//r = SkScalarAbs(a);
22
}
else
if
(0 ==
a
) {
23
c = 0;
24
s
= -
SkScalarCopySign
(
SK_Scalar1
,
b
);
25
//r = SkScalarAbs(b);
26
}
else
if
(
SkScalarAbs
(
b
) >
SkScalarAbs
(
a
)) {
27
SkScalar
t =
a
/
b
;
28
SkScalar
u =
SkScalarCopySign
(
SkScalarSqrt
(
SK_Scalar1
+ t*t),
b
);
29
s
= -
SK_Scalar1
/ u;
30
c = -
s
* t;
31
//r = b * u;
32
}
else
{
33
SkScalar
t =
b
/
a
;
34
SkScalar
u =
SkScalarCopySign
(
SkScalarSqrt
(
SK_Scalar1
+ t*t),
a
);
35
c =
SK_Scalar1
/ u;
36
s
= -c * t;
37
//r = a * u;
38
}
39
40
G
->setSinCos(
s
, c);
41
}
SkComputeGivensRotation
void SkComputeGivensRotation(const SkVector &h, SkMatrix *G)
Definition:
SkMatrix22.cpp:14
SkMatrix22.h
SkMatrix.h
SkPoint.h
SkScalar.h
SkScalarCopySign
#define SkScalarCopySign(x, y)
Definition:
SkScalar.h:40
SK_Scalar1
#define SK_Scalar1
Definition:
SkScalar.h:18
SkScalarSqrt
#define SkScalarSqrt(x)
Definition:
SkScalar.h:42
SkScalarAbs
#define SkScalarAbs(x)
Definition:
SkScalar.h:39
SkMatrix
Definition:
SkMatrix.h:54
SkScalar
float SkScalar
Definition:
extension.cpp:12
b
static bool b
Definition:
ffi_native_test_module.c:74
s
struct MyStruct s
a
struct MyStruct a[10]
h
SkScalar h
Definition:
pictureshadertile.cpp:30
G
Definition:
SkMD5.cpp:125
SkPoint
Definition:
SkPoint_impl.h:163
Generated on Sun Jun 23 2024 21:56:36 for Flutter Engine by
1.9.4