diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrContext.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTexture.h | 2 | ||||
-rw-r--r-- | include/gpu/GrTextureAccess.h | 46 |
3 files changed, 28 insertions, 22 deletions
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index 90382fd97b..e955cac504 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -901,7 +901,7 @@ private: 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 422814bdcc..a87081820f 100644 --- a/include/gpu/GrTexture.h +++ b/include/gpu/GrTexture.h @@ -127,7 +127,7 @@ public: 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 e5ea535d99..20dc57de07 100644 --- a/include/gpu/GrTextureAccess.h +++ b/include/gpu/GrTextureAccess.h @@ -25,13 +25,19 @@ public: GrTextureParams() { this->reset(); } - - GrTextureParams(SkShader::TileMode tileXAndY, bool bilerp) { - this->reset(tileXAndY, bilerp); + + enum FilterMode { + kNone_FilterMode, + kBilerp_FilterMode, + kMipMap_FilterMode + }; + + 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 @@ public: 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 @@ public: 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 @@ public: 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 @@ public: */ 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 @@ public: 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 { |