OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #ifndef SkShader_DEFINED | 9 #ifndef SkShader_DEFINED |
10 #define SkShader_DEFINED | 10 #define SkShader_DEFINED |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const SkMatrix& getLocalMatrix() const { return fLocalMatrix; } | 48 const SkMatrix& getLocalMatrix() const { return fLocalMatrix; } |
49 | 49 |
50 /** | 50 /** |
51 * Returns true if the local matrix is not an identity matrix. | 51 * Returns true if the local matrix is not an identity matrix. |
52 * | 52 * |
53 * FIXME: This can be incorrect for a Shader with its own local matrix | 53 * FIXME: This can be incorrect for a Shader with its own local matrix |
54 * that is also wrapped via CreateLocalMatrixShader. | 54 * that is also wrapped via CreateLocalMatrixShader. |
55 */ | 55 */ |
56 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } | 56 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } |
57 | 57 |
58 #ifdef SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX | |
59 /** | |
60 * Set the shader's local matrix. | |
61 * @param localM The shader's new local matrix. | |
62 */ | |
63 void setLocalMatrix(const SkMatrix& localM) { fLocalMatrix = localM; } | |
64 | |
65 /** | |
66 * Reset the shader's local matrix to identity. | |
67 */ | |
68 void resetLocalMatrix() { fLocalMatrix.reset(); } | |
69 #endif | |
70 | |
71 enum TileMode { | 58 enum TileMode { |
72 /** replicate the edge color if the shader draws outside of its | 59 /** replicate the edge color if the shader draws outside of its |
73 * original bounds | 60 * original bounds |
74 */ | 61 */ |
75 kClamp_TileMode, | 62 kClamp_TileMode, |
76 | 63 |
77 /** repeat the shader's image horizontally and vertically */ | 64 /** repeat the shader's image horizontally and vertically */ |
78 kRepeat_TileMode, | 65 kRepeat_TileMode, |
79 | 66 |
80 /** repeat the shader's image horizontally and vertically, alternating | 67 /** repeat the shader's image horizontally and vertically, alternating |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 459 |
473 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; | 460 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; |
474 | 461 |
475 /** | 462 /** |
476 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). | 463 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). |
477 * Base class impl returns NULL. | 464 * Base class impl returns NULL. |
478 */ | 465 */ |
479 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 466 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
480 | 467 |
481 private: | 468 private: |
| 469 // This is essentially const, but not officially so it can be modified in |
| 470 // constructors. |
482 SkMatrix fLocalMatrix; | 471 SkMatrix fLocalMatrix; |
483 | 472 |
484 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 473 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
485 friend class SkLocalMatrixShader; | 474 friend class SkLocalMatrixShader; |
486 | 475 |
487 typedef SkFlattenable INHERITED; | 476 typedef SkFlattenable INHERITED; |
488 }; | 477 }; |
489 | 478 |
490 #endif | 479 #endif |
OLD | NEW |