aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkXfermode.h
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-31 17:49:12 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-05-31 17:49:12 +0000
commit86fc266eda887920e3dd104bee8121ae19729cf5 (patch)
treeca43dd64735b058926a9efaf6e3c9a7cf65e2fd4 /include/core/SkXfermode.h
parent70fdc128377bac81dac987fdc996a1b4e269e1fb (diff)
Implement SkXfermode image filter. This required changing the signature of SkXfermode::asNewEffectOrCoeffs(), to add an optional background texture.
For the raster path, we do a straightforward 2-pass method: draw background, then composite the foreground over it. For the GPU path, if the xfermode can be expressed as an effect, we build an effect with the background texture incorporated, then do a single-pass draw fetching both foreground and background textures, and compositing to the result. If the xfermode is expressed as src/dst coefficients, we do a 2-pass draw as in the raster path and use fixed-function blending. R=bsalomon@google.com, reed@google.com Review URL: https://codereview.chromium.org/16125008 git-svn-id: http://skia.googlecode.com/svn/trunk@9373 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkXfermode.h')
-rw-r--r--include/core/SkXfermode.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index f960e14af7..03ca1014e6 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -15,6 +15,7 @@
class GrContext;
class GrEffectRef;
+class GrTexture;
class SkString;
/** \class SkXfermode
@@ -197,12 +198,16 @@ public:
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 and *effect is NULL then the
src and dst coeffs will be applied to the draw. When *effect is non-NULL the coeffs are
- ignored.
+ ignored. background specifies the texture to use as the background for compositing, and
+ should be accessed in the effect's fragment shader. If NULL, the effect should request
+ access to destination color (setWillReadDstColor()), and use that in the fragment shader
+ (builder->dstColor()).
*/
virtual bool asNewEffectOrCoeff(GrContext*,
GrEffectRef** effect,
Coeff* src,
- Coeff* dst) const;
+ Coeff* dst,
+ GrTexture* background = NULL) const;
/**
* The same as calling xfermode->asNewEffect(...), except that this also checks if the xfermode
@@ -212,7 +217,8 @@ public:
GrContext*,
GrEffectRef** effect,
Coeff* src,
- Coeff* dst);
+ Coeff* dst,
+ GrTexture* background = NULL);
SkDEVCODE(virtual void toString(SkString* str) const = 0;)
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()