Chromium Code Reviews

Unified Diff: include/core/SkShader.h

Issue 272503011: Add functions for inspecting SkShader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « include/core/SkComposeShader.h ('k') | src/core/SkComposeShader.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 dc93b84749dcc3341174875d5ed07d4f30d655e6..afbd537b186652c0b91fbb718370a86068511c7e 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -17,6 +17,7 @@
class SkPath;
class SkPicture;
+class SkXfermode;
class GrContext;
class GrEffectRef;
@@ -354,6 +355,20 @@ public:
virtual GradientType asAGradient(GradientInfo* info) const;
/**
+ * If the shader subclass is composed of two shaders, return true, and if rec is not NULL,
+ * fill it out with info about the shader.
+ */
+
+ struct ComposeRec {
+ const SkShader* fShaderA;
+ const SkShader* fShaderB;
+ const SkXfermode* fMode;
+ };
+
+ virtual bool asACompose(ComposeRec* rec) const { return false; }
reed1 2014/05/07 22:35:37 you and your implementations inline for virtual me
scroggo 2014/05/07 22:53:11 It saves typing!
+
+
+ /**
* If the shader subclass has a GrEffect implementation, this resturns the effect to install.
* The incoming color to the effect has r=g=b=a all extracted from the SkPaint's alpha.
* The output color should be the computed SkShader premul color modulated by the incoming
@@ -362,6 +377,14 @@ public:
*/
virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint& paint) const;
+#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
+ /**
+ * If the shader is a custom shader which has data the caller might want, call this function
+ * to get that data.
+ */
+ virtual bool asACustomShader(void** customData) const { return false; }
+#endif
+
//////////////////////////////////////////////////////////////////////////
// Factory methods for stock shaders
« no previous file with comments | « include/core/SkComposeShader.h ('k') | src/core/SkComposeShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine