Flutter Engine
The Flutter Engine
third_party
skia
src
core
SkRSXform.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2023 Google LLC
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
#include "
include/core/SkRSXform.h
"
8
9
void
SkRSXform::toQuad
(
SkScalar
width
,
SkScalar
height
,
SkPoint
quad[4])
const
{
10
#if 0
11
// This is the slow way, but it documents what we're doing
12
quad[0].
set
(0, 0);
13
quad[1].
set
(
width
, 0);
14
quad[2].
set
(
width
,
height
);
15
quad[3].
set
(0,
height
);
16
SkMatrix
m
;
17
m
.setRSXform(*this).mapPoints(quad, quad, 4);
18
#else
19
const
SkScalar
m00 =
fSCos
;
20
const
SkScalar
m01 = -
fSSin
;
21
const
SkScalar
m02 =
fTx
;
22
const
SkScalar
m10 = -m01;
23
const
SkScalar
m11 = m00;
24
const
SkScalar
m12 =
fTy
;
25
26
quad[0].
set
(m02, m12);
27
quad[1].
set
(m00 *
width
+ m02, m10 *
width
+ m12);
28
quad[2].
set
(m00 *
width
+ m01 *
height
+ m02, m10 *
width
+ m11 *
height
+ m12);
29
quad[3].
set
(m01 *
height
+ m02, m11 *
height
+ m12);
30
#endif
31
}
32
33
void
SkRSXform::toTriStrip
(
SkScalar
width
,
SkScalar
height
,
SkPoint
strip[4])
const
{
34
const
SkScalar
m00 =
fSCos
;
35
const
SkScalar
m01 = -
fSSin
;
36
const
SkScalar
m02 =
fTx
;
37
const
SkScalar
m10 = -m01;
38
const
SkScalar
m11 = m00;
39
const
SkScalar
m12 =
fTy
;
40
41
strip[0].
set
(m02, m12);
42
strip[1].
set
(m01 *
height
+ m02, m11 *
height
+ m12);
43
strip[2].
set
(m00 *
width
+ m02, m10 *
width
+ m12);
44
strip[3].
set
(m00 *
width
+ m01 *
height
+ m02, m10 *
width
+ m11 *
height
+ m12);
45
}
SkRSXform.h
SkMatrix
Definition:
SkMatrix.h:54
SkScalar
float SkScalar
Definition:
extension.cpp:12
dart_profiler_symbols.m
m
Definition:
dart_profiler_symbols.py:64
height
int32_t height
Definition:
serialization_callbacks.cc:1
width
int32_t width
Definition:
serialization_callbacks.cc:0
SkPoint
Definition:
SkPoint_impl.h:163
SkPoint::set
void set(float x, float y)
Definition:
SkPoint_impl.h:200
SkRSXform::fTy
SkScalar fTy
Definition:
SkRSXform.h:45
SkRSXform::fSCos
SkScalar fSCos
Definition:
SkRSXform.h:42
SkRSXform::toQuad
void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const
Definition:
SkRSXform.cpp:9
SkRSXform::toTriStrip
void toTriStrip(SkScalar width, SkScalar height, SkPoint strip[4]) const
Definition:
SkRSXform.cpp:33
SkRSXform::fTx
SkScalar fTx
Definition:
SkRSXform.h:44
SkRSXform::fSSin
SkScalar fSSin
Definition:
SkRSXform.h:43
Generated on Sun Jun 23 2024 21:56:14 for Flutter Engine by
1.9.4