Skip to content

Commit 1662734

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Enable mipmapping, without a deadlock this time Bug #7353771" into jb-mr1-dev
2 parents 26f544a + 5243957 commit 1662734

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

libs/hwui/TextureCache.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ void TextureCache::init() {
7474
INIT_LOGD(" Maximum texture dimension is %d pixels", mMaxTextureSize);
7575

7676
mDebugEnabled = readDebugLevel() & kDebugCaches;
77-
78-
mHasNPot = false; //Caches::getInstance().extensions.hasNPot();
7977
}
8078

8179
///////////////////////////////////////////////////////////////////////////////
@@ -219,11 +217,15 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege
219217
return;
220218
}
221219

220+
// We could also enable mipmapping if both bitmap dimensions are powers
221+
// of 2 but we'd have to deal with size changes. Let's keep this simple
222+
const bool canMipMap = Caches::getInstance().extensions.hasNPot();
223+
222224
// If the texture had mipmap enabled but not anymore,
223225
// force a glTexImage2D to discard the mipmap levels
224226
const bool resize = !regenerate || bitmap->width() != int(texture->width) ||
225227
bitmap->height() != int(texture->height) ||
226-
(regenerate && mHasNPot && texture->mipMap && !bitmap->hasHardwareMipMap());
228+
(regenerate && canMipMap && texture->mipMap && !bitmap->hasHardwareMipMap());
227229

228230
if (!regenerate) {
229231
glGenTextures(1, &texture->id);
@@ -267,7 +269,7 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege
267269
break;
268270
}
269271

270-
if (mHasNPot) {
272+
if (canMipMap) {
271273
texture->mipMap = bitmap->hasHardwareMipMap();
272274
if (texture->mipMap) {
273275
glGenerateMipmap(GL_TEXTURE_2D);

libs/hwui/TextureCache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ class TextureCache: public OnEntryRemoved<SkBitmap*, Texture*> {
138138

139139
float mFlushRate;
140140

141-
bool mHasNPot;
142141
bool mDebugEnabled;
143142

144143
Vector<SkBitmap*> mGarbage;

0 commit comments

Comments
 (0)