aboutsummaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-09-25 16:41:07 -0700
committerDoug Zongker <dougz@android.com>2013-09-25 16:41:07 -0700
commit58207b84d31c6c281aebf9384024203eadea5316 (patch)
treee2b8a085ea75053bbf2616369a082ba2451aa22f /minui
parentbb83e14c49964cb0c6e6d598fda10a0ca66d1006 (diff)
downloadbootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.gz
bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.bz2
bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.zip
fix use of RGBA images in minui
Bug: 10934401 Change-Id: I471b30e5b2e877c620e4a0a524e950cddbc6d2c0
Diffstat (limited to 'minui')
-rw-r--r--minui/resources.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/minui/resources.c b/minui/resources.c
index c0a9cca..b20c00a 100644
--- a/minui/resources.c
+++ b/minui/resources.c
@@ -123,10 +123,18 @@ int res_create_surface(const char* name, gr_surface* pSurface) {
surface->height = height;
surface->stride = width; /* Yes, pixels, not bytes */
surface->data = pData;
- surface->format = (channels == 3) ? GGL_PIXEL_FORMAT_RGBX_8888 :
- ((color_type == PNG_COLOR_TYPE_PALETTE ? GGL_PIXEL_FORMAT_RGBA_8888 : GGL_PIXEL_FORMAT_L_8));
- int alpha = 0;
+ if (channels == 3) {
+ surface->format = GGL_PIXEL_FORMAT_RGBX_8888;
+ } else if (color_type == PNG_COLOR_TYPE_PALETTE) {
+ surface->format = GGL_PIXEL_FORMAT_RGBA_8888;
+ } else if (channels == 1) {
+ surface->format = GGL_PIXEL_FORMAT_L_8;
+ } else {
+ surface->format = GGL_PIXEL_FORMAT_RGBA_8888;
+ }
+
+ int alpha = (channels == 4);
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_palette_to_rgb(png_ptr);
}