Skia
2D Graphics Library
SkM44.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 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 SkM44_DEFINED
9 #define SkM44_DEFINED
10 
11 #include "include/core/SkMatrix.h"
12 #include "include/core/SkScalar.h"
13 
14 struct SkV2 {
15  float x, y;
16 
17  bool operator==(const SkV2 v) const { return x == v.x && y == v.y; }
18  bool operator!=(const SkV2 v) const { return !(*this == v); }
19 
20  static SkScalar Dot(SkV2 a, SkV2 b) { return a.x * b.x + a.y * b.y; }
21  static SkScalar Cross(SkV2 a, SkV2 b) { return a.x * b.y - a.y * b.x; }
22  static SkV2 Normalize(SkV2 v) { return v * (1.0f / v.length()); }
23 
24  SkV2 operator-() const { return {-x, -y}; }
25  SkV2 operator+(SkV2 v) const { return {x+v.x, y+v.y}; }
26  SkV2 operator-(SkV2 v) const { return {x-v.x, y-v.y}; }
27 
28  SkV2 operator*(SkV2 v) const { return {x*v.x, y*v.y}; }
29  friend SkV2 operator*(SkV2 v, SkScalar s) { return {v.x*s, v.y*s}; }
30  friend SkV2 operator*(SkScalar s, SkV2 v) { return {v.x*s, v.y*s}; }
31  friend SkV2 operator/(SkV2 v, SkScalar s) { return {v.x/s, v.y/s}; }
32 
33  void operator+=(SkV2 v) { *this = *this + v; }
34  void operator-=(SkV2 v) { *this = *this - v; }
35  void operator*=(SkV2 v) { *this = *this * v; }
36  void operator*=(SkScalar s) { *this = *this * s; }
37  void operator/=(SkScalar s) { *this = *this / s; }
38 
39  SkScalar lengthSquared() const { return Dot(*this, *this); }
40  SkScalar length() const { return SkScalarSqrt(this->lengthSquared()); }
41 
42  SkScalar dot(SkV2 v) const { return Dot(*this, v); }
43  SkScalar cross(SkV2 v) const { return Cross(*this, v); }
44  SkV2 normalize() const { return Normalize(*this); }
45 
46  const float* ptr() const { return &x; }
47  float* ptr() { return &x; }
48 };
49 
50 struct SkV3 {
51  float x, y, z;
52 
53  bool operator==(const SkV3& v) const {
54  return x == v.x && y == v.y && z == v.z;
55  }
56  bool operator!=(const SkV3& v) const { return !(*this == v); }
57 
58  static SkScalar Dot(const SkV3& a, const SkV3& b) { return a.x*b.x + a.y*b.y + a.z*b.z; }
59  static SkV3 Cross(const SkV3& a, const SkV3& b) {
60  return { a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x };
61  }
62  static SkV3 Normalize(const SkV3& v) { return v * (1.0f / v.length()); }
63 
64  SkV3 operator-() const { return {-x, -y, -z}; }
65  SkV3 operator+(const SkV3& v) const { return { x + v.x, y + v.y, z + v.z }; }
66  SkV3 operator-(const SkV3& v) const { return { x - v.x, y - v.y, z - v.z }; }
67 
68  SkV3 operator*(const SkV3& v) const {
69  return { x*v.x, y*v.y, z*v.z };
70  }
71  friend SkV3 operator*(const SkV3& v, SkScalar s) {
72  return { v.x*s, v.y*s, v.z*s };
73  }
74  friend SkV3 operator*(SkScalar s, const SkV3& v) { return v*s; }
75 
76  void operator+=(SkV3 v) { *this = *this + v; }
77  void operator-=(SkV3 v) { *this = *this - v; }
78  void operator*=(SkV3 v) { *this = *this * v; }
79  void operator*=(SkScalar s) { *this = *this * s; }
80 
81  SkScalar lengthSquared() const { return Dot(*this, *this); }
82  SkScalar length() const { return SkScalarSqrt(Dot(*this, *this)); }
83 
84  SkScalar dot(const SkV3& v) const { return Dot(*this, v); }
85  SkV3 cross(const SkV3& v) const { return Cross(*this, v); }
86  SkV3 normalize() const { return Normalize(*this); }
87 
88  const float* ptr() const { return &x; }
89  float* ptr() { return &x; }
90 };
91 
92 struct SkV4 {
93  float x, y, z, w;
94 
95  bool operator==(const SkV4& v) const {
96  return x == v.x && y == v.y && z == v.z && w == v.w;
97  }
98  bool operator!=(const SkV4& v) const { return !(*this == v); }
99 
100  SkV4 operator-() const { return {-x, -y, -z, -w}; }
101  SkV4 operator+(const SkV4& v) const { return { x + v.x, y + v.y, z + v.z, w + v.w }; }
102  SkV4 operator-(const SkV4& v) const { return { x - v.x, y - v.y, z - v.z, w - v.w }; }
103 
104  SkV4 operator*(const SkV4& v) const {
105  return { x*v.x, y*v.y, z*v.z, w*v.w };
106  }
107  friend SkV4 operator*(const SkV4& v, SkScalar s) {
108  return { v.x*s, v.y*s, v.z*s, v.w*s };
109  }
110  friend SkV4 operator*(SkScalar s, const SkV4& v) { return v*s; }
111 
112  const float* ptr() const { return &x; }
113  float* ptr() { return &x; }
114 
115  float operator[](int i) const {
116  SkASSERT(i >= 0 && i < 4);
117  return this->ptr()[i];
118  }
119  float& operator[](int i) {
120  SkASSERT(i >= 0 && i < 4);
121  return this->ptr()[i];
122  }
123 };
124 
133 class SK_API SkM44 {
134 public:
135  SkM44(const SkM44& src) = default;
136  SkM44& operator=(const SkM44& src) = default;
137 
138  constexpr SkM44()
139  : fMat{1, 0, 0, 0,
140  0, 1, 0, 0,
141  0, 0, 1, 0,
142  0, 0, 0, 1}
143  {}
144 
145  SkM44(const SkM44& a, const SkM44& b) {
146  this->setConcat(a, b);
147  }
148 
150  kUninitialized_Constructor
151  };
153 
155  kNaN_Constructor
156  };
162  {}
163 
167  constexpr SkM44(SkScalar m0, SkScalar m4, SkScalar m8, SkScalar m12,
168  SkScalar m1, SkScalar m5, SkScalar m9, SkScalar m13,
169  SkScalar m2, SkScalar m6, SkScalar m10, SkScalar m14,
170  SkScalar m3, SkScalar m7, SkScalar m11, SkScalar m15)
171  // fMat is column-major order in memory.
172  : fMat{m0, m1, m2, m3,
173  m4, m5, m6, m7,
174  m8, m9, m10, m11,
175  m12, m13, m14, m15}
176  {}
177 
178  static SkM44 Rows(const SkV4& r0, const SkV4& r1, const SkV4& r2, const SkV4& r3) {
179  SkM44 m(kUninitialized_Constructor);
180  m.setRow(0, r0);
181  m.setRow(1, r1);
182  m.setRow(2, r2);
183  m.setRow(3, r3);
184  return m;
185  }
186  static SkM44 Cols(const SkV4& c0, const SkV4& c1, const SkV4& c2, const SkV4& c3) {
187  SkM44 m(kUninitialized_Constructor);
188  m.setCol(0, c0);
189  m.setCol(1, c1);
190  m.setCol(2, c2);
191  m.setCol(3, c3);
192  return m;
193  }
194 
195  static SkM44 RowMajor(const SkScalar r[16]) {
196  return SkM44(r[ 0], r[ 1], r[ 2], r[ 3],
197  r[ 4], r[ 5], r[ 6], r[ 7],
198  r[ 8], r[ 9], r[10], r[11],
199  r[12], r[13], r[14], r[15]);
200  }
201  static SkM44 ColMajor(const SkScalar c[16]) {
202  return SkM44(c[0], c[4], c[ 8], c[12],
203  c[1], c[5], c[ 9], c[13],
204  c[2], c[6], c[10], c[14],
205  c[3], c[7], c[11], c[15]);
206  }
207 
208  static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z = 0) {
209  return SkM44(1, 0, 0, x,
210  0, 1, 0, y,
211  0, 0, 1, z,
212  0, 0, 0, 1);
213  }
214 
215  static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z = 1) {
216  return SkM44(x, 0, 0, 0,
217  0, y, 0, 0,
218  0, 0, z, 0,
219  0, 0, 0, 1);
220  }
221 
222  static SkM44 Rotate(SkV3 axis, SkScalar radians) {
223  SkM44 m(kUninitialized_Constructor);
224  m.setRotate(axis, radians);
225  return m;
226  }
227 
228  bool operator==(const SkM44& other) const;
229  bool operator!=(const SkM44& other) const {
230  return !(other == *this);
231  }
232 
233  void getColMajor(SkScalar v[]) const {
234  memcpy(v, fMat, sizeof(fMat));
235  }
236  void getRowMajor(SkScalar v[]) const;
237 
238  SkScalar rc(int r, int c) const {
239  SkASSERT(r >= 0 && r <= 3);
240  SkASSERT(c >= 0 && c <= 3);
241  return fMat[c*4 + r];
242  }
243  void setRC(int r, int c, SkScalar value) {
244  SkASSERT(r >= 0 && r <= 3);
245  SkASSERT(c >= 0 && c <= 3);
246  fMat[c*4 + r] = value;
247  }
248 
249  SkV4 row(int i) const {
250  SkASSERT(i >= 0 && i <= 3);
251  return {fMat[i + 0], fMat[i + 4], fMat[i + 8], fMat[i + 12]};
252  }
253  SkV4 col(int i) const {
254  SkASSERT(i >= 0 && i <= 3);
255  return {fMat[i*4 + 0], fMat[i*4 + 1], fMat[i*4 + 2], fMat[i*4 + 3]};
256  }
257 
258  void setRow(int i, const SkV4& v) {
259  SkASSERT(i >= 0 && i <= 3);
260  fMat[i + 0] = v.x;
261  fMat[i + 4] = v.y;
262  fMat[i + 8] = v.z;
263  fMat[i + 12] = v.w;
264  }
265  void setCol(int i, const SkV4& v) {
266  SkASSERT(i >= 0 && i <= 3);
267  memcpy(&fMat[i*4], v.ptr(), sizeof(v));
268  }
269 
271  *this = { 1, 0, 0, 0,
272  0, 1, 0, 0,
273  0, 0, 1, 0,
274  0, 0, 0, 1 };
275  return *this;
276  }
277 
279  *this = { 1, 0, 0, x,
280  0, 1, 0, y,
281  0, 0, 1, z,
282  0, 0, 0, 1 };
283  return *this;
284  }
285 
287  *this = { x, 0, 0, 0,
288  0, y, 0, 0,
289  0, 0, z, 0,
290  0, 0, 0, 1 };
291  return *this;
292  }
293 
301  SkM44& setRotateUnitSinCos(SkV3 axis, SkScalar sinAngle, SkScalar cosAngle);
302 
309  SkM44& setRotateUnit(SkV3 axis, SkScalar radians) {
310  return this->setRotateUnitSinCos(axis, SkScalarSin(radians), SkScalarCos(radians));
311  }
312 
320  SkM44& setRotate(SkV3 axis, SkScalar radians);
321 
322  SkM44& setConcat(const SkM44& a, const SkM44& b);
323 
324  friend SkM44 operator*(const SkM44& a, const SkM44& b) {
325  return SkM44(a, b);
326  }
327 
328  SkM44& preConcat(const SkM44& m) {
329  return this->setConcat(*this, m);
330  }
331 
332  SkM44& postConcat(const SkM44& m) {
333  return this->setConcat(m, *this);
334  }
335 
349 
355  bool isFinite() const { return SkScalarsAreFinite(fMat, 16); }
356 
360  bool SK_WARN_UNUSED_RESULT invert(SkM44* inverse) const;
361 
363 
364  void dump() const;
365 
367 
368  SkV4 map(float x, float y, float z, float w) const;
369  SkV4 operator*(const SkV4& v) const {
370  return this->map(v.x, v.y, v.z, v.w);
371  }
372  SkV3 operator*(SkV3 v) const {
373  auto v4 = this->map(v.x, v.y, v.z, 0);
374  return {v4.x, v4.y, v4.z};
375  }
376 
378 
379  /* When converting from SkM44 to SkMatrix, the third row and
380  * column is dropped. When converting from SkMatrix to SkM44
381  * the third row and column remain as identity:
382  * [ a b c ] [ a b 0 c ]
383  * [ d e f ] -> [ d e 0 f ]
384  * [ g h i ] [ 0 0 1 0 ]
385  * [ g h 0 i ]
386  */
387  SkMatrix asM33() const {
388  return SkMatrix::MakeAll(fMat[0], fMat[4], fMat[12],
389  fMat[1], fMat[5], fMat[13],
390  fMat[3], fMat[7], fMat[15]);
391  }
392 
393  explicit SkM44(const SkMatrix& src)
394  : SkM44(src[SkMatrix::kMScaleX], src[SkMatrix::kMSkewX], 0, src[SkMatrix::kMTransX],
395  src[SkMatrix::kMSkewY], src[SkMatrix::kMScaleY], 0, src[SkMatrix::kMTransY],
396  0, 0, 1, 0,
397  src[SkMatrix::kMPersp0], src[SkMatrix::kMPersp1], 0, src[SkMatrix::kMPersp2])
398  {}
399 
402 
405 
406 private:
407  /* Stored in column-major.
408  * Indices
409  * 0 4 8 12 1 0 0 trans_x
410  * 1 5 9 13 e.g. 0 1 0 trans_y
411  * 2 6 10 14 0 0 1 trans_z
412  * 3 7 11 15 0 0 0 1
413  */
414  SkScalar fMat[16];
415 
416  friend class SkMatrixPriv;
417 };
418 
419 SkM44 Sk3LookAt(const SkV3& eye, const SkV3& center, const SkV3& up);
420 SkM44 Sk3Perspective(float near, float far, float angle);
421 
422 #endif
SkM44::SkM44
SkM44(const SkM44 &src)=default
SkV2::normalize
SkV2 normalize() const
Definition: SkM44.h:44
SkM44::ColMajor
static SkM44 ColMajor(const SkScalar c[16])
Definition: SkM44.h:201
SkV3::x
float x
Definition: SkM44.h:51
SkV4::operator==
bool operator==(const SkV4 &v) const
Definition: SkM44.h:95
SkM44::invert
bool SK_WARN_UNUSED_RESULT invert(SkM44 *inverse) const
If this is invertible, return that in inverse and return true.
SkM44::preTranslate
SkM44 & preTranslate(SkScalar x, SkScalar y, SkScalar z=0)
SkM44::setRotateUnit
SkM44 & setRotateUnit(SkV3 axis, SkScalar radians)
Set this matrix to rotate about the specified unit-length axis vector, by an angle specified in radia...
Definition: SkM44.h:309
SkV3::length
SkScalar length() const
Definition: SkM44.h:82
SkM44::preConcat
SkM44 & preConcat(const SkM44 &m)
Definition: SkM44.h:328
SkM44::operator!=
bool operator!=(const SkM44 &other) const
Definition: SkM44.h:229
SkM44::setTranslate
SkM44 & setTranslate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:278
SkM44::operator*
SkV3 operator*(SkV3 v) const
Definition: SkM44.h:372
SkV2::operator*=
void operator*=(SkScalar s)
Definition: SkM44.h:36
SkV2::operator-
SkV2 operator-() const
Definition: SkM44.h:24
SkM44::Cols
static SkM44 Cols(const SkV4 &c0, const SkV4 &c1, const SkV4 &c2, const SkV4 &c3)
Definition: SkM44.h:186
SkM44
4x4 matrix used by SkCanvas and other parts of Skia.
Definition: SkM44.h:133
SkM44::setRC
void setRC(int r, int c, SkScalar value)
Definition: SkM44.h:243
SkV2::x
float x
Definition: SkM44.h:15
SkV4::operator!=
bool operator!=(const SkV4 &v) const
Definition: SkM44.h:98
SkV4::operator[]
float & operator[](int i)
Definition: SkM44.h:119
SkV3::operator+
SkV3 operator+(const SkV3 &v) const
Definition: SkM44.h:65
SkV3::operator+=
void operator+=(SkV3 v)
Definition: SkM44.h:76
SkV2::lengthSquared
SkScalar lengthSquared() const
Definition: SkM44.h:39
SkM44::operator=
SkM44 & operator=(const SkM44 &src)=default
SkV3
Definition: SkM44.h:50
SkV2::operator*
SkV2 operator*(SkV2 v) const
Definition: SkM44.h:28
SkM44::Uninitialized_Constructor
Uninitialized_Constructor
Definition: SkM44.h:149
SkV2::operator/
friend SkV2 operator/(SkV2 v, SkScalar s)
Definition: SkM44.h:31
SkM44::operator==
bool operator==(const SkM44 &other) const
SkM44::Scale
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:215
SkV3::operator-=
void operator-=(SkV3 v)
Definition: SkM44.h:77
SkV2::length
SkScalar length() const
Definition: SkM44.h:40
SkM44::setRotate
SkM44 & setRotate(SkV3 axis, SkScalar radians)
Set this matrix to rotate about the specified axis vector, by an angle specified in radians.
SkM44::getColMajor
void getColMajor(SkScalar v[]) const
Definition: SkM44.h:233
SkV3::operator!=
bool operator!=(const SkV3 &v) const
Definition: SkM44.h:56
SkV2
Definition: SkM44.h:14
SkV4::x
float x
Definition: SkM44.h:93
SkV3::ptr
const float * ptr() const
Definition: SkM44.h:88
Sk3LookAt
SkM44 Sk3LookAt(const SkV3 &eye, const SkV3 &center, const SkV3 &up)
SkM44::postConcat
SkM44 & postConcat(const SkM44 &m)
Definition: SkM44.h:332
SK_ScalarNaN
#define SK_ScalarNaN
Definition: SkScalar.h:27
SkM44::Translate
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition: SkM44.h:208
SkM44::setRotateUnitSinCos
SkM44 & setRotateUnitSinCos(SkV3 axis, SkScalar sinAngle, SkScalar cosAngle)
Set this matrix to rotate about the specified unit-length axis vector, by an angle specified by its s...
SkV2::operator*=
void operator*=(SkV2 v)
Definition: SkM44.h:35
SkScalar.h
SkM44::SkM44
SkM44(const SkM44 &a, const SkM44 &b)
Definition: SkM44.h:145
SkV3::operator*=
void operator*=(SkV3 v)
Definition: SkM44.h:78
SkV4::operator-
SkV4 operator-() const
Definition: SkM44.h:100
SkM44::setIdentity
SkM44 & setIdentity()
Definition: SkM44.h:270
SkM44::isFinite
bool isFinite() const
Returns true if all elements of the matrix are finite.
Definition: SkM44.h:355
SkM44::Rows
static SkM44 Rows(const SkV4 &r0, const SkV4 &r1, const SkV4 &r2, const SkV4 &r3)
Definition: SkM44.h:178
SkM44::asM33
SkMatrix asM33() const
Definition: SkM44.h:387
SkM44::postTranslate
SkM44 & postTranslate(SkScalar x, SkScalar y, SkScalar z=0)
SkV4::operator*
friend SkV4 operator*(const SkV4 &v, SkScalar s)
Definition: SkM44.h:107
SkV3::operator-
SkV3 operator-() const
Definition: SkM44.h:64
SkV4
Definition: SkM44.h:92
SK_API
#define SK_API
Definition: SkTypes.h:181
SkASSERT
#define SkASSERT(cond)
Definition: SkTypes.h:460
SkV2::operator==
bool operator==(const SkV2 v) const
Definition: SkM44.h:17
SkM44::SkM44
constexpr SkM44(NaN_Constructor)
Definition: SkM44.h:157
SkV3::operator==
bool operator==(const SkV3 &v) const
Definition: SkM44.h:53
SkV4::z
float z
Definition: SkM44.h:93
SkV4::operator-
SkV4 operator-(const SkV4 &v) const
Definition: SkM44.h:102
SkV3::operator*
friend SkV3 operator*(SkScalar s, const SkV3 &v)
Definition: SkM44.h:74
SkV3::normalize
SkV3 normalize() const
Definition: SkM44.h:86
SkV3::operator*
SkV3 operator*(const SkV3 &v) const
Definition: SkM44.h:68
SkV4::operator*
friend SkV4 operator*(SkScalar s, const SkV4 &v)
Definition: SkM44.h:110
SkV3::Dot
static SkScalar Dot(const SkV3 &a, const SkV3 &b)
Definition: SkM44.h:58
SkV2::operator!=
bool operator!=(const SkV2 v) const
Definition: SkM44.h:18
SkV3::operator*
friend SkV3 operator*(const SkV3 &v, SkScalar s)
Definition: SkM44.h:71
SkM44::setScale
SkM44 & setScale(SkScalar x, SkScalar y, SkScalar z=1)
Definition: SkM44.h:286
SkM44::SkM44
SkM44(const SkMatrix &src)
Definition: SkM44.h:393
SkV2::Cross
static SkScalar Cross(SkV2 a, SkV2 b)
Definition: SkM44.h:21
SkM44::row
SkV4 row(int i) const
Definition: SkM44.h:249
SkScalar
float SkScalar
Definition: SkScalar.h:16
SkV2::y
float y
Definition: SkM44.h:15
SkM44::operator*
friend SkM44 operator*(const SkM44 &a, const SkM44 &b)
Definition: SkM44.h:324
SkV2::operator+
SkV2 operator+(SkV2 v) const
Definition: SkM44.h:25
SkV3::Normalize
static SkV3 Normalize(const SkV3 &v)
Definition: SkM44.h:62
SkV2::Dot
static SkScalar Dot(SkV2 a, SkV2 b)
Definition: SkM44.h:20
SkM44::map
SkV4 map(float x, float y, float z, float w) const
SkV3::operator*=
void operator*=(SkScalar s)
Definition: SkM44.h:79
SkV3::z
float z
Definition: SkM44.h:51
SkM44::getRowMajor
void getRowMajor(SkScalar v[]) const
SkM44::preConcat
SkM44 & preConcat(const SkMatrix &)
SkScalarsAreFinite
static bool SkScalarsAreFinite(SkScalar a, SkScalar b)
Definition: SkScalar.h:73
SkM44::SkM44
constexpr SkM44()
Definition: SkM44.h:138
SkV3::cross
SkV3 cross(const SkV3 &v) const
Definition: SkM44.h:85
SkM44::rc
SkScalar rc(int r, int c) const
Definition: SkM44.h:238
SkV3::dot
SkScalar dot(const SkV3 &v) const
Definition: SkM44.h:84
SkM44::preScale
SkM44 & preScale(SkScalar x, SkScalar y)
SkV3::Cross
static SkV3 Cross(const SkV3 &a, const SkV3 &b)
Definition: SkM44.h:59
SkV4::operator[]
float operator[](int i) const
Definition: SkM44.h:115
SkV4::ptr
float * ptr()
Definition: SkM44.h:113
SkM44::SkM44
constexpr SkM44(SkScalar m0, SkScalar m4, SkScalar m8, SkScalar m12, SkScalar m1, SkScalar m5, SkScalar m9, SkScalar m13, SkScalar m2, SkScalar m6, SkScalar m10, SkScalar m14, SkScalar m3, SkScalar m7, SkScalar m11, SkScalar m15)
The constructor parameters are in row-major order.
Definition: SkM44.h:167
SkV2::operator-=
void operator-=(SkV2 v)
Definition: SkM44.h:34
SkMatrix
Definition: SkMatrix.h:48
SkScalarSqrt
#define SkScalarSqrt(x)
Definition: SkScalar.h:41
SkV2::operator*
friend SkV2 operator*(SkScalar s, SkV2 v)
Definition: SkM44.h:30
SkMatrix.h
SkV2::ptr
float * ptr()
Definition: SkM44.h:47
SK_WARN_UNUSED_RESULT
#define SK_WARN_UNUSED_RESULT
Definition: SkTypes.h:60
SkScalarCos
#define SkScalarCos(radians)
Definition: SkScalar.h:45
SkV2::dot
SkScalar dot(SkV2 v) const
Definition: SkM44.h:42
SkV4::operator+
SkV4 operator+(const SkV4 &v) const
Definition: SkM44.h:101
SkM44::col
SkV4 col(int i) const
Definition: SkM44.h:253
SkV3::y
float y
Definition: SkM44.h:51
SkM44::Rotate
static SkM44 Rotate(SkV3 axis, SkScalar radians)
Definition: SkM44.h:222
SkV2::operator-
SkV2 operator-(SkV2 v) const
Definition: SkM44.h:26
SkV2::operator+=
void operator+=(SkV2 v)
Definition: SkM44.h:33
SkV4::operator*
SkV4 operator*(const SkV4 &v) const
Definition: SkM44.h:104
SkM44::NaN_Constructor
NaN_Constructor
Definition: SkM44.h:154
SkV2::operator/=
void operator/=(SkScalar s)
Definition: SkM44.h:37
SkM44::RowMajor
static SkM44 RowMajor(const SkScalar r[16])
Definition: SkM44.h:195
SkV2::operator*
friend SkV2 operator*(SkV2 v, SkScalar s)
Definition: SkM44.h:29
SkM44::dump
void dump() const
SkM44::setConcat
SkM44 & setConcat(const SkM44 &a, const SkM44 &b)
SkV4::y
float y
Definition: SkM44.h:93
SkV3::ptr
float * ptr()
Definition: SkM44.h:89
SkV2::Normalize
static SkV2 Normalize(SkV2 v)
Definition: SkM44.h:22
SkV4::ptr
const float * ptr() const
Definition: SkM44.h:112
SkM44::setCol
void setCol(int i, const SkV4 &v)
Definition: SkM44.h:265
SkScalarSin
#define SkScalarSin(radians)
Definition: SkScalar.h:44
SkV2::ptr
const float * ptr() const
Definition: SkM44.h:46
SkM44::transpose
SkM44 SK_WARN_UNUSED_RESULT transpose() const
SkM44::normalizePerspective
void normalizePerspective()
A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 0, 1].
SkV3::operator-
SkV3 operator-(const SkV3 &v) const
Definition: SkM44.h:66
SkV2::cross
SkScalar cross(SkV2 v) const
Definition: SkM44.h:43
SkMatrix::MakeAll
static SkMatrix SK_WARN_UNUSED_RESULT MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Sets SkMatrix to:
Definition: SkMatrix.h:173
SkM44::SkM44
SkM44(Uninitialized_Constructor)
Definition: SkM44.h:152
SkM44::setRow
void setRow(int i, const SkV4 &v)
Definition: SkM44.h:258
SkV4::w
float w
Definition: SkM44.h:93
SkM44::operator*
SkV4 operator*(const SkV4 &v) const
Definition: SkM44.h:369
SkV3::lengthSquared
SkScalar lengthSquared() const
Definition: SkM44.h:81
Sk3Perspective
SkM44 Sk3Perspective(float near, float far, float angle)