Flutter Engine
The Flutter Engine
SkRSXform.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 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#ifndef SkRSXform_DEFINED
9#define SkRSXform_DEFINED
10
13#include "include/core/SkSize.h"
15
16/**
17 * A compressed form of a rotation+scale matrix.
18 *
19 * [ fSCos -fSSin fTx ]
20 * [ fSSin fSCos fTy ]
21 * [ 0 0 1 ]
22 */
24 static SkRSXform Make(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) {
25 SkRSXform xform = { scos, ssin, tx, ty };
26 return xform;
27 }
28
29 /*
30 * Initialize a new xform based on the scale, rotation (in radians), final tx,ty location
31 * and anchor-point ax,ay within the src quad.
32 *
33 * Note: the anchor point is not normalized (e.g. 0...1) but is in pixels of the src image.
34 */
36 SkScalar ax, SkScalar ay) {
37 const SkScalar s = SkScalarSin(radians) * scale;
38 const SkScalar c = SkScalarCos(radians) * scale;
39 return Make(c, s, tx + -c * ax + s * ay, ty + -s * ax - c * ay);
40 }
41
46
47 bool rectStaysRect() const {
48 return 0 == fSCos || 0 == fSSin;
49 }
50
51 void setIdentity() {
52 fSCos = 1;
53 fSSin = fTx = fTy = 0;
54 }
55
56 void set(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) {
57 fSCos = scos;
58 fSSin = ssin;
59 fTx = tx;
60 fTy = ty;
61 }
62
63 void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const;
64 void toQuad(const SkSize& size, SkPoint quad[4]) const {
65 this->toQuad(size.width(), size.height(), quad);
66 }
67 void toTriStrip(SkScalar width, SkScalar height, SkPoint strip[4]) const;
68};
69
70#endif
71
#define SK_API
Definition: SkAPI.h:35
#define SkScalarSin(radians)
Definition: SkScalar.h:45
#define SkScalarCos(radians)
Definition: SkScalar.h:46
float SkScalar
Definition: extension.cpp:12
struct MyStruct s
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
int32_t height
int32_t width
const Scalar scale
void setIdentity()
Definition: SkRSXform.h:51
SkScalar fTy
Definition: SkRSXform.h:45
SkScalar fSCos
Definition: SkRSXform.h:42
void set(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty)
Definition: SkRSXform.h:56
static SkRSXform Make(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty)
Definition: SkRSXform.h:24
bool rectStaysRect() const
Definition: SkRSXform.h:47
static SkRSXform MakeFromRadians(SkScalar scale, SkScalar radians, SkScalar tx, SkScalar ty, SkScalar ax, SkScalar ay)
Definition: SkRSXform.h:35
void toQuad(const SkSize &size, SkPoint quad[4]) const
Definition: SkRSXform.h:64
SkScalar fTx
Definition: SkRSXform.h:44
SkScalar fSSin
Definition: SkRSXform.h:43
Definition: SkSize.h:52