From 58207b84d31c6c281aebf9384024203eadea5316 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 25 Sep 2013 16:41:07 -0700 Subject: fix use of RGBA images in minui Bug: 10934401 Change-Id: I471b30e5b2e877c620e4a0a524e950cddbc6d2c0 --- minui/resources.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'minui') 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); } -- cgit v1.2.3