summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-09-26 01:41:07 +0200
committerDoug Zongker <dougz@android.com>2013-09-26 01:41:07 +0200
commit58207b84d31c6c281aebf9384024203eadea5316 (patch)
treee2b8a085ea75053bbf2616369a082ba2451aa22f
parentam dd92a4d6: am 58c60900: Merge "verifier: update to support certificates using SHA-256" (diff)
downloadandroid_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.gz
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.bz2
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.lz
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.xz
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.tar.zst
android_bootable_recovery-58207b84d31c6c281aebf9384024203eadea5316.zip
-rw-r--r--minui/resources.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/minui/resources.c b/minui/resources.c
index c0a9ccacb..b20c00abd 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);
}