| 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 20 matching lines...) Expand all Loading... |
| 31 * to be modified. | 31 * to be modified. |
| 32 */ | 32 */ |
| 33 class SK_API SkShader : public SkFlattenable { | 33 class SK_API SkShader : public SkFlattenable { |
| 34 public: | 34 public: |
| 35 SK_DECLARE_INST_COUNT(SkShader) | 35 SK_DECLARE_INST_COUNT(SkShader) |
| 36 | 36 |
| 37 SkShader(const SkMatrix* localMatrix = NULL); | 37 SkShader(const SkMatrix* localMatrix = NULL); |
| 38 virtual ~SkShader(); | 38 virtual ~SkShader(); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Returns the local matrix. |
| 42 */ |
| 43 const SkMatrix& getLocalMatrix() const { return fLocalMatrix; } |
| 44 |
| 45 #ifdef SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX |
| 46 /** |
| 41 * Returns true if the local matrix is not an identity matrix. | 47 * Returns true if the local matrix is not an identity matrix. |
| 42 */ | 48 */ |
| 43 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } | 49 bool hasLocalMatrix() const { return !fLocalMatrix.isIdentity(); } |
| 44 | 50 |
| 45 /** | 51 /** |
| 46 * Returns the local matrix. | |
| 47 */ | |
| 48 const SkMatrix& getLocalMatrix() const { return fLocalMatrix; } | |
| 49 | |
| 50 /** | |
| 51 * Set the shader's local matrix. | 52 * Set the shader's local matrix. |
| 52 * @param localM The shader's new local matrix. | 53 * @param localM The shader's new local matrix. |
| 53 */ | 54 */ |
| 54 void setLocalMatrix(const SkMatrix& localM) { fLocalMatrix = localM; } | 55 void setLocalMatrix(const SkMatrix& localM) { fLocalMatrix = localM; } |
| 55 | 56 |
| 56 /** | 57 /** |
| 57 * Reset the shader's local matrix to identity. | 58 * Reset the shader's local matrix to identity. |
| 58 */ | 59 */ |
| 59 void resetLocalMatrix() { fLocalMatrix.reset(); } | 60 void resetLocalMatrix() { fLocalMatrix.reset(); } |
| 61 #endif |
| 60 | 62 |
| 61 enum TileMode { | 63 enum TileMode { |
| 62 /** replicate the edge color if the shader draws outside of its | 64 /** replicate the edge color if the shader draws outside of its |
| 63 * original bounds | 65 * original bounds |
| 64 */ | 66 */ |
| 65 kClamp_TileMode, | 67 kClamp_TileMode, |
| 66 | 68 |
| 67 /** repeat the shader's image horizontally and vertically */ | 69 /** repeat the shader's image horizontally and vertically */ |
| 68 kRepeat_TileMode, | 70 kRepeat_TileMode, |
| 69 | 71 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 */ | 435 */ |
| 434 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 436 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
| 435 | 437 |
| 436 private: | 438 private: |
| 437 SkMatrix fLocalMatrix; | 439 SkMatrix fLocalMatrix; |
| 438 | 440 |
| 439 typedef SkFlattenable INHERITED; | 441 typedef SkFlattenable INHERITED; |
| 440 }; | 442 }; |
| 441 | 443 |
| 442 #endif | 444 #endif |
| OLD | NEW |