resolved conflicts for merge of ea868b38 to klp-modular-dev-plus-aosp
Change-Id: I8cc3b8101bccf7fd697f9a7b73732d1000dc27a1
@@ -72,6 +72,7 @@ void ev_dispatch(void);
|
|||||||
|
|
||||||
// Returns 0 if no error, else negative.
|
// Returns 0 if no error, else negative.
|
||||||
int res_create_surface(const char* name, gr_surface* pSurface);
|
int res_create_surface(const char* name, gr_surface* pSurface);
|
||||||
|
int res_create_multi_surface(const char* name, int* frames, gr_surface** pSurface);
|
||||||
int res_create_localized_surface(const char* name, gr_surface* pSurface);
|
int res_create_localized_surface(const char* name, gr_surface* pSurface);
|
||||||
void res_free_surface(gr_surface surface);
|
void res_free_surface(gr_surface surface);
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,182 @@ exit:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res_create_multi_surface(const char* name, int* frames, gr_surface** pSurface) {
|
||||||
|
char resPath[256];
|
||||||
|
int result = 0;
|
||||||
|
unsigned char header[8];
|
||||||
|
png_structp png_ptr = NULL;
|
||||||
|
png_infop info_ptr = NULL;
|
||||||
|
int i;
|
||||||
|
GGLSurface** surface = NULL;
|
||||||
|
|
||||||
|
*pSurface = NULL;
|
||||||
|
*frames = -1;
|
||||||
|
|
||||||
|
snprintf(resPath, sizeof(resPath)-1, "/res/images/%s.png", name);
|
||||||
|
resPath[sizeof(resPath)-1] = '\0';
|
||||||
|
FILE* fp = fopen(resPath, "rb");
|
||||||
|
if (fp == NULL) {
|
||||||
|
result = -1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t bytesRead = fread(header, 1, sizeof(header), fp);
|
||||||
|
if (bytesRead != sizeof(header)) {
|
||||||
|
result = -2;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (png_sig_cmp(header, 0, sizeof(header))) {
|
||||||
|
result = -3;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
if (!png_ptr) {
|
||||||
|
result = -4;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
info_ptr = png_create_info_struct(png_ptr);
|
||||||
|
if (!info_ptr) {
|
||||||
|
result = -5;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setjmp(png_jmpbuf(png_ptr))) {
|
||||||
|
result = -6;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
png_init_io(png_ptr, fp);
|
||||||
|
png_set_sig_bytes(png_ptr, sizeof(header));
|
||||||
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
int color_type, bit_depth;
|
||||||
|
png_uint_32 width, height;
|
||||||
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||||
|
&color_type, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
int channels = png_get_channels(png_ptr, info_ptr);
|
||||||
|
|
||||||
|
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 ||
|
||||||
|
color_type == PNG_COLOR_TYPE_GRAY))))) {
|
||||||
|
return -7;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
*frames = 1;
|
||||||
|
png_textp text;
|
||||||
|
int num_text;
|
||||||
|
if (png_get_text(png_ptr, info_ptr, &text, &num_text)) {
|
||||||
|
for (i = 0; i < num_text; ++i) {
|
||||||
|
if (text[i].key && strcmp(text[i].key, "Frames") == 0 && text[i].text) {
|
||||||
|
*frames = atoi(text[i].text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf(" found frames = %d\n", *frames);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (height % *frames != 0) {
|
||||||
|
printf("bad height (%d) for frame count (%d)\n", height, *frames);
|
||||||
|
result = -9;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t stride = (color_type == PNG_COLOR_TYPE_GRAY ? 1 : 4) * width;
|
||||||
|
size_t pixelSize = stride * height / *frames;
|
||||||
|
|
||||||
|
surface = malloc(*frames * sizeof(GGLSurface*));
|
||||||
|
if (surface == NULL) {
|
||||||
|
result = -8;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
for (i = 0; i < *frames; ++i) {
|
||||||
|
surface[i] = malloc(sizeof(GGLSurface) + pixelSize);
|
||||||
|
surface[i]->version = sizeof(GGLSurface);
|
||||||
|
surface[i]->width = width;
|
||||||
|
surface[i]->height = height / *frames;
|
||||||
|
surface[i]->stride = width; /* Yes, pixels, not bytes */
|
||||||
|
surface[i]->data = (unsigned char*) (surface[i] + 1);
|
||||||
|
|
||||||
|
if (channels == 3) {
|
||||||
|
surface[i]->format = GGL_PIXEL_FORMAT_RGBX_8888;
|
||||||
|
} else if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||||
|
surface[i]->format = GGL_PIXEL_FORMAT_RGBA_8888;
|
||||||
|
} else if (channels == 1) {
|
||||||
|
surface[i]->format = GGL_PIXEL_FORMAT_L_8;
|
||||||
|
} else {
|
||||||
|
surface[i]->format = GGL_PIXEL_FORMAT_RGBA_8888;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int alpha = (channels == 4);
|
||||||
|
if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||||
|
png_set_palette_to_rgb(png_ptr);
|
||||||
|
}
|
||||||
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
|
||||||
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
alpha = 1;
|
||||||
|
}
|
||||||
|
if (color_type == PNG_COLOR_TYPE_GRAY) {
|
||||||
|
alpha = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
png_uint_32 y;
|
||||||
|
if (channels == 3 || (channels == 1 && !alpha)) {
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
int fy = y / *frames;
|
||||||
|
int fr = y % *frames;
|
||||||
|
unsigned char* pRow = surface[fr]->data + fy * stride;
|
||||||
|
png_read_row(png_ptr, pRow, NULL);
|
||||||
|
|
||||||
|
int x;
|
||||||
|
for(x = width - 1; x >= 0; x--) {
|
||||||
|
int sx = x * 3;
|
||||||
|
int dx = x * 4;
|
||||||
|
unsigned char r = pRow[sx];
|
||||||
|
unsigned char g = pRow[sx + 1];
|
||||||
|
unsigned char b = pRow[sx + 2];
|
||||||
|
unsigned char a = 0xff;
|
||||||
|
pRow[dx ] = r; // r
|
||||||
|
pRow[dx + 1] = g; // g
|
||||||
|
pRow[dx + 2] = b; // b
|
||||||
|
pRow[dx + 3] = a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (y = 0; y < height; ++y) {
|
||||||
|
int fy = y / *frames;
|
||||||
|
int fr = y % *frames;
|
||||||
|
unsigned char* pRow = surface[fr]->data + fy * stride;
|
||||||
|
png_read_row(png_ptr, pRow, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*pSurface = (gr_surface*) surface;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
|
if (fp != NULL) {
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
if (result < 0) {
|
||||||
|
if (surface) {
|
||||||
|
for (i = 0; i < *frames; ++i) {
|
||||||
|
if (surface[i]) free(surface[i]);
|
||||||
|
}
|
||||||
|
free(surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static int matches_locale(const char* loc) {
|
static int matches_locale(const char* loc) {
|
||||||
if (locale == NULL) return 0;
|
if (locale == NULL) return 0;
|
||||||
|
|
||||||
@@ -249,7 +425,7 @@ int res_create_localized_surface(const char* name, gr_surface* pSurface) {
|
|||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
int color_type, bit_depth;
|
int color_type, bit_depth;
|
||||||
size_t width, height;
|
png_uint_32 width, height;
|
||||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth,
|
||||||
&color_type, NULL, NULL, NULL);
|
&color_type, NULL, NULL, NULL);
|
||||||
int channels = png_get_channels(png_ptr, info_ptr);
|
int channels = png_get_channels(png_ptr, info_ptr);
|
||||||
@@ -261,13 +437,13 @@ int res_create_localized_surface(const char* name, gr_surface* pSurface) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* row = malloc(width);
|
unsigned char* row = malloc(width);
|
||||||
int y;
|
png_uint_32 y;
|
||||||
for (y = 0; y < height; ++y) {
|
for (y = 0; y < height; ++y) {
|
||||||
png_read_row(png_ptr, row, NULL);
|
png_read_row(png_ptr, row, NULL);
|
||||||
int w = (row[1] << 8) | row[0];
|
int w = (row[1] << 8) | row[0];
|
||||||
int h = (row[3] << 8) | row[2];
|
int h = (row[3] << 8) | row[2];
|
||||||
int len = row[4];
|
int len = row[4];
|
||||||
char* loc = row+5;
|
char* loc = (char*)row+5;
|
||||||
|
|
||||||
if (y+1+h >= height || matches_locale(loc)) {
|
if (y+1+h >= height || matches_locale(loc)) {
|
||||||
printf(" %20s: %s (%d x %d @ %d)\n", name, loc, w, h, y);
|
printf(" %20s: %s (%d x %d @ %d)\n", name, loc, w, h, y);
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 9.9 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 9.7 KiB |
|
Before Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 673 B |
|
Before Width: | Height: | Size: 687 B |
|
Before Width: | Height: | Size: 661 B |
|
Before Width: | Height: | Size: 665 B |
|
Before Width: | Height: | Size: 683 B |
|
Before Width: | Height: | Size: 676 B |
@@ -69,22 +69,10 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
|
|||||||
menu_top(0),
|
menu_top(0),
|
||||||
menu_items(0),
|
menu_items(0),
|
||||||
menu_sel(0),
|
menu_sel(0),
|
||||||
|
|
||||||
// These values are correct for the default image resources
|
|
||||||
// provided with the android platform. Devices which use
|
|
||||||
// different resources should have a subclass of ScreenRecoveryUI
|
|
||||||
// that overrides Init() to set these values appropriately and
|
|
||||||
// then call the superclass Init().
|
|
||||||
animation_fps(20),
|
animation_fps(20),
|
||||||
indeterminate_frames(6),
|
installing_frames(-1),
|
||||||
installing_frames(7),
|
|
||||||
install_overlay_offset_x(13),
|
|
||||||
install_overlay_offset_y(190),
|
|
||||||
overlay_offset_x(-1),
|
|
||||||
overlay_offset_y(-1),
|
|
||||||
stage(-1),
|
stage(-1),
|
||||||
max_stage(-1) {
|
max_stage(-1) {
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
backgroundIcon[i] = NULL;
|
backgroundIcon[i] = NULL;
|
||||||
|
|
||||||
@@ -92,20 +80,6 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
|
|||||||
self = this;
|
self = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the given frame over the installation overlay animation. The
|
|
||||||
// background is not cleared or draw with the base icon first; we
|
|
||||||
// assume that the frame already contains some other frame of the
|
|
||||||
// animation. Does nothing if no overlay animation is defined.
|
|
||||||
// Should only be called with updateMutex locked.
|
|
||||||
void ScreenRecoveryUI::draw_install_overlay_locked(int frame) {
|
|
||||||
if (installationOverlay == NULL || overlay_offset_x < 0) return;
|
|
||||||
gr_surface surface = installationOverlay[frame];
|
|
||||||
int iconWidth = gr_get_width(surface);
|
|
||||||
int iconHeight = gr_get_height(surface);
|
|
||||||
gr_blit(surface, 0, 0, iconWidth, iconHeight,
|
|
||||||
overlay_offset_x, overlay_offset_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the screen and draw the currently selected background icon (if any).
|
// Clear the screen and draw the currently selected background icon (if any).
|
||||||
// Should only be called with updateMutex locked.
|
// Should only be called with updateMutex locked.
|
||||||
void ScreenRecoveryUI::draw_background_locked(Icon icon)
|
void ScreenRecoveryUI::draw_background_locked(Icon icon)
|
||||||
@@ -116,6 +90,9 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon)
|
|||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
gr_surface surface = backgroundIcon[icon];
|
gr_surface surface = backgroundIcon[icon];
|
||||||
|
if (icon == INSTALLING_UPDATE || icon == ERASING) {
|
||||||
|
surface = installation[installingFrame];
|
||||||
|
}
|
||||||
gr_surface text_surface = backgroundText[icon];
|
gr_surface text_surface = backgroundText[icon];
|
||||||
|
|
||||||
int iconWidth = gr_get_width(surface);
|
int iconWidth = gr_get_width(surface);
|
||||||
@@ -126,13 +103,14 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon)
|
|||||||
|
|
||||||
int sh = (max_stage >= 0) ? stageHeight : 0;
|
int sh = (max_stage >= 0) ? stageHeight : 0;
|
||||||
|
|
||||||
int iconX = (gr_fb_width() - iconWidth) / 2;
|
iconX = (gr_fb_width() - iconWidth) / 2;
|
||||||
int iconY = (gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2;
|
iconY = (gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2;
|
||||||
|
|
||||||
int textX = (gr_fb_width() - textWidth) / 2;
|
int textX = (gr_fb_width() - textWidth) / 2;
|
||||||
int textY = ((gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2) + iconHeight + 40;
|
int textY = ((gr_fb_height() - (iconHeight+textHeight+40+sh)) / 2) + iconHeight + 40;
|
||||||
|
|
||||||
gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY);
|
gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY);
|
||||||
|
|
||||||
if (stageHeight > 0) {
|
if (stageHeight > 0) {
|
||||||
int sw = gr_get_width(stageMarkerEmpty);
|
int sw = gr_get_width(stageMarkerEmpty);
|
||||||
int x = (gr_fb_width() - max_stage * gr_get_width(stageMarkerEmpty)) / 2;
|
int x = (gr_fb_width() - max_stage * gr_get_width(stageMarkerEmpty)) / 2;
|
||||||
@@ -144,10 +122,6 @@ void ScreenRecoveryUI::draw_background_locked(Icon icon)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon == INSTALLING_UPDATE || icon == ERASING) {
|
|
||||||
draw_install_overlay_locked(installingFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
gr_color(255, 255, 255, 255);
|
gr_color(255, 255, 255, 255);
|
||||||
gr_texticon(textX, textY, text_surface);
|
gr_texticon(textX, textY, text_surface);
|
||||||
}
|
}
|
||||||
@@ -160,7 +134,8 @@ void ScreenRecoveryUI::draw_progress_locked()
|
|||||||
if (currentIcon == ERROR) return;
|
if (currentIcon == ERROR) return;
|
||||||
|
|
||||||
if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
|
if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) {
|
||||||
draw_install_overlay_locked(installingFrame);
|
gr_surface icon = installation[installingFrame];
|
||||||
|
gr_blit(icon, 0, 0, gr_get_width(icon), gr_get_height(icon), iconX, iconY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressBarType != EMPTY) {
|
if (progressBarType != EMPTY) {
|
||||||
@@ -197,18 +172,6 @@ void ScreenRecoveryUI::draw_progress_locked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (progressBarType == INDETERMINATE) {
|
|
||||||
static int frame = 0;
|
|
||||||
gr_blit(progressBarIndeterminate[frame], 0, 0, width, height, dx, dy);
|
|
||||||
// in RTL locales, we run the animation backwards, which
|
|
||||||
// makes the spinner spin the other way.
|
|
||||||
if (rtl_locale) {
|
|
||||||
frame = (frame + indeterminate_frames - 1) % indeterminate_frames;
|
|
||||||
} else {
|
|
||||||
frame = (frame + 1) % indeterminate_frames;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,12 +298,6 @@ void ScreenRecoveryUI::progress_loop() {
|
|||||||
redraw = 1;
|
redraw = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the progress bar animation, if active
|
|
||||||
// skip this if we have a text overlay (too expensive to update)
|
|
||||||
if (progressBarType == INDETERMINATE && !show_text) {
|
|
||||||
redraw = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// move the progress bar forward on timed intervals, if configured
|
// move the progress bar forward on timed intervals, if configured
|
||||||
int duration = progressScopeDuration;
|
int duration = progressScopeDuration;
|
||||||
if (progressBarType == DETERMINATE && duration > 0) {
|
if (progressBarType == DETERMINATE && duration > 0) {
|
||||||
@@ -371,6 +328,13 @@ void ScreenRecoveryUI::LoadBitmap(const char* filename, gr_surface* surface) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenRecoveryUI::LoadBitmapArray(const char* filename, int* frames, gr_surface** surface) {
|
||||||
|
int result = res_create_multi_surface(filename, frames, surface);
|
||||||
|
if (result < 0) {
|
||||||
|
LOGE("missing bitmap %s\n(Code %d)\n", filename, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenRecoveryUI::LoadLocalizedBitmap(const char* filename, gr_surface* surface) {
|
void ScreenRecoveryUI::LoadLocalizedBitmap(const char* filename, gr_surface* surface) {
|
||||||
int result = res_create_localized_surface(filename, surface);
|
int result = res_create_localized_surface(filename, surface);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
@@ -392,7 +356,9 @@ void ScreenRecoveryUI::Init()
|
|||||||
text_cols = gr_fb_width() / char_width;
|
text_cols = gr_fb_width() / char_width;
|
||||||
if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;
|
if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;
|
||||||
|
|
||||||
LoadBitmap("icon_installing", &backgroundIcon[INSTALLING_UPDATE]);
|
backgroundIcon[NONE] = NULL;
|
||||||
|
LoadBitmapArray("icon_installing", &installing_frames, &installation);
|
||||||
|
backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL;
|
||||||
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
|
backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
|
||||||
LoadBitmap("icon_error", &backgroundIcon[ERROR]);
|
LoadBitmap("icon_error", &backgroundIcon[ERROR]);
|
||||||
backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
|
backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
|
||||||
@@ -407,31 +373,6 @@ void ScreenRecoveryUI::Init()
|
|||||||
LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
|
LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
|
||||||
LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);
|
LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
progressBarIndeterminate = (gr_surface*)malloc(indeterminate_frames *
|
|
||||||
sizeof(gr_surface));
|
|
||||||
for (i = 0; i < indeterminate_frames; ++i) {
|
|
||||||
char filename[40];
|
|
||||||
// "indeterminate01.png", "indeterminate02.png", ...
|
|
||||||
sprintf(filename, "indeterminate%02d", i+1);
|
|
||||||
LoadBitmap(filename, progressBarIndeterminate+i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (installing_frames > 0) {
|
|
||||||
installationOverlay = (gr_surface*)malloc(installing_frames *
|
|
||||||
sizeof(gr_surface));
|
|
||||||
for (i = 0; i < installing_frames; ++i) {
|
|
||||||
char filename[40];
|
|
||||||
// "icon_installing_overlay01.png",
|
|
||||||
// "icon_installing_overlay02.png", ...
|
|
||||||
sprintf(filename, "icon_installing_overlay%02d", i+1);
|
|
||||||
LoadBitmap(filename, installationOverlay+i);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
installationOverlay = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pthread_create(&progress_t, NULL, progress_thread, NULL);
|
pthread_create(&progress_t, NULL, progress_thread, NULL);
|
||||||
|
|
||||||
RecoveryUI::Init();
|
RecoveryUI::Init();
|
||||||
@@ -464,19 +405,6 @@ void ScreenRecoveryUI::SetBackground(Icon icon)
|
|||||||
{
|
{
|
||||||
pthread_mutex_lock(&updateMutex);
|
pthread_mutex_lock(&updateMutex);
|
||||||
|
|
||||||
// Adjust the offset to account for the positioning of the
|
|
||||||
// base image on the screen.
|
|
||||||
if (backgroundIcon[icon] != NULL) {
|
|
||||||
gr_surface bg = backgroundIcon[icon];
|
|
||||||
gr_surface text = backgroundText[icon];
|
|
||||||
overlay_offset_x = install_overlay_offset_x + (gr_fb_width() - gr_get_width(bg)) / 2;
|
|
||||||
overlay_offset_y = install_overlay_offset_y +
|
|
||||||
(gr_fb_height() - (gr_get_height(bg) +
|
|
||||||
gr_get_height(text) +
|
|
||||||
40 +
|
|
||||||
((max_stage >= 0) ? gr_get_height(stageMarkerEmpty) : 0))) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentIcon = icon;
|
currentIcon = icon;
|
||||||
update_screen_locked();
|
update_screen_locked();
|
||||||
|
|
||||||
@@ -516,7 +444,7 @@ void ScreenRecoveryUI::SetProgress(float fraction)
|
|||||||
if (fraction > 1.0) fraction = 1.0;
|
if (fraction > 1.0) fraction = 1.0;
|
||||||
if (progressBarType == DETERMINATE && fraction > progress) {
|
if (progressBarType == DETERMINATE && fraction > progress) {
|
||||||
// Skip updates that aren't visibly different.
|
// Skip updates that aren't visibly different.
|
||||||
int width = gr_get_width(progressBarIndeterminate[0]);
|
int width = gr_get_width(progressBarEmpty);
|
||||||
float scale = width * progressScopeSize;
|
float scale = width * progressScopeSize;
|
||||||
if ((int) (progress * scale) != (int) (fraction * scale)) {
|
if ((int) (progress * scale) != (int) (fraction * scale)) {
|
||||||
progress = fraction;
|
progress = fraction;
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ class ScreenRecoveryUI : public RecoveryUI {
|
|||||||
pthread_mutex_t updateMutex;
|
pthread_mutex_t updateMutex;
|
||||||
gr_surface backgroundIcon[5];
|
gr_surface backgroundIcon[5];
|
||||||
gr_surface backgroundText[5];
|
gr_surface backgroundText[5];
|
||||||
gr_surface *installationOverlay;
|
gr_surface *installation;
|
||||||
gr_surface *progressBarIndeterminate;
|
|
||||||
gr_surface progressBarEmpty;
|
gr_surface progressBarEmpty;
|
||||||
gr_surface progressBarFill;
|
gr_surface progressBarFill;
|
||||||
gr_surface stageMarkerEmpty;
|
gr_surface stageMarkerEmpty;
|
||||||
@@ -101,12 +100,9 @@ class ScreenRecoveryUI : public RecoveryUI {
|
|||||||
pthread_t progress_t;
|
pthread_t progress_t;
|
||||||
|
|
||||||
int animation_fps;
|
int animation_fps;
|
||||||
int indeterminate_frames;
|
|
||||||
int installing_frames;
|
int installing_frames;
|
||||||
protected:
|
|
||||||
int install_overlay_offset_x, install_overlay_offset_y;
|
int iconX, iconY;
|
||||||
private:
|
|
||||||
int overlay_offset_x, overlay_offset_y;
|
|
||||||
|
|
||||||
int stage, max_stage;
|
int stage, max_stage;
|
||||||
|
|
||||||
@@ -120,6 +116,7 @@ class ScreenRecoveryUI : public RecoveryUI {
|
|||||||
void progress_loop();
|
void progress_loop();
|
||||||
|
|
||||||
void LoadBitmap(const char* filename, gr_surface* surface);
|
void LoadBitmap(const char* filename, gr_surface* surface);
|
||||||
|
void LoadBitmapArray(const char* filename, int* frames, gr_surface** surface);
|
||||||
void LoadLocalizedBitmap(const char* filename, gr_surface* surface);
|
void LoadLocalizedBitmap(const char* filename, gr_surface* surface);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||