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