aboutsummaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-10-08 16:32:58 -0700
committerDoug Zongker <dougz@android.com>2009-10-08 16:32:58 -0700
commitd93a25459cdefba940f254b4c5f54fd7d9cdaf11 (patch)
tree70d5c1658606d754a81140d917bb8bb35a6e1450 /minui
parent54ec81fe86225d5f3ee3ab16e3266ae88cd639fa (diff)
downloadbootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.zip
bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.gz
bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.bz2
simplify construction of the recovery progress bar
Instead of six separate images for the left end, right end, and tiled center portion of the full and empty progress bars, just use two images: a full bar and an empty bar. Draw the left side of the full bar and the right side of the empty one, moving the boundary rightward to "fill" the bar. This makes recovery trivially smaller, and allows fancier images to be used as progress bars. Support paletted PNG images as resources.
Diffstat (limited to 'minui')
-rw-r--r--minui/resources.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/minui/resources.c b/minui/resources.c
index 7ecfeef..3d2c727 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) {