Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Unified Diff: src/gpu/GrTexture.cpp

Issue 20362002: make the filter mode for GrTextureAccess an enum so we can plumb down (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTexture.cpp
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 6452aae9b1eee2dff070ce858c5457926ecca4bb..ffe4244eb44e1047292f5110640092e18c34cb24 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -113,10 +113,15 @@ enum TextureFlags {
*/
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,
+ /**
+ * The kMipMap bit can only be set when the kStretchToPOT flag is set and indicates whether the
+ * stretched texture should have mipmaps computed.
+ */
+ kMipMap_TextureFlag = 0x4,
};
namespace {
@@ -128,8 +133,15 @@ GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu,
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:
+ flags |= kBilerp_TextureFlag;
+ break;
+ case GrTextureParams::kMipMap_FilterMode:
+ flags |= kMipMap_TextureFlag;
+ break;
}
}
}
@@ -186,6 +198,10 @@ bool GrTexture::NeedsResizing(const GrResourceKey& key) {
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);
+}
+
+bool GrTexture::NeedsMipMap(const GrResourceKey& key) {
+ return SkToBool(key.getResourceFlags() & kMipMap_TextureFlag);
}

Powered by Google App Engine
This is Rietveld 408576698