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

Unified Diff: include/core/SkShader.h

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments Created 6 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 | « include/core/SkColorShader.h ('k') | include/gpu/GrContext.h » ('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 2ed91f87b10f536d9085a3218625f1fca0549909..8871f1b02131daac82f4aaf43d52721c532dc846 100644
--- a/include/core/SkShader.h
+++ b/include/core/SkShader.h
@@ -374,17 +374,24 @@ public:
/**
- * Returns true if the shader subclass succeeds in setting the grEffect and the grColor output
- * parameters to a value, returns false if it fails or if there is not an implementation of
- * this method in the shader subclass.
- * 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
- * color. The GrContext may be used by the effect to create textures. The GPU device does not
+ * Returns true if the shader subclass succeeds in creating an effect or if none is required.
+ * False is returned if it fails or if there is not an implementation of this method in the
+ * shader subclass.
+ *
+ * On success an implementation of this method must inspect the SkPaint and set paintColor to
+ * the color the effect expects as its input color. If the SkShader wishes to emit a solid
+ * color then it should set paintColor to that color and not create an effect. Note that
+ * GrColor is always premul. The common patterns are to convert paint's SkColor to GrColor or
+ * to extract paint's alpha and replicate it to all channels in paintColor. Upon failure
+ * paintColor should not be modified. It is not recommended to specialize the effect to
+ * the paint's color as then many GPU shaders may be generated.
+ *
+ * The GrContext may be used by the effect to create textures. The GPU device does not
* call createContext. Instead we pass the SkPaint here in case the shader needs paint info.
*/
virtual bool asNewEffect(GrContext* context, const SkPaint& paint,
- const SkMatrix* localMatrixOrNull, GrColor* grColor,
- GrEffect** grEffect) const;
+ const SkMatrix* localMatrixOrNull, GrColor* paintColor,
+ GrEffect** effect) const;
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
/**
« no previous file with comments | « include/core/SkColorShader.h ('k') | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698