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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return !(this->getType() & ~kTranslate_Mask); | 218 return !(this->getType() & ~kTranslate_Mask); |
219 } | 219 } |
220 | 220 |
221 /** | 221 /** |
222 * Return true if the matrix only contains scale or translate or is identit
y. | 222 * Return true if the matrix only contains scale or translate or is identit
y. |
223 */ | 223 */ |
224 inline bool isScaleTranslate() const { | 224 inline bool isScaleTranslate() const { |
225 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); | 225 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); |
226 } | 226 } |
227 | 227 |
| 228 /** |
| 229 * Returns true if the matrix only contains scale or is identity. |
| 230 */ |
| 231 inline bool isScale() const { |
| 232 return !(this->getType() & ~kScale_Mask); |
| 233 } |
| 234 |
228 inline bool hasPerspective() const { | 235 inline bool hasPerspective() const { |
229 return SkToBool(this->getType() & kPerspective_Mask); | 236 return SkToBool(this->getType() & kPerspective_Mask); |
230 } | 237 } |
231 | 238 |
232 void setIdentity(); | 239 void setIdentity(); |
233 inline void reset() { this->setIdentity();} | 240 inline void reset() { this->setIdentity();} |
234 | 241 |
235 /** | 242 /** |
236 * get a value from the matrix. The row,col parameters work as follows: | 243 * get a value from the matrix. The row,col parameters work as follows: |
237 * (0, 0) scale-x | 244 * (0, 0) scale-x |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 /** | 463 /** |
457 * Does not take the time to 'compute' the typemask. Only returns true if | 464 * Does not take the time to 'compute' the typemask. Only returns true if |
458 * we already know that this matrix is identity. | 465 * we already know that this matrix is identity. |
459 */ | 466 */ |
460 inline bool isTriviallyIdentity() const { | 467 inline bool isTriviallyIdentity() const { |
461 return 0 == fTypeMask; | 468 return 0 == fTypeMask; |
462 } | 469 } |
463 }; | 470 }; |
464 | 471 |
465 #endif | 472 #endif |
OLD | NEW |