| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 enum Uninitialized_Constructor { | 105 enum Uninitialized_Constructor { |
| 106 kUninitialized_Constructor | 106 kUninitialized_Constructor |
| 107 }; | 107 }; |
| 108 enum Identity_Constructor { | 108 enum Identity_Constructor { |
| 109 kIdentity_Constructor | 109 kIdentity_Constructor |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 SkMatrix44(Uninitialized_Constructor) { } | 112 SkMatrix44(Uninitialized_Constructor) { } |
| 113 SkMatrix44(Identity_Constructor) { this->setIdentity(); } | 113 SkMatrix44(Identity_Constructor) { this->setIdentity(); } |
| 114 | 114 |
| 115 // DEPRECATED: use the constructors that take an enum | 115 SK_ATTR_DEPRECATED("use the constructors that take an enum") |
| 116 SkMatrix44() { this->setIdentity(); } | 116 SkMatrix44() { this->setIdentity(); } |
| 117 | 117 |
| 118 SkMatrix44(const SkMatrix44& src) { | 118 SkMatrix44(const SkMatrix44& src) { |
| 119 memcpy(fMat, src.fMat, sizeof(fMat)); | 119 memcpy(fMat, src.fMat, sizeof(fMat)); |
| 120 fTypeMask = src.fTypeMask; | 120 fTypeMask = src.fTypeMask; |
| 121 } | 121 } |
| 122 | 122 |
| 123 SkMatrix44(const SkMatrix44& a, const SkMatrix44& b) { | 123 SkMatrix44(const SkMatrix44& a, const SkMatrix44& b) { |
| 124 this->setConcat(a, b); | 124 this->setConcat(a, b); |
| 125 } | 125 } |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 void transpose(); | 328 void transpose(); |
| 329 | 329 |
| 330 /** Apply the matrix to the src vector, returning the new vector in dst. | 330 /** Apply the matrix to the src vector, returning the new vector in dst. |
| 331 It is legal for src and dst to point to the same memory. | 331 It is legal for src and dst to point to the same memory. |
| 332 */ | 332 */ |
| 333 void mapScalars(const SkScalar src[4], SkScalar dst[4]) const; | 333 void mapScalars(const SkScalar src[4], SkScalar dst[4]) const; |
| 334 inline void mapScalars(SkScalar vec[4]) const { | 334 inline void mapScalars(SkScalar vec[4]) const { |
| 335 this->mapScalars(vec, vec); | 335 this->mapScalars(vec, vec); |
| 336 } | 336 } |
| 337 | 337 |
| 338 // DEPRECATED: call mapScalars() | 338 SK_ATTR_DEPRECATED("use mapScalars") |
| 339 void map(const SkScalar src[4], SkScalar dst[4]) const { | 339 void map(const SkScalar src[4], SkScalar dst[4]) const { |
| 340 this->mapScalars(src, dst); | 340 this->mapScalars(src, dst); |
| 341 } | 341 } |
| 342 // DEPRECATED: call mapScalars() | 342 |
| 343 SK_ATTR_DEPRECATED("use mapScalars") |
| 343 void map(SkScalar vec[4]) const { | 344 void map(SkScalar vec[4]) const { |
| 344 this->mapScalars(vec, vec); | 345 this->mapScalars(vec, vec); |
| 345 } | 346 } |
| 346 | 347 |
| 347 #ifdef SK_MSCALAR_IS_DOUBLE | 348 #ifdef SK_MSCALAR_IS_DOUBLE |
| 348 void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const; | 349 void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const; |
| 349 #elif defined SK_MSCALAR_IS_FLOAT | 350 #elif defined SK_MSCALAR_IS_FLOAT |
| 350 inline void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const { | 351 inline void mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const { |
| 351 this->mapScalars(src, dst); | 352 this->mapScalars(src, dst); |
| 352 } | 353 } |
| 353 #endif | 354 #endif |
| 354 inline void mapMScalars(SkMScalar vec[4]) const { | 355 inline void mapMScalars(SkMScalar vec[4]) const { |
| 355 this->mapMScalars(vec, vec); | 356 this->mapMScalars(vec, vec); |
| 356 } | 357 } |
| 357 | 358 |
| 358 friend SkVector4 operator*(const SkMatrix44& m, const SkVector4& src) { | 359 friend SkVector4 operator*(const SkMatrix44& m, const SkVector4& src) { |
| 359 SkVector4 dst; | 360 SkVector4 dst; |
| 360 m.map(src.fData, dst.fData); | 361 m.mapScalars(src.fData, dst.fData); |
| 361 return dst; | 362 return dst; |
| 362 } | 363 } |
| 363 | 364 |
| 364 /** | 365 /** |
| 365 * map an array of [x, y, 0, 1] through the matrix, returning an array | 366 * map an array of [x, y, 0, 1] through the matrix, returning an array |
| 366 * of [x', y', z', w']. | 367 * of [x', y', z', w']. |
| 367 * | 368 * |
| 368 * @param src2 array of [x, y] pairs, with implied z=0 and w=1 | 369 * @param src2 array of [x, y] pairs, with implied z=0 and w=1 |
| 369 * @param count number of [x, y] pairs in src2 | 370 * @param count number of [x, y] pairs in src2 |
| 370 * @param dst4 array of [x', y', z', w'] quads as the output. | 371 * @param dst4 array of [x', y', z', w'] quads as the output. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 /** | 413 /** |
| 413 * Does not take the time to 'compute' the typemask. Only returns true if | 414 * Does not take the time to 'compute' the typemask. Only returns true if |
| 414 * we already know that this matrix is identity. | 415 * we already know that this matrix is identity. |
| 415 */ | 416 */ |
| 416 inline bool isTriviallyIdentity() const { | 417 inline bool isTriviallyIdentity() const { |
| 417 return 0 == fTypeMask; | 418 return 0 == fTypeMask; |
| 418 } | 419 } |
| 419 }; | 420 }; |
| 420 | 421 |
| 421 #endif | 422 #endif |
| OLD | NEW |