aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrBicubicEffect.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-10 12:53:39 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-10 12:53:39 +0000
commitbc91fd71faa2c5fd14423fecd18e50701c922ced (patch)
treef045fb8f3095e0b403e3a89ba4b79a3665047c50 /src/gpu/effects/GrBicubicEffect.h
parentcf0803b46f60d9fcb5ad9a376b638c4c32b655de (diff)
Make GrBicubicEffect take tile modes rather than GrTextureParams.
GrTextureParams allows the caller to override the filter mode. But no filtering other than nearest neighbor makes sense. Also removes coord set from creation signature since it is unused. R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/99523008 git-svn-id: http://skia.googlecode.com/svn/trunk@12591 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.h')
-rw-r--r--src/gpu/effects/GrBicubicEffect.h44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index d8c431a4a1..85bec771b4 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -31,34 +31,44 @@ public:
virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
- static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
- AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients)));
- return CreateEffectRef(effect);
+ /**
+ * Create a simple Mitchell filter effect.
+ */
+ static GrEffectRef* Create(GrTexture* tex) {
+ return Create(tex, gMitchellCoefficients);
}
- static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
- const SkMatrix& matrix,
- const GrTextureParams& p,
- GrCoordSet coordSet = kLocal_GrCoordSet) {
- AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, p, coordSet)));
- return CreateEffectRef(effect);
+ /**
+ * Create a simple filter effect with custom bicubic coefficients.
+ */
+ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
+ const SkShader::TileMode tm[] = { SkShader::kClamp_TileMode, SkShader::kClamp_TileMode };
+ return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), tm);
}
- static GrEffectRef* Create(GrTexture* tex) {
- return Create(tex, gMitchellCoefficients);
+ /**
+ * Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
+ */
+ static GrEffectRef* Create(GrTexture* tex,
+ const SkMatrix& matrix,
+ SkShader::TileMode tileModes[2]) {
+ return Create(tex, gMitchellCoefficients, matrix, tileModes);
}
- static GrEffectRef* Create(GrTexture* tex,
+ /**
+ * The most general Create method. This allows specification of the bicubic coefficients, the
+ * texture matrix, and the x/y tilemodes.
+ */
+ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
const SkMatrix& matrix,
- const GrTextureParams& p,
- GrCoordSet coordSet = kLocal_GrCoordSet) {
- return Create(tex, gMitchellCoefficients, matrix, p, coordSet);
+ const SkShader::TileMode tileModes[2]) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes)));
+ return CreateEffectRef(effect);
}
private:
- GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]);
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
- const SkMatrix &matrix, const GrTextureParams &p, GrCoordSet coordSet);
+ const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
float fCoefficients[16];