diff options
author | 2011-11-30 20:21:23 -0800 | |
---|---|---|
committer | 2011-11-30 20:21:23 -0800 | |
commit | d21b6e1fe337b35f62cf2028e9bd0637fd009a75 (patch) | |
tree | 8831d34e2dd0335c158c2aa12bee68452745c8c5 /libs/hwui/TextureCache.cpp | |
parent | 28147b654bba8ae2b7976e58aa7869255e436b0b (diff) |
Optimize away unnecessary state changes
Change-Id: I0f6816f9f6234853575ecee5033186ad19e76380
Diffstat (limited to 'libs/hwui/TextureCache.cpp')
-rw-r--r-- | libs/hwui/TextureCache.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 018ce3e77e8b..711277a56d8a 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -217,11 +217,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 +252,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, |