diff options
author | Romain Guy <romainguy@google.com> | 2012-10-16 13:49:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-16 13:50:54 -0700 |
commit | 5778cb9a98aacd74c7f915b2d02eccc7189d5946 (patch) | |
tree | 42204b359e9383be3d2c0a0a3d099192a940b6dc /libs | |
parent | 827dde0e1a0452e7aba116aa981a1229dce7038b (diff) | |
parent | d43b22da291fd08017fac627561091a633c85807 (diff) | |
download | frameworks_base-5778cb9a98aacd74c7f915b2d02eccc7189d5946.zip frameworks_base-5778cb9a98aacd74c7f915b2d02eccc7189d5946.tar.gz frameworks_base-5778cb9a98aacd74c7f915b2d02eccc7189d5946.tar.bz2 |
Merge "Always use the correct pixel store size Bug #7357394" into jb-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/TextureCache.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp index 9fb61e4..4d16bb4 100644 --- a/libs/hwui/TextureCache.cpp +++ b/libs/hwui/TextureCache.cpp @@ -228,25 +228,22 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege texture->height = bitmap->height(); glBindTexture(GL_TEXTURE_2D, texture->id); - if (!regenerate) { - glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); - } switch (bitmap->getConfig()) { case SkBitmap::kA8_Config: - if (!regenerate) { - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - } + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadToTexture(resize, GL_ALPHA, bitmap->rowBytesAsPixels(), texture->height, GL_UNSIGNED_BYTE, bitmap->getPixels()); texture->blend = true; break; case SkBitmap::kRGB_565_Config: + glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); uploadToTexture(resize, GL_RGB, bitmap->rowBytesAsPixels(), texture->height, GL_UNSIGNED_SHORT_5_6_5, bitmap->getPixels()); texture->blend = false; break; case SkBitmap::kARGB_8888_Config: + glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); uploadToTexture(resize, GL_RGBA, bitmap->rowBytesAsPixels(), texture->height, GL_UNSIGNED_BYTE, bitmap->getPixels()); // Do this after calling getPixels() to make sure Skia's deferred @@ -255,6 +252,7 @@ void TextureCache::generateTexture(SkBitmap* bitmap, Texture* texture, bool rege break; case SkBitmap::kARGB_4444_Config: case SkBitmap::kIndex8_Config: + glPixelStorei(GL_UNPACK_ALIGNMENT, bitmap->bytesPerPixel()); uploadLoFiTexture(resize, bitmap, texture->width, texture->height); texture->blend = !bitmap->isOpaque(); break; |