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/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 90382fd..e955cac 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -901,7 +901,7 @@
const GrCacheID& cacheID,
void* srcData,
size_t rowBytes,
- bool needsFiltering);
+ bool filter);
// Needed so GrTexture's returnToCache helper function can call
// addExistingTextureToCache
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 422814b..a870818 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -127,7 +127,7 @@
const GrCacheID& cacheID);
static GrResourceKey ComputeScratchKey(const GrTextureDesc& desc);
static bool NeedsResizing(const GrResourceKey& key);
- static bool NeedsFiltering(const GrResourceKey& key);
+ static bool NeedsBilerp(const GrResourceKey& key);
protected:
// A texture refs its rt representation but not vice-versa. It is up to
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h
index e5ea535..20dc57d 100644
--- a/include/gpu/GrTextureAccess.h
+++ b/include/gpu/GrTextureAccess.h
@@ -25,13 +25,19 @@
GrTextureParams() {
this->reset();
}
+
+ enum FilterMode {
+ kNone_FilterMode,
+ kBilerp_FilterMode,
+ kMipMap_FilterMode
+ };
- GrTextureParams(SkShader::TileMode tileXAndY, bool bilerp) {
- this->reset(tileXAndY, bilerp);
+ GrTextureParams(SkShader::TileMode tileXAndY, FilterMode filterMode) {
+ this->reset(tileXAndY, filterMode);
}
- GrTextureParams(SkShader::TileMode tileModes[2], bool bilerp) {
- this->reset(tileModes, bilerp);
+ GrTextureParams(SkShader::TileMode tileModes[2], FilterMode filterMode) {
+ this->reset(tileModes, filterMode);
}
GrTextureParams(const GrTextureParams& params) {
@@ -41,35 +47,35 @@
GrTextureParams& operator= (const GrTextureParams& params) {
fTileModes[0] = params.fTileModes[0];
fTileModes[1] = params.fTileModes[1];
- fBilerp = params.fBilerp;
+ fFilterMode = params.fFilterMode;
return *this;
}
void reset() {
- this->reset(SkShader::kClamp_TileMode, false);
+ this->reset(SkShader::kClamp_TileMode, kNone_FilterMode);
}
- void reset(SkShader::TileMode tileXAndY, bool bilerp) {
+ void reset(SkShader::TileMode tileXAndY, FilterMode filterMode) {
fTileModes[0] = fTileModes[1] = tileXAndY;
- fBilerp = bilerp;
+ fFilterMode = filterMode;
}
- void reset(SkShader::TileMode tileModes[2], bool bilerp) {
+ void reset(SkShader::TileMode tileModes[2], FilterMode filterMode) {
fTileModes[0] = tileModes[0];
fTileModes[1] = tileModes[1];
- fBilerp = bilerp;
+ fFilterMode = filterMode;
}
void setClampNoFilter() {
fTileModes[0] = fTileModes[1] = SkShader::kClamp_TileMode;
- fBilerp = false;
+ fFilterMode = kNone_FilterMode;
}
void setClamp() {
fTileModes[0] = fTileModes[1] = SkShader::kClamp_TileMode;
}
- void setBilerp(bool bilerp) { fBilerp = bilerp; }
+ void setFilterMode(FilterMode filterMode) { fFilterMode = filterMode; }
void setTileModeX(const SkShader::TileMode tm) { fTileModes[0] = tm; }
void setTileModeY(const SkShader::TileMode tm) { fTileModes[1] = tm; }
@@ -84,12 +90,12 @@
SkShader::kClamp_TileMode != fTileModes[1];
}
- bool isBilerp() const { return fBilerp; }
+ FilterMode filterMode() const { return fFilterMode; }
bool operator== (const GrTextureParams& other) const {
return fTileModes[0] == other.fTileModes[0] &&
fTileModes[1] == other.fTileModes[1] &&
- fBilerp == other.fBilerp;
+ fFilterMode == other.fFilterMode;
}
bool operator!= (const GrTextureParams& other) const { return !(*this == other); }
@@ -97,7 +103,7 @@
private:
SkShader::TileMode fTileModes[2];
- bool fBilerp;
+ FilterMode fFilterMode;
};
/** A class representing the swizzle access pattern for a texture. Note that if the texture is
@@ -119,7 +125,7 @@
*/
GrTextureAccess(GrTexture*, const GrTextureParams&);
explicit GrTextureAccess(GrTexture*,
- bool bilerp = false,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
/**
@@ -129,17 +135,17 @@
GrTextureAccess(GrTexture*, const char* swizzle, const GrTextureParams&);
GrTextureAccess(GrTexture*,
const char* swizzle,
- bool bilerp = false,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
void reset(GrTexture*, const GrTextureParams&);
void reset(GrTexture*,
- bool bilerp = false,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
void reset(GrTexture*, const char* swizzle, const GrTextureParams&);
void reset(GrTexture*,
const char* swizzle,
- bool bilerp = false,
+ GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode);
bool operator== (const GrTextureAccess& other) const {
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 76ccb51..7fff799 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -9,6 +9,7 @@
#include "SkColorPriv.h"
#include "SkFlattenableBuffers.h"
#include "SkPixelRef.h"
+#include "SkErrorInternals.h"
bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
switch (bm.config()) {
@@ -353,7 +354,27 @@
};
// Must set wrap and filter on the sampler before requesting a texture.
- GrTextureParams params(tm, paint.isFilterBitmap());
+ SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel();
+ GrTextureParams::FilterMode textureFilterMode;
+ switch(paintFilterLevel) {
+ case SkPaint::kNone_FilterLevel:
+ textureFilterMode = GrTextureParams::kNone_FilterMode;
+ break;
+ case SkPaint::kLow_FilterLevel:
+ textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ break;
+ case SkPaint::kMedium_FilterLevel:
+ textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ break;
+ case SkPaint::kHigh_FilterLevel:
+ SkErrorInternals::SetError( kInvalidPaint_SkError,
+ "Sorry, I don't yet support high quality "
+ "filtering on the GPU; falling back to "
+ "MIPMaps.");
+ textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ break;
+ }
+ GrTextureParams params(tm, textureFilterMode);
GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, ¶ms);
if (NULL == texture) {
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 260b2e2..0769237 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -132,10 +132,10 @@
matrix,
domain,
GrTextureDomainEffect::kDecal_WrapMode,
- true));
+ GrTextureParams::kBilerp_FilterMode));
paint.addColorEffect(effect);
} else {
- GrTextureParams params(SkShader::kClamp_TileMode, true);
+ GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
paint.addColorTextureEffect(srcTexture, matrix, params);
}
scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f,
@@ -199,7 +199,7 @@
GrPaint paint;
// FIXME: this should be mitchell, not bilinear.
- GrTextureParams params(SkShader::kClamp_TileMode, true);
+ GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
paint.addColorTextureEffect(srcTexture, matrix, params);
SkRect dstRect(srcRect);
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 6dcbb05..de43b69 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -914,7 +914,7 @@
// We always filter the gradient table. Each table is one row of a texture, so always y-clamp.
GrTextureParams params;
- params.setBilerp(true);
+ params.setFilterMode(GrTextureParams::kBilerp_FilterMode);
params.setTileModeX(tileMode);
fRow = fAtlas->lockRow(bitmap);
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 7465283..9831f1d 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -53,7 +53,7 @@
mat,
GrTextureDomainEffect::MakeTexelDomain(result, domainTexels),
GrTextureDomainEffect::kDecal_WrapMode,
- false,
+ GrTextureParams::kNone_FilterMode,
GrEffect::kPosition_CoordsType))->unref();
}
@@ -358,12 +358,13 @@
SkMatrix sampleM;
sampleM.setIDiv(srcMask->width(), srcMask->height());
+
drawState->addColorEffect(
GrTextureDomainEffect::Create(srcMask,
sampleM,
GrTextureDomainEffect::MakeTexelDomain(srcMask, srcBound),
GrTextureDomainEffect::kDecal_WrapMode,
- false))->unref();
+ GrTextureParams::kNone_FilterMode))->unref();
fGpu->drawSimpleRect(SkRect::MakeFromIRect(dstBound), NULL);
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3951d91..0d98ecd 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -306,7 +306,7 @@
const GrCacheID& cacheID,
void* srcData,
size_t rowBytes,
- bool needsFiltering) {
+ bool filter) {
SkAutoTUnref<GrTexture> clampedTexture(this->findAndRefTexture(desc, cacheID, NULL));
if (NULL == clampedTexture) {
clampedTexture.reset(this->createTexture(NULL, desc, cacheID, srcData, rowBytes));
@@ -333,7 +333,8 @@
// if filtering is not desired then we want to ensure all
// texels in the resampled image are copies of texels from
// the original.
- GrTextureParams params(SkShader::kClamp_TileMode, needsFiltering);
+ GrTextureParams params(SkShader::kClamp_TileMode, filter ? GrTextureParams::kBilerp_FilterMode :
+ GrTextureParams::kNone_FilterMode);
drawState->addColorTextureEffect(clampedTexture, SkMatrix::I(), params);
drawState->setVertexAttribs<gVertexAttribs>(SK_ARRAY_COUNT(gVertexAttribs));
@@ -384,7 +385,7 @@
if (GrTexture::NeedsResizing(resourceKey)) {
texture = this->createResizedTexture(desc, cacheID,
srcData, rowBytes,
- GrTexture::NeedsFiltering(resourceKey));
+ GrTexture::NeedsBilerp(resourceKey));
} else {
texture= fGpu->createTexture(desc, srcData, rowBytes);
}
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index eb5c555..f6e6c31 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -197,7 +197,7 @@
drawState->addCoverageEffect(
GrSimpleTextureEffect::Create(texture,
maskMatrix,
- false,
+ GrTextureParams::kNone_FilterMode,
GrEffect::kPosition_CoordsType))->unref();
target->drawSimpleRect(dstRect);
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index c9e6d17..5af0851 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -33,7 +33,7 @@
// setup our sampler state for our text texture/atlas
GrAssert(GrIsALIGN4(fCurrVertex));
GrAssert(fCurrTexture);
- GrTextureParams params(SkShader::kRepeat_TileMode, false);
+ GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode);
// This effect could be stored with one of the cache objects (atlas?)
drawState->addCoverageEffect(
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 6452aae..c05f35d 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -113,10 +113,10 @@
*/
kStretchToPOT_TextureFlag = 0x1,
/**
- * The kFilter bit can only be set when the kStretchToPOT flag is set and indicates whether the
- * stretched texture should be bilerp filtered or point sampled.
+ * The kBilerp bit can only be set when the kStretchToPOT flag is set and indicates whether the
+ * stretched texture should be bilerped.
*/
- kFilter_TextureFlag = 0x2,
+ kBilerp_TextureFlag = 0x2,
};
namespace {
@@ -128,8 +128,13 @@
if (tiled && !gpu->caps()->npotTextureTileSupport()) {
if (!GrIsPow2(desc.fWidth) || !GrIsPow2(desc.fHeight)) {
flags |= kStretchToPOT_TextureFlag;
- if (params->isBilerp()) {
- flags |= kFilter_TextureFlag;
+ switch(params->filterMode()) {
+ case GrTextureParams::kNone_FilterMode:
+ break;
+ case GrTextureParams::kBilerp_FilterMode:
+ case GrTextureParams::kMipMap_FilterMode:
+ flags |= kBilerp_TextureFlag;
+ break;
}
}
}
@@ -186,6 +191,6 @@
return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag);
}
-bool GrTexture::NeedsFiltering(const GrResourceKey& key) {
- return SkToBool(key.getResourceFlags() & kFilter_TextureFlag);
+bool GrTexture::NeedsBilerp(const GrResourceKey& key) {
+ return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag);
}
diff --git a/src/gpu/GrTextureAccess.cpp b/src/gpu/GrTextureAccess.cpp
index 499b1f2..ae6c042 100644
--- a/src/gpu/GrTextureAccess.cpp
+++ b/src/gpu/GrTextureAccess.cpp
@@ -21,9 +21,9 @@
}
GrTextureAccess::GrTextureAccess(GrTexture* texture,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
- this->reset(texture, bilerp, tileXAndY);
+ this->reset(texture, filterMode, tileXAndY);
}
GrTextureAccess::GrTextureAccess(GrTexture* texture,
@@ -34,9 +34,9 @@
GrTextureAccess::GrTextureAccess(GrTexture* texture,
const char* swizzle,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
- this->reset(texture, swizzle, bilerp, tileXAndY);
+ this->reset(texture, swizzle, filterMode, tileXAndY);
}
void GrTextureAccess::reset(GrTexture* texture,
@@ -52,12 +52,12 @@
void GrTextureAccess::reset(GrTexture* texture,
const char* swizzle,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
GrAssert(NULL != texture);
GrAssert(strlen(swizzle) >= 1 && strlen(swizzle) <= 4);
- fParams.reset(tileXAndY, bilerp);
+ fParams.reset(tileXAndY, filterMode);
fTexture.reset(SkRef(texture));
this->setSwizzle(swizzle);
}
@@ -72,11 +72,11 @@
}
void GrTextureAccess::reset(GrTexture* texture,
- bool bilerp,
+ GrTextureParams::FilterMode filterMode,
SkShader::TileMode tileXAndY) {
GrAssert(NULL != texture);
fTexture.reset(SkRef(texture));
- fParams.reset(tileXAndY, bilerp);
+ fParams.reset(tileXAndY, filterMode);
memcpy(fSwizzle, "rgba", 5);
fSwizzleMask = kRGBA_GrColorComponentFlags;
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 000efee..e79801c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -24,6 +24,7 @@
#include "SkRRect.h"
#include "SkStroke.h"
#include "SkUtils.h"
+#include "SkErrorInternals.h"
#define CACHE_COMPATIBLE_DEVICE_TEXTURES 1
@@ -1134,7 +1135,28 @@
}
GrTextureParams params;
- params.setBilerp(paint.isFilterBitmap());
+ SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel();
+ GrTextureParams::FilterMode textureFilterMode;
+ switch(paintFilterLevel) {
+ case SkPaint::kNone_FilterLevel:
+ textureFilterMode = GrTextureParams::kNone_FilterMode;
+ break;
+ case SkPaint::kLow_FilterLevel:
+ textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ break;
+ case SkPaint::kMedium_FilterLevel:
+ textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ break;
+ case SkPaint::kHigh_FilterLevel:
+ SkErrorInternals::SetError( kInvalidPaint_SkError,
+ "Sorry, I don't yet support high quality "
+ "filtering on the GPU. Falling back to "
+ "MIPMaps.");
+ textureFilterMode = GrTextureParams::kMipMap_FilterMode;
+ break;
+ }
+
+ params.setFilterMode(textureFilterMode);
if (!this->shouldTileBitmap(bitmap, params, srcRectPtr)) {
// take the simple case
@@ -1278,7 +1300,7 @@
SkScalarMul(srcRect.fBottom, hInv));
bool needsTextureDomain = false;
- if (params.isBilerp()) {
+ if (params.filterMode() != GrTextureParams::kNone_FilterMode) {
// Need texture domain if drawing a sub rect.
needsTextureDomain = srcRect.width() < bitmap.width() ||
srcRect.height() < bitmap.height();
@@ -1323,7 +1345,7 @@
SkMatrix::I(),
textureDomain,
GrTextureDomainEffect::kClamp_WrapMode,
- params.isBilerp()));
+ params.filterMode()));
} else {
effect.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), params));
}
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;
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index cf6cf41..4102c8c 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2006,7 +2006,7 @@
bool setAll = timestamp < this->getResetTimestamp();
GrGLTexture::TexParams newTexParams;
- newTexParams.fFilter = params.isBilerp() ? GR_GL_LINEAR : GR_GL_NEAREST;
+ newTexParams.fFilter = (params.filterMode() == GrTextureParams::kNone_FilterMode) ? GR_GL_LINEAR : GR_GL_NEAREST;
newTexParams.fWrapS = tile_to_gl_wrap(params.getTileModeX());
newTexParams.fWrapT = tile_to_gl_wrap(params.getTileModeY());