Index: include/core/SkShader.h |
diff --git a/include/core/SkShader.h b/include/core/SkShader.h |
index 69037d95f663bc34d597a2014754a0859c3cfb78..c442fae4fd7d0ca45e06086b6ef480c066bd1e23 100644 |
--- a/include/core/SkShader.h |
+++ b/include/core/SkShader.h |
@@ -18,6 +18,7 @@ |
class SkColorFilter; |
class SkColorSpace; |
+class SkImage; |
class SkPath; |
class SkPicture; |
class SkXfermode; |
@@ -242,6 +243,18 @@ public: |
} |
/** |
+ * Iff this shader is backed by a single SkImage, return its ptr (the caller must ref this |
+ * if they want to keep it longer than the lifetime of the shader). If not, return nullptr. |
+ */ |
+ SkImage* isAImage(SkMatrix* localMatrix, TileMode xy[2]) const { |
+ return this->onIsAImage(localMatrix, xy); |
+ } |
+ |
+ bool isAImage() const { |
+ return this->isAImage(nullptr, nullptr) != nullptr; |
+ } |
+ |
+ /** |
* If the shader subclass can be represented as a gradient, asAGradient |
* returns the matching GradientType enum (or kNone_GradientType if it |
* cannot). Also, if info is not null, asAGradient populates info with |
@@ -512,6 +525,10 @@ protected: |
return false; |
} |
+ virtual SkImage* onIsAImage(SkMatrix*, TileMode[2]) const { |
+ return nullptr; |
+ } |
+ |
private: |
// This is essentially const, but not officially so it can be modified in |
// constructors. |