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

Unified Diff: include/core/SkXfermode.h

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: capitalization Created 6 years 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
Index: include/core/SkXfermode.h
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index bedcc2456976713cdd7159d3dac16782f038ada9..2a8034084d80aa0ea22e768df4cb287f10492a9e 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -15,6 +15,7 @@
class GrFragmentProcessor;
class GrTexture;
+class GrXPFactory;
class SkString;
/** \class SkXfermode
@@ -198,16 +199,29 @@ public:
fragment shader. If NULL, the effect should request access to destination color
(setWillReadDstColor()), and use that in the fragment shader (builder->dstColor()).
*/
+ // TODO: Once all custom xp's have been created the background parameter will be required here.
+ // We will always use the XPProcessor if there is not background texture and the fragment if
bsalomon 2014/12/01 19:24:39 XPFactory?
egdaniel 2014/12/02 15:07:09 Done.
+ // there is one.
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture* background = NULL) const;
- /** Returns true if the xfermode can be expressed as coeffs (src, dst), or as an effect
- (effect). This helper calls the asCoeff() and asFragmentProcessor() virtuals. If the
- xfermode is NULL, it is treated as kSrcOver_Mode. It is legal to call this with all params
- NULL to simply test the return value. effect, src, and dst must all be NULL or all
- non-NULL.
+ /** A subclass may implement this factory function to work with the GPU backend. It is legal
+ to call this with xpf NULL to simply test the return value. If factory is non-NULL
bsalomon 2014/12/01 19:24:39 My mistake before, I think it should be "If xpf is
egdaniel 2014/12/02 15:07:09 Done.
+ then the xfermode may optionally allocate a factory to return and the caller as *xpf.
+ The caller will install it and own a ref to it. Since the xfermode may or may not assign
+ *xpf, the caller should set *xpf to NULL beforehand. XP's cannot use a background texture
+ since they have no coord transforms.
+ */
+ virtual bool asXPFactory(GrXPFactory** xpf) const;
+
+ /** Returns true if the xfermode can be expressed as an xfer processor factory (xpFactory),
+ or a fragment processor. This helper calls the asCoeff(), asXPFactory(),
+ and asFragmentProcessor() virtuals. If the xfermode is NULL, it is treated as kSrcOver_Mode.
+ It is legal to call this with all params NULL to simply test the return value.
+ fp, xpf, src, and dst must all be NULL or all non-NULL.
*/
- static bool asFragmentProcessorOrCoeff(SkXfermode*, GrFragmentProcessor**, Coeff* src,
- Coeff* dst, GrTexture* background = NULL);
+ static bool AsFragmentProcessorOrXPFactory(SkXfermode*, GrFragmentProcessor**,
bsalomon 2014/12/01 19:24:39 Can't wait for this to die. AFAIK there is only on
egdaniel 2014/12/02 15:07:09 Done.
+ GrXPFactory**, Coeff* src, Coeff* dst,
+ GrTexture* background = NULL);
SK_TO_STRING_PUREVIRT()
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()

Powered by Google App Engine
This is Rietveld 408576698