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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 private: | 432 private: |
433 SkMScalar fMat[4][4]; | 433 SkMScalar fMat[4][4]; |
434 mutable unsigned fTypeMask; | 434 mutable unsigned fTypeMask; |
435 | 435 |
436 enum { | 436 enum { |
437 kUnknown_Mask = 0x80, | 437 kUnknown_Mask = 0x80, |
438 | 438 |
439 kAllPublic_Masks = 0xF | 439 kAllPublic_Masks = 0xF |
440 }; | 440 }; |
441 | 441 |
| 442 /** Efficiently reads 12 matrix entries, ignoring the last col. |
| 443 * This is typically useful when we know the last col is (0, 0, 0, 1). |
| 444 */ |
| 445 void as4x3ColMajorf(float[]) const; |
| 446 |
| 447 /* This sets the top-left of the matrix and clears the |
| 448 * perspective components (with [3][3] set to 1). */ |
| 449 void set4x3ColMajorf(const float[]); |
| 450 |
442 SkMScalar transX() const { return fMat[3][0]; } | 451 SkMScalar transX() const { return fMat[3][0]; } |
443 SkMScalar transY() const { return fMat[3][1]; } | 452 SkMScalar transY() const { return fMat[3][1]; } |
444 SkMScalar transZ() const { return fMat[3][2]; } | 453 SkMScalar transZ() const { return fMat[3][2]; } |
445 | 454 |
446 SkMScalar scaleX() const { return fMat[0][0]; } | 455 SkMScalar scaleX() const { return fMat[0][0]; } |
447 SkMScalar scaleY() const { return fMat[1][1]; } | 456 SkMScalar scaleY() const { return fMat[1][1]; } |
448 SkMScalar scaleZ() const { return fMat[2][2]; } | 457 SkMScalar scaleZ() const { return fMat[2][2]; } |
449 | 458 |
450 SkMScalar perspX() const { return fMat[0][3]; } | 459 SkMScalar perspX() const { return fMat[0][3]; } |
451 SkMScalar perspY() const { return fMat[1][3]; } | 460 SkMScalar perspY() const { return fMat[1][3]; } |
(...skipping 10 matching lines...) Expand all Loading... |
462 fTypeMask = mask; | 471 fTypeMask = mask; |
463 } | 472 } |
464 | 473 |
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 } |
| 481 |
| 482 friend class SkColorSpace; |
472 }; | 483 }; |
473 | 484 |
474 #endif | 485 #endif |
OLD | NEW |