diff options
author | 2013-03-27 18:31:15 +0000 | |
---|---|---|
committer | 2013-03-27 18:31:15 +0000 | |
commit | f51c01328dc52a87c07e056d6fc4eb7452ccac7a (patch) | |
tree | ab5902f078fe940005ae5b7bd767cd6d629de640 /include/core/SkXfermode.h | |
parent | 31ec7985f2b52a0cab4aa714a613b918cf663c08 (diff) |
Add interface to SkXfermode to return a GrEffect and blend coeffs.
Review URL: https://codereview.chromium.org/13097006
git-svn-id: http://skia.googlecode.com/svn/trunk@8412 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkXfermode.h')
-rw-r--r-- | include/core/SkXfermode.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h index 930403f8da..0a0099f3e2 100644 --- a/include/core/SkXfermode.h +++ b/include/core/SkXfermode.h @@ -13,6 +13,8 @@ #include "SkFlattenable.h" #include "SkColor.h" +class GrContext; +class GrEffectRef; class SkString; /** \class SkXfermode @@ -74,7 +76,7 @@ public: /** * The same as calling xfermode->asCoeff(..), except that this also checks - * if the xfermode is NULL, and if so, treats its as kSrcOver_Mode. + * if the xfermode is NULL, and if so, treats it as kSrcOver_Mode. */ static bool AsCoeff(const SkXfermode*, Coeff* src, Coeff* dst); @@ -136,7 +138,7 @@ public: /** * The same as calling xfermode->asMode(mode), except that this also checks - * if the xfermode is NULL, and if so, treats its as kSrcOver_Mode. + * if the xfermode is NULL, and if so, treats it as kSrcOver_Mode. */ static bool AsMode(const SkXfermode*, Mode* mode); @@ -181,6 +183,22 @@ public: return AsMode(xfer, mode); } + /** A subclass may implement this factory function to work with the GPU backend. It is legal + to call this with all but the context param NULL to simply test the return value. effect, + src, and dst must all be NULL or all non-NULL. If effect is non-NULL then the xfermode may + optionally allocate an effect to return and the caller as *effect. The caller will install + it and own a ref to it. Since the xfermode may or may not assign *effect, the caller should + set *effect to NULL beforehand. If the function returns true then the src and dst coeffs + will be applied to the draw regardless of whether an effect was returned. + */ + virtual bool asNewEffect(GrContext*, GrEffectRef** effect, Coeff* src, Coeff* dst) const; + + /** + * The same as calling xfermode->asNewEffect(...), except that this also checks if the xfermode + * is NULL, and if so, treats it as kSrcOver_Mode. + */ + static bool AsNewEffect(SkXfermode*, GrContext*, GrEffectRef** effect, Coeff* src, Coeff* dst); + SkDEVCODE(virtual void toString(SkString* str) const = 0;) SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() protected: |