summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2009-10-09 01:32:58 +0200
committerDoug Zongker <dougz@android.com>2009-10-09 01:32:58 +0200
commitd93a25459cdefba940f254b4c5f54fd7d9cdaf11 (patch)
tree70d5c1658606d754a81140d917bb8bb35a6e1450
parentMerge change I1c8ca2e4 into eclair (diff)
downloadandroid_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.gz
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.bz2
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.lz
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.xz
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.tar.zst
android_bootable_recovery-d93a25459cdefba940f254b4c5f54fd7d9cdaf11.zip
-rw-r--r--minui/resources.c11
-rw-r--r--res/images/indeterminate1.pngbin2249 -> 1919 bytes
-rw-r--r--res/images/indeterminate2.pngbin2251 -> 1912 bytes
-rw-r--r--res/images/indeterminate3.pngbin2254 -> 1917 bytes
-rw-r--r--res/images/indeterminate4.pngbin2249 -> 1912 bytes
-rw-r--r--res/images/indeterminate5.pngbin2246 -> 1902 bytes
-rw-r--r--res/images/indeterminate6.pngbin2262 -> 1914 bytes
-rw-r--r--res/images/progress_bar_empty.pngbin148 -> 0 bytes
-rw-r--r--res/images/progress_bar_empty_left_round.pngbin220 -> 0 bytes
-rw-r--r--res/images/progress_bar_empty_right_round.pngbin211 -> 0 bytes
-rw-r--r--res/images/progress_bar_fill.pngbin117 -> 0 bytes
-rw-r--r--res/images/progress_bar_left_round.pngbin195 -> 0 bytes
-rw-r--r--res/images/progress_bar_right_round.pngbin192 -> 0 bytes
-rw-r--r--res/images/progress_empty.pngbin0 -> 361 bytes
-rw-r--r--res/images/progress_fill.pngbin0 -> 286 bytes
-rw-r--r--ui.c34
16 files changed, 19 insertions, 26 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) {
diff --git a/res/images/indeterminate1.png b/res/images/indeterminate1.png
index 264bf27e5..90cb9fba9 100644
--- a/res/images/indeterminate1.png
+++ b/res/images/indeterminate1.png
Binary files differ
diff --git a/res/images/indeterminate2.png b/res/images/indeterminate2.png
index c30c049ab..f7fb28989 100644
--- a/res/images/indeterminate2.png
+++ b/res/images/indeterminate2.png
Binary files differ
diff --git a/res/images/indeterminate3.png b/res/images/indeterminate3.png
index 891a00095..ba10dfa53 100644
--- a/res/images/indeterminate3.png
+++ b/res/images/indeterminate3.png
Binary files differ
diff --git a/res/images/indeterminate4.png b/res/images/indeterminate4.png
index 7a6415149..ad5d9a542 100644
--- a/res/images/indeterminate4.png
+++ b/res/images/indeterminate4.png
Binary files differ
diff --git a/res/images/indeterminate5.png b/res/images/indeterminate5.png
index cd6ab20a7..8c19c8d57 100644
--- a/res/images/indeterminate5.png
+++ b/res/images/indeterminate5.png
Binary files differ
diff --git a/res/images/indeterminate6.png b/res/images/indeterminate6.png
index ddd9e7384..c0c66386a 100644
--- a/res/images/indeterminate6.png
+++ b/res/images/indeterminate6.png
Binary files differ
diff --git a/res/images/progress_bar_empty.png b/res/images/progress_bar_empty.png
deleted file mode 100644
index 9013f04ac..000000000
--- a/res/images/progress_bar_empty.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_bar_empty_left_round.png b/res/images/progress_bar_empty_left_round.png
deleted file mode 100644
index dae7d5d13..000000000
--- a/res/images/progress_bar_empty_left_round.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_bar_empty_right_round.png b/res/images/progress_bar_empty_right_round.png
deleted file mode 100644
index 542708823..000000000
--- a/res/images/progress_bar_empty_right_round.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_bar_fill.png b/res/images/progress_bar_fill.png
deleted file mode 100644
index 37c04b4f4..000000000
--- a/res/images/progress_bar_fill.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_bar_left_round.png b/res/images/progress_bar_left_round.png
deleted file mode 100644
index e72af47d4..000000000
--- a/res/images/progress_bar_left_round.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_bar_right_round.png b/res/images/progress_bar_right_round.png
deleted file mode 100644
index d04c980b9..000000000
--- a/res/images/progress_bar_right_round.png
+++ /dev/null
Binary files differ
diff --git a/res/images/progress_empty.png b/res/images/progress_empty.png
new file mode 100644
index 000000000..4cb4998dd
--- /dev/null
+++ b/res/images/progress_empty.png
Binary files differ
diff --git a/res/images/progress_fill.png b/res/images/progress_fill.png
new file mode 100644
index 000000000..eb71754db
--- /dev/null
+++ b/res/images/progress_fill.png
Binary files differ
diff --git a/ui.c b/ui.c
index 51df1fa9f..fdc09911b 100644
--- a/ui.c
+++ b/ui.c
@@ -38,13 +38,11 @@
#define PROGRESSBAR_INDETERMINATE_STATES 6
#define PROGRESSBAR_INDETERMINATE_FPS 15
-enum { LEFT_SIDE, CENTER_TILE, RIGHT_SIDE, NUM_SIDES };
-
static pthread_mutex_t gUpdateMutex = PTHREAD_MUTEX_INITIALIZER;
static gr_surface gBackgroundIcon[NUM_BACKGROUND_ICONS];
static gr_surface gProgressBarIndeterminate[PROGRESSBAR_INDETERMINATE_STATES];
-static gr_surface gProgressBarEmpty[NUM_SIDES];
-static gr_surface gProgressBarFill[NUM_SIDES];
+static gr_surface gProgressBarEmpty;
+static gr_surface gProgressBarFill;
static const struct { gr_surface* surface; const char *name; } BITMAPS[] = {
{ &gBackgroundIcon[BACKGROUND_ICON_INSTALLING], "icon_installing" },
@@ -59,12 +57,8 @@ static const struct { gr_surface* surface; const char *name; } BITMAPS[] = {
{ &gProgressBarIndeterminate[3], "indeterminate4" },
{ &gProgressBarIndeterminate[4], "indeterminate5" },
{ &gProgressBarIndeterminate[5], "indeterminate6" },
- { &gProgressBarEmpty[LEFT_SIDE], "progress_bar_empty_left_round" },
- { &gProgressBarEmpty[CENTER_TILE], "progress_bar_empty" },
- { &gProgressBarEmpty[RIGHT_SIDE], "progress_bar_empty_right_round" },
- { &gProgressBarFill[LEFT_SIDE], "progress_bar_left_round" },
- { &gProgressBarFill[CENTER_TILE], "progress_bar_fill" },
- { &gProgressBarFill[RIGHT_SIDE], "progress_bar_right_round" },
+ { &gProgressBarEmpty, "progress_empty" },
+ { &gProgressBarFill, "progress_fill" },
{ NULL, NULL },
};
@@ -123,8 +117,8 @@ static void draw_progress_locked()
if (gProgressBarType == PROGRESSBAR_TYPE_NONE) return;
int iconHeight = gr_get_height(gBackgroundIcon[BACKGROUND_ICON_INSTALLING]);
- int width = gr_get_width(gProgressBarIndeterminate[0]);
- int height = gr_get_height(gProgressBarIndeterminate[0]);
+ int width = gr_get_width(gProgressBarEmpty);
+ int height = gr_get_height(gProgressBarEmpty);
int dx = (gr_fb_width() - width)/2;
int dy = (3*gr_fb_height() + iconHeight - 2*height)/4;
@@ -137,18 +131,12 @@ static void draw_progress_locked()
float progress = gProgressScopeStart + gProgress * gProgressScopeSize;
int pos = (int) (progress * width);
- gr_surface s = (pos ? gProgressBarFill : gProgressBarEmpty)[LEFT_SIDE];
- gr_blit(s, 0, 0, gr_get_width(s), gr_get_height(s), dx, dy);
-
- int x = gr_get_width(s);
- while (x + (int) gr_get_width(gProgressBarEmpty[RIGHT_SIDE]) < width) {
- s = (pos > x ? gProgressBarFill : gProgressBarEmpty)[CENTER_TILE];
- gr_blit(s, 0, 0, gr_get_width(s), gr_get_height(s), dx + x, dy);
- x += gr_get_width(s);
+ if (pos > 0) {
+ gr_blit(gProgressBarFill, 0, 0, pos, height, dx, dy);
+ }
+ if (pos < width-1) {
+ gr_blit(gProgressBarEmpty, pos, 0, width-pos, height, dx+pos, dy);
}
-
- s = (pos > x ? gProgressBarFill : gProgressBarEmpty)[RIGHT_SIDE];
- gr_blit(s, 0, 0, gr_get_width(s), gr_get_height(s), dx + x, dy);
}
if (gProgressBarType == PROGRESSBAR_TYPE_INDETERMINATE) {