diff options
author | 2014-12-03 10:40:13 -0800 | |
---|---|---|
committer | 2014-12-03 10:40:13 -0800 | |
commit | 378092f3d10b1dd62967f419c35cfefec7c10ee7 (patch) | |
tree | 2053505fc4cccddb5a366ef26897128b2a65b0cd /include/core | |
parent | 5ab7e80f2b477c55be9861ab1c56e33e19aa97a6 (diff) |
Add XferProcessor factory in GrPaint and GrDrawState.
In this CL the XP should have zero effect on the actual rendering pipeline.
BUG=skia:
Review URL: https://codereview.chromium.org/751283002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkXfermode.h | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h index 6d723e8fc2..35e9837483 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,28 @@ 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 XPFactory if there is no background texture and the fragment if + // 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 xpf is non-NULL then the + xfermode may optionally allocate a factory to return to 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**, + GrXPFactory**, Coeff* src, Coeff* dst); SK_TO_STRING_PUREVIRT() SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |