OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkMatrix44_DEFINED | 8 #ifndef SkMatrix44_DEFINED |
9 #define SkMatrix44_DEFINED | 9 #define SkMatrix44_DEFINED |
10 | 10 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 fTypeMask = src.fTypeMask; | 130 fTypeMask = src.fTypeMask; |
131 } | 131 } |
132 return *this; | 132 return *this; |
133 } | 133 } |
134 | 134 |
135 bool operator==(const SkMatrix44& other) const; | 135 bool operator==(const SkMatrix44& other) const; |
136 bool operator!=(const SkMatrix44& other) const { | 136 bool operator!=(const SkMatrix44& other) const { |
137 return !(other == *this); | 137 return !(other == *this); |
138 } | 138 } |
139 | 139 |
| 140 /* When converting from SkMatrix44 to SkMatrix, the third row and |
| 141 * column is dropped. When converting from SkMatrix to SkMatrix44 |
| 142 * the third row and column remain as identity: |
| 143 * [ a b c ] [ a b 0 c ] |
| 144 * [ d e f ] -> [ d e 0 f ] |
| 145 * [ g h i ] [ 0 0 1 0 ] |
| 146 * [ g h 0 i ] |
| 147 */ |
140 SkMatrix44(const SkMatrix&); | 148 SkMatrix44(const SkMatrix&); |
141 SkMatrix44& operator=(const SkMatrix& src); | 149 SkMatrix44& operator=(const SkMatrix& src); |
142 operator SkMatrix() const; | 150 operator SkMatrix() const; |
143 | 151 |
144 /** | 152 /** |
145 * Return a reference to a const identity matrix | 153 * Return a reference to a const identity matrix |
146 */ | 154 */ |
147 static const SkMatrix44& I(); | 155 static const SkMatrix44& I(); |
148 | 156 |
149 enum TypeMask { | 157 enum TypeMask { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 void setRowMajord(const double[]); | 260 void setRowMajord(const double[]); |
253 | 261 |
254 #ifdef SK_MSCALAR_IS_FLOAT | 262 #ifdef SK_MSCALAR_IS_FLOAT |
255 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } | 263 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } |
256 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } | 264 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } |
257 #else | 265 #else |
258 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } | 266 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } |
259 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } | 267 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } |
260 #endif | 268 #endif |
261 | 269 |
| 270 /* This sets the top-left of the matrix and clears the translation and |
| 271 * perspective components (with [3][3] set to 1). */ |
262 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, | 272 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, |
263 SkMScalar m10, SkMScalar m11, SkMScalar m12, | 273 SkMScalar m10, SkMScalar m11, SkMScalar m12, |
264 SkMScalar m20, SkMScalar m21, SkMScalar m22); | 274 SkMScalar m20, SkMScalar m21, SkMScalar m22); |
265 | 275 |
266 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 276 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
267 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 277 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
268 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 278 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
269 | 279 |
270 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 280 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
271 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 281 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 /** | 412 /** |
403 * Does not take the time to 'compute' the typemask. Only returns true if | 413 * Does not take the time to 'compute' the typemask. Only returns true if |
404 * we already know that this matrix is identity. | 414 * we already know that this matrix is identity. |
405 */ | 415 */ |
406 inline bool isTriviallyIdentity() const { | 416 inline bool isTriviallyIdentity() const { |
407 return 0 == fTypeMask; | 417 return 0 == fTypeMask; |
408 } | 418 } |
409 }; | 419 }; |
410 | 420 |
411 #endif | 421 #endif |
OLD | NEW |