minor recovery fixes
- protect against missing/malformed bitmaps: fail to display them but don't crash. - don't draw animation overlays until the overlay offset is computed. - logging cleanup Change-Id: Ieb1c155cfbb11e643000bdb5d1a57900c8757739
This commit is contained in:
@@ -245,6 +245,9 @@ int gr_text(int x, int y, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gr_texticon(int x, int y, gr_surface icon) {
|
void gr_texticon(int x, int y, gr_surface icon) {
|
||||||
|
if (gr_context == NULL || icon == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
GGLContext* gl = gr_context;
|
GGLContext* gl = gr_context;
|
||||||
|
|
||||||
gl->bindTexture(gl, (GGLSurface*) icon);
|
gl->bindTexture(gl, (GGLSurface*) icon);
|
||||||
@@ -268,7 +271,7 @@ void gr_fill(int x, int y, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
|
void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy) {
|
||||||
if (gr_context == NULL) {
|
if (gr_context == NULL || source == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GGLContext *gl = gr_context;
|
GGLContext *gl = gr_context;
|
||||||
|
|||||||
@@ -178,8 +178,6 @@ exit:
|
|||||||
static int matches_locale(const char* loc) {
|
static int matches_locale(const char* loc) {
|
||||||
if (locale == NULL) return 0;
|
if (locale == NULL) return 0;
|
||||||
|
|
||||||
printf("matching loc=[%s] vs locale=[%s]\n", loc, locale);
|
|
||||||
|
|
||||||
if (strcmp(loc, locale) == 0) return 1;
|
if (strcmp(loc, locale) == 0) return 1;
|
||||||
|
|
||||||
// if loc does *not* have an underscore, and it matches the start
|
// if loc does *not* have an underscore, and it matches the start
|
||||||
@@ -190,7 +188,6 @@ static int matches_locale(const char* loc) {
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; loc[i] != 0 && loc[i] != '_'; ++i);
|
for (i = 0; loc[i] != 0 && loc[i] != '_'; ++i);
|
||||||
if (loc[i] == '_') return 0;
|
if (loc[i] == '_') return 0;
|
||||||
printf(" partial match possible; i = %d\n", i);
|
|
||||||
|
|
||||||
return (strncmp(locale, loc, i) == 0 && locale[i] == '_');
|
return (strncmp(locale, loc, i) == 0 && locale[i] == '_');
|
||||||
}
|
}
|
||||||
@@ -268,9 +265,9 @@ int res_create_localized_surface(const char* name, gr_surface* pSurface) {
|
|||||||
int len = row[4];
|
int len = row[4];
|
||||||
char* loc = row+5;
|
char* loc = row+5;
|
||||||
|
|
||||||
printf("row %d: %s %d x %d\n", y, loc, w, h);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
surface = malloc(sizeof(GGLSurface));
|
surface = malloc(sizeof(GGLSurface));
|
||||||
if (surface == NULL) {
|
if (surface == NULL) {
|
||||||
result = -8;
|
result = -8;
|
||||||
|
|||||||
@@ -78,7 +78,9 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
|
|||||||
indeterminate_frames(16),
|
indeterminate_frames(16),
|
||||||
installing_frames(48),
|
installing_frames(48),
|
||||||
install_overlay_offset_x(65),
|
install_overlay_offset_x(65),
|
||||||
install_overlay_offset_y(106) {
|
install_overlay_offset_y(106),
|
||||||
|
overlay_offset_x(-1),
|
||||||
|
overlay_offset_y(-1) {
|
||||||
pthread_mutex_init(&updateMutex, NULL);
|
pthread_mutex_init(&updateMutex, NULL);
|
||||||
self = this;
|
self = this;
|
||||||
}
|
}
|
||||||
@@ -89,7 +91,7 @@ ScreenRecoveryUI::ScreenRecoveryUI() :
|
|||||||
// animation. Does nothing if no overlay animation is defined.
|
// animation. Does nothing if no overlay animation is defined.
|
||||||
// Should only be called with updateMutex locked.
|
// Should only be called with updateMutex locked.
|
||||||
void ScreenRecoveryUI::draw_install_overlay_locked(int frame) {
|
void ScreenRecoveryUI::draw_install_overlay_locked(int frame) {
|
||||||
if (installationOverlay == NULL) return;
|
if (installationOverlay == NULL || overlay_offset_x < 0) return;
|
||||||
gr_surface surface = installationOverlay[frame];
|
gr_surface surface = installationOverlay[frame];
|
||||||
int iconWidth = gr_get_width(surface);
|
int iconWidth = gr_get_width(surface);
|
||||||
int iconHeight = gr_get_height(surface);
|
int iconHeight = gr_get_height(surface);
|
||||||
@@ -361,8 +363,6 @@ void ScreenRecoveryUI::Init()
|
|||||||
void ScreenRecoveryUI::SetBackground(Icon icon)
|
void ScreenRecoveryUI::SetBackground(Icon icon)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&updateMutex);
|
pthread_mutex_lock(&updateMutex);
|
||||||
currentIcon = icon;
|
|
||||||
update_screen_locked();
|
|
||||||
|
|
||||||
// Adjust the offset to account for the positioning of the
|
// Adjust the offset to account for the positioning of the
|
||||||
// base image on the screen.
|
// base image on the screen.
|
||||||
@@ -374,6 +374,9 @@ void ScreenRecoveryUI::SetBackground(Icon icon)
|
|||||||
(gr_fb_height() - (gr_get_height(bg) + gr_get_height(text) + 40)) / 2;
|
(gr_fb_height() - (gr_get_height(bg) + gr_get_height(text) + 40)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentIcon = icon;
|
||||||
|
update_screen_locked();
|
||||||
|
|
||||||
pthread_mutex_unlock(&updateMutex);
|
pthread_mutex_unlock(&updateMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user