diff options
author | Doug Zongker <dougz@android.com> | 2009-10-13 20:59:45 +0200 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-10-13 20:59:45 +0200 |
commit | 31f0fc22357707b7c71f2ca08878b6ce6ddde1cb (patch) | |
tree | 85fbf84faee0d164617d2eab10e2f9c805271cf0 /minui | |
parent | am 54ec81fe: Merge change I1c8ca2e4 into eclair (diff) | |
parent | simplify construction of the recovery progress bar (diff) | |
download | android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar.gz android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar.bz2 android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar.lz android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar.xz android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.tar.zst android_bootable_recovery-31f0fc22357707b7c71f2ca08878b6ce6ddde1cb.zip |
Diffstat (limited to 'minui')
-rw-r--r-- | minui/resources.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/minui/resources.c b/minui/resources.c index 7ecfeefce..3d2c727fb 100644 --- a/minui/resources.c +++ b/minui/resources.c @@ -97,9 +97,10 @@ int res_create_surface(const char* name, gr_surface* pSurface) { int color_type = info_ptr->color_type; int bit_depth = info_ptr->bit_depth; int channels = info_ptr->channels; - if (bit_depth != 8 || (channels != 3 && channels != 4) || - (color_type != PNG_COLOR_TYPE_RGB && - color_type != PNG_COLOR_TYPE_RGBA)) { + if (!(bit_depth == 8 && + ((channels == 3 && color_type == PNG_COLOR_TYPE_RGB) || + (channels == 4 && color_type == PNG_COLOR_TYPE_RGBA) || + (channels == 1 && color_type == PNG_COLOR_TYPE_PALETTE)))) { return -7; goto exit; } @@ -118,6 +119,10 @@ int res_create_surface(const char* name, gr_surface* pSurface) { surface->format = (channels == 3) ? GGL_PIXEL_FORMAT_RGBX_8888 : GGL_PIXEL_FORMAT_RGBA_8888; + if (color_type == PNG_COLOR_TYPE_PALETTE) { + png_set_palette_to_rgb(png_ptr); + } + int y; if (channels == 3) { for (y = 0; y < height; ++y) { |