Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: include/core/SkShader.h

Issue 2197323002: implement isABitmap for imageshader, return localmatrix for bitmap's impl (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add isAImage api Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | src/core/SkBitmapProcShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698