Flutter Engine
The Flutter Engine
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 */
8
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
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}
float SkScalar
Definition: extension.cpp:12
int32_t height
int32_t width
void set(float x, float y)
Definition: SkPoint_impl.h:200
SkScalar fTy
Definition: SkRSXform.h:45
SkScalar fSCos
Definition: SkRSXform.h:42
void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const
Definition: SkRSXform.cpp:9
void toTriStrip(SkScalar width, SkScalar height, SkPoint strip[4]) const
Definition: SkRSXform.cpp:33
SkScalar fTx
Definition: SkRSXform.h:44
SkScalar fSSin
Definition: SkRSXform.h:43