diff options
Diffstat (limited to 'libs/hwui/TextureCache.cpp')
-rw-r--r-- | libs/hwui/TextureCache.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 7a88f2a..cc09aae 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -125,7 +125,8 @@ Texture* TextureCache::get(SkBitmap* bitmap) { if (!texture) { if (bitmap->width() > mMaxTextureSize || bitmap->height() > mMaxTextureSize) { - ALOGW("Bitmap too large to be uploaded into a texture"); + ALOGW("Bitmap too large to be uploaded into a texture (%dx%d, max=%dx%d)", + bitmap->width(), bitmap->height(), mMaxTextureSize, mMaxTextureSize); return NULL; } @@ -217,11 +218,15 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege texture->height = bitmap->height(); glBindTexture(GL_TEXTURE_2D, texture->id); - glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); + if (!regenerate) { + glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); + } switch (bitmap->getConfig()) { case SkBitmap::kA8_Config: - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (!regenerate) { + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + } uploadToTexture(resize, GL_ALPHA, bitmap->rowBytesAsPixels(), texture->height, GL_UNSIGNED_BYTE, bitmap->getPixels()); texture->blend = true; @@ -248,8 +253,10 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege break; } - texture->setFilter(GL_LINEAR, GL_LINEAR); - texture->setWrap(GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE); + if (!regenerate) { + texture->setFilter(GL_NEAREST); + texture->setWrap(GL_CLAMP_TO_EDGE); + } } void TextureCache::uploadLoFiTexture(bool resize, SkBitmap* bitmap, |