Chromium Code Reviews| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 /** These methods allow one to efficiently read matrix entries into an | 280 /** These methods allow one to efficiently read matrix entries into an |
| 281 * array. The given array must have room for exactly 16 entries. Whenever | 281 * array. The given array must have room for exactly 16 entries. Whenever |
| 282 * possible, they will try to use memcpy rather than an entry-by-entry | 282 * possible, they will try to use memcpy rather than an entry-by-entry |
| 283 * copy. | 283 * copy. |
| 284 */ | 284 */ |
| 285 void asColMajorf(float[]) const; | 285 void asColMajorf(float[]) const; |
| 286 void asColMajord(double[]) const; | 286 void asColMajord(double[]) const; |
| 287 void asRowMajorf(float[]) const; | 287 void asRowMajorf(float[]) const; |
| 288 void asRowMajord(double[]) const; | 288 void asRowMajord(double[]) const; |
| 289 | 289 |
| 290 /** Efficiently reads 12 matrix entries, ignoring the last col. | |
| 291 * This is typically useful when we know the last col is (0, 0, 0, 1). | |
| 292 */ | |
| 293 void as4x3ColMajorf(float[]) const; | |
| 294 | |
| 290 /** These methods allow one to efficiently set all matrix entries from an | 295 /** These methods allow one to efficiently set all matrix entries from an |
| 291 * array. The given array must have room for exactly 16 entries. Whenever | 296 * array. The given array must have room for exactly 16 entries. Whenever |
| 292 * possible, they will try to use memcpy rather than an entry-by-entry | 297 * possible, they will try to use memcpy rather than an entry-by-entry |
| 293 * copy. | 298 * copy. |
| 294 */ | 299 */ |
| 295 void setColMajorf(const float[]); | 300 void setColMajorf(const float[]); |
| 296 void setColMajord(const double[]); | 301 void setColMajord(const double[]); |
| 297 void setRowMajorf(const float[]); | 302 void setRowMajorf(const float[]); |
| 298 void setRowMajord(const double[]); | 303 void setRowMajord(const double[]); |
| 299 | 304 |
| 300 #ifdef SK_MSCALAR_IS_FLOAT | 305 #ifdef SK_MSCALAR_IS_FLOAT |
| 301 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } | 306 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } |
| 302 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } | 307 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } |
| 303 #else | 308 #else |
| 304 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } | 309 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } |
| 305 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } | 310 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } |
| 306 #endif | 311 #endif |
| 307 | 312 |
| 308 /* This sets the top-left of the matrix and clears the translation and | 313 /* This sets the top-left of the matrix and clears the translation and |
| 309 * perspective components (with [3][3] set to 1). */ | 314 * perspective components (with [3][3] set to 1). */ |
| 310 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, | 315 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, |
| 311 SkMScalar m10, SkMScalar m11, SkMScalar m12, | 316 SkMScalar m10, SkMScalar m11, SkMScalar m12, |
| 312 SkMScalar m20, SkMScalar m21, SkMScalar m22); | 317 SkMScalar m20, SkMScalar m21, SkMScalar m22); |
| 313 void set3x3ColMajorf(const float[]); | 318 void set3x3ColMajorf(const float[]); |
| 314 | 319 |
| 320 /* This sets the top-left of the matrix and clears the | |
| 321 * perspective components (with [3][3] set to 1). */ | |
|
reed1
2016/06/21 20:45:01
Lets make these private helpers at first. Not sure
msarett
2016/06/21 21:47:45
sgtm, done.
| |
| 322 void set4x3ColMajorf(const float[]); | |
| 323 | |
| 315 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 324 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 316 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 325 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 317 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 326 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 318 | 327 |
| 319 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 328 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
| 320 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 329 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
| 321 void postScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 330 void postScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
| 322 | 331 |
| 323 inline void setScale(SkMScalar scale) { | 332 inline void setScale(SkMScalar scale) { |
| 324 this->setScale(scale, scale, scale); | 333 this->setScale(scale, scale, scale); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 /** | 474 /** |
| 466 * Does not take the time to 'compute' the typemask. Only returns true if | 475 * Does not take the time to 'compute' the typemask. Only returns true if |
| 467 * we already know that this matrix is identity. | 476 * we already know that this matrix is identity. |
| 468 */ | 477 */ |
| 469 inline bool isTriviallyIdentity() const { | 478 inline bool isTriviallyIdentity() const { |
| 470 return 0 == fTypeMask; | 479 return 0 == fTypeMask; |
| 471 } | 480 } |
| 472 }; | 481 }; |
| 473 | 482 |
| 474 #endif | 483 #endif |
| OLD | NEW |