make the filter mode for GrTextureAccess an enum so we can plumb down
the paint's filter modes to the GPU
BUG=
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/20362002
git-svn-id: http://skia.googlecode.com/svn/trunk@10368 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index c2dc360..06615d2 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -110,7 +110,8 @@
kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))],
};
- GrTextureParams params(tileModes, random->nextBool());
+ GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode :
+ GrTextureParams::kNone_FilterMode);
static const CoordsType kCoordsTypes[] = {
kLocal_CoordsType,
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index 661f40f..f80ff8d 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -27,18 +27,18 @@
const SkMatrix& matrix,
CoordsType coordsType = kLocal_CoordsType) {
GrAssert(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType);
- AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, false, coordsType)));
+ AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordsType)));
return CreateEffectRef(effect);
}
/* clamp mode */
static GrEffectRef* Create(GrTexture* tex,
const SkMatrix& matrix,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType coordsType = kLocal_CoordsType) {
GrAssert(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType);
AutoEffectUnref effect(
- SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, bilerp, coordsType)));
+ SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordsType)));
return CreateEffectRef(effect);
}
@@ -74,9 +74,9 @@
private:
GrSimpleTextureEffect(GrTexture* texture,
const SkMatrix& matrix,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType coordsType)
- : GrSingleTextureEffect(texture, matrix, bilerp, coordsType) {
+ : GrSingleTextureEffect(texture, matrix, filterMode, coordsType) {
GrAssert(kLocal_CoordsType == coordsType || kPosition_CoordsType == coordsType);
}
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index 0c671f1..532ce04 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -18,9 +18,9 @@
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
const SkMatrix& m,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType coordsType)
- : fTextureAccess(texture, bilerp)
+ : fTextureAccess(texture, filterMode)
, fMatrix(m)
, fCoordsType(coordsType) {
this->addTextureAccess(&fTextureAccess);
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index 3e0af65..74ca9f9 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -30,7 +30,8 @@
/** unfiltered, clamp mode */
GrSingleTextureEffect(GrTexture*, const SkMatrix&, CoordsType = kLocal_CoordsType);
/** clamp mode */
- GrSingleTextureEffect(GrTexture*, const SkMatrix&, bool bilerp, CoordsType = kLocal_CoordsType);
+ GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMode filterMode,
+ CoordsType = kLocal_CoordsType);
GrSingleTextureEffect(GrTexture*,
const SkMatrix&,
const GrTextureParams&,
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp
index 96372d9..eb4001d 100644
--- a/src/gpu/effects/GrTextureDomainEffect.cpp
+++ b/src/gpu/effects/GrTextureDomainEffect.cpp
@@ -153,11 +153,11 @@
const SkMatrix& matrix,
const SkRect& domain,
WrapMode wrapMode,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType coordsType) {
static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
if (kClamp_WrapMode == wrapMode && domain.contains(kFullRect)) {
- return GrSimpleTextureEffect::Create(texture, matrix, bilerp);
+ return GrSimpleTextureEffect::Create(texture, matrix, filterMode);
} else {
SkRect clippedDomain;
// We don't currently handle domains that are empty or don't intersect the texture.
@@ -176,7 +176,7 @@
matrix,
clippedDomain,
wrapMode,
- bilerp,
+ filterMode,
coordsType)));
return CreateEffectRef(effect);
@@ -187,9 +187,9 @@
const SkMatrix& matrix,
const SkRect& domain,
WrapMode wrapMode,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType coordsType)
- : GrSingleTextureEffect(texture, matrix, bilerp, coordsType)
+ : GrSingleTextureEffect(texture, matrix, filterMode, coordsType)
, fWrapMode(wrapMode)
, fTextureDomain(domain) {
}
@@ -239,6 +239,6 @@
matrix,
domain,
wrapMode,
- bilerp,
+ bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode,
coords);
}
diff --git a/src/gpu/effects/GrTextureDomainEffect.h b/src/gpu/effects/GrTextureDomainEffect.h
index a4017c1..d07f2fc 100644
--- a/src/gpu/effects/GrTextureDomainEffect.h
+++ b/src/gpu/effects/GrTextureDomainEffect.h
@@ -38,7 +38,7 @@
const SkMatrix&,
const SkRect& domain,
WrapMode,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType = kLocal_CoordsType);
virtual ~GrTextureDomainEffect();
@@ -76,7 +76,7 @@
const SkMatrix&,
const SkRect& domain,
WrapMode,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
CoordsType type);
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;