diff options
author | Romain Guy <romainguy@google.com> | 2012-10-17 12:14:11 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-10-17 12:14:11 -0700 |
commit | 52439570800891345981c0968b513843edc2b27a (patch) | |
tree | 4860208c622ae4ed724baa91d306708daae66e8c /libs | |
parent | 0ee71adde01298784a2cbb667c4c1570bdbf0af0 (diff) | |
download | frameworks_base-52439570800891345981c0968b513843edc2b27a.zip frameworks_base-52439570800891345981c0968b513843edc2b27a.tar.gz frameworks_base-52439570800891345981c0968b513843edc2b27a.tar.bz2 |
Enable mipmapping, without a deadlock this time
Bug #7353771
Change-Id: I89a08a58608e374f1c604a26ee0769d5850b2f7b
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/TextureCache.cpp | 10 | ||||
-rw-r--r-- | libs/hwui/TextureCache.h | 1 |
2 files changed, 6 insertions, 5 deletions
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 7fb86ee..10d112a 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -74,8 +74,6 @@ void TextureCache::init() { INIT_LOGD(" Maximum texture dimension is %d pixels", mMaxTextureSize); mDebugEnabled = readDebugLevel() & kDebugCaches; - - mHasNPot = false; //Caches::getInstance().extensions.hasNPot(); } /////////////////////////////////////////////////////////////////////////////// @@ -219,11 +217,15 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege return; } + // We could also enable mipmapping if both bitmap dimensions are powers + // of 2 but we'd have to deal with size changes. Let's keep this simple + const bool canMipMap = Caches::getInstance().extensions.hasNPot(); + // If the texture had mipmap enabled but not anymore, // force a glTexImage2D to discard the mipmap levels const bool resize = !regenerate || bitmap->width() != int(texture->width) || bitmap->height() != int(texture->height) || - (regenerate && mHasNPot && texture->mipMap && !bitmap->hasHardwareMipMap()); + (regenerate && canMipMap && texture->mipMap && !bitmap->hasHardwareMipMap()); if (!regenerate) { glGenTextures(1, &texture->id); @@ -267,7 +269,7 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege break; } - if (mHasNPot) { + if (canMipMap) { texture->mipMap = bitmap->hasHardwareMipMap(); if (texture->mipMap) { glGenerateMipmap(GL_TEXTURE_2D); diff --git a/libs/hwui/TextureCache.h b/libs/hwui/TextureCache.h index 8e19092..31a2e3d 100644 --- a/libs/hwui/TextureCache.h +++ b/libs/hwui/TextureCache.h @@ -138,7 +138,6 @@ private: float mFlushRate; - bool mHasNPot; bool mDebugEnabled; Vector<SkBitmap*> mGarbage; |