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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return !(this->getType() & ~kTranslate_Mask); | 191 return !(this->getType() & ~kTranslate_Mask); |
192 } | 192 } |
193 | 193 |
194 /** | 194 /** |
195 * Return true if the matrix only contains scale or translate or is identit
y. | 195 * Return true if the matrix only contains scale or translate or is identit
y. |
196 */ | 196 */ |
197 inline bool isScaleTranslate() const { | 197 inline bool isScaleTranslate() const { |
198 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); | 198 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); |
199 } | 199 } |
200 | 200 |
| 201 inline bool hasPerspective() const { |
| 202 return SkToBool(this->getType() & kPerspective_Mask); |
| 203 } |
| 204 |
201 void setIdentity(); | 205 void setIdentity(); |
202 inline void reset() { this->setIdentity();} | 206 inline void reset() { this->setIdentity();} |
203 | 207 |
204 /** | 208 /** |
205 * get a value from the matrix. The row,col parameters work as follows: | 209 * get a value from the matrix. The row,col parameters work as follows: |
206 * (0, 0) scale-x | 210 * (0, 0) scale-x |
207 * (0, 3) translate-x | 211 * (0, 3) translate-x |
208 * (3, 0) perspective-x | 212 * (3, 0) perspective-x |
209 */ | 213 */ |
210 inline SkMScalar get(int row, int col) const { | 214 inline SkMScalar get(int row, int col) const { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 /** | 417 /** |
414 * Does not take the time to 'compute' the typemask. Only returns true if | 418 * Does not take the time to 'compute' the typemask. Only returns true if |
415 * we already know that this matrix is identity. | 419 * we already know that this matrix is identity. |
416 */ | 420 */ |
417 inline bool isTriviallyIdentity() const { | 421 inline bool isTriviallyIdentity() const { |
418 return 0 == fTypeMask; | 422 return 0 == fTypeMask; |
419 } | 423 } |
420 }; | 424 }; |
421 | 425 |
422 #endif | 426 #endif |
OLD | NEW |