// Clear the screen and draw the currently selected background icon (if any). // Should only be called with gUpdateMutex locked. static void draw_background_locked(int icon) { gPagesIdentical = 0; // gr_color(0, 0, 0, 255); // gr_fill(0, 0, gr_fb_width(), gr_fb_height()); { int bw = gr_get_width(gBackground); int bh = gr_get_height(gBackground); int bx = 0; int by = 0; for (by = 0; by < gr_fb_height(); by += bh) { for (bx = 0; bx < gr_fb_width(); bx += bw) { gr_blit(gBackground, 0, 0, bw, bh, bx, by); } } } if (icon) { gr_surface surface = gBackgroundIcon[icon]; int iconWidth = gr_get_width(surface); int iconHeight = gr_get_height(surface); int iconX = (gr_fb_width() - iconWidth) / 2; int iconY = (gr_fb_height() - iconHeight) / 2; gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY); if (icon == BACKGROUND_ICON_INSTALLING) { draw_install_overlay_locked(gInstallingFrame); } } }
// Clear the screen and draw the currently selected background icon (if any). // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_background_locked(Icon icon) { pagesIdentical = false; gr_color(0, 0, 0, 255); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); if (icon) { gr_surface surface = backgroundIcon[icon]; gr_surface text_surface = backgroundText[icon]; int iconWidth = gr_get_width(surface); int iconHeight = gr_get_height(surface); int textWidth = gr_get_width(text_surface); int textHeight = gr_get_height(text_surface); int iconX = (gr_fb_width() - iconWidth) / 2; int iconY = (gr_fb_height() - (iconHeight+textHeight+40)) / 2; int textX = (gr_fb_width() - textWidth) / 2; int textY = ((gr_fb_height() - (iconHeight+textHeight+40)) / 2) + iconHeight + 40; gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY); if (icon == INSTALLING_UPDATE || icon == ERASING) { draw_install_overlay_locked(installingFrame); } gr_color(255, 255, 255, 255); gr_texticon(textX, textY, text_surface); } }
// Draw the progress bar (if any) on the screen. Does not flip pages. // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_progress_locked() { if (currentIcon == ERROR) return; if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) { draw_install_overlay_locked(installingFrame); } if (progressBarType != EMPTY) { int iconHeight = gr_get_height(backgroundIcon[INSTALLING_UPDATE]); int width = gr_get_width(progressBarEmpty); int height = gr_get_height(progressBarEmpty); int dx = (gr_fb_width() - width)/2; #if 0 //wschen 2012-07-11 int dy = (3*gr_fb_height() + iconHeight - 2*height)/4; #else int dy = (gr_fb_height() - 8 * height)/4; #endif // Erase behind the progress bar (in case this was a progress-only update) gr_color(0, 0, 0, 255); gr_fill(dx, dy, width, height); if (progressBarType == DETERMINATE) { float p = progressScopeStart + progress * progressScopeSize; int pos = (int) (p * width); if (rtl_locale) { // Fill the progress bar from right to left. if (pos > 0) { gr_blit(progressBarFill, width-pos, 0, pos, height, dx+width-pos, dy); } if (pos < width-1) { gr_blit(progressBarEmpty, 0, 0, width-pos, height, dx, dy); } } else { // Fill the progress bar from left to right. if (pos > 0) { gr_blit(progressBarFill, 0, 0, pos, height, dx, dy); } if (pos < width-1) { gr_blit(progressBarEmpty, pos, 0, width-pos, height, dx+pos, dy); } } } 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; } } } }
// Clear the screen and draw the currently selected background icon (if any). // Should only be called with gUpdateMutex locked. static void draw_background_locked(int icon) { gPagesIdentical = 0; gr_color(0, 0, 0, 255); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); if (icon) { gr_surface surface = gBackgroundIcon[icon]; int iconWidth = gr_get_width(surface); int iconHeight = gr_get_height(surface); int iconX = (gr_fb_width() - iconWidth) / 2; int iconY = (gr_fb_height() - iconHeight) / 2; gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY); if (icon == BACKGROUND_ICON_INSTALLING) { draw_install_overlay_locked(gInstallingFrame); } } }
// Clear the screen and draw the currently selected background icon (if any). // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_background_locked(Icon icon) { pagesIdentical = false; gr_color(0, 0, 0, 255); gr_fill(0, 0, gr_fb_width(), gr_fb_height()); if (icon) { gr_surface surface = backgroundIcon[icon]; int iconWidth = gr_get_width(surface); int iconHeight = gr_get_height(surface); int iconX = (gr_fb_width() - iconWidth) / 2; int iconY = (gr_fb_height() - iconHeight) / 2; gr_blit(surface, 0, 0, iconWidth, iconHeight, iconX, iconY); if (icon == INSTALLING) { draw_install_overlay_locked(installingFrame); } } }
// Draw the progress bar (if any) on the screen; does not flip pages // Should only be called with gUpdateMutex locked and if ui_has_initialized is true static void draw_progress_locked() { if (gCurrentIcon == BACKGROUND_ICON_INSTALLING) { // update the installation animation, if active if (ui_parameters.installing_frames > 0) ui_increment_frame(); draw_install_overlay_locked(gInstallingFrame); } if (gProgressBarType != PROGRESSBAR_TYPE_NONE) { int iconHeight = gr_get_height(gBackgroundIcon[BACKGROUND_ICON_INSTALLING]); 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; // Erase behind the progress bar (in case this was a progress-only update) gr_color(0, 0, 0, 255); gr_fill(dx, dy, width, height); if (gProgressBarType == PROGRESSBAR_TYPE_NORMAL) { float progress = gProgressScopeStart + gProgress * gProgressScopeSize; int pos = (int) (progress * width); 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); } } if (gProgressBarType == PROGRESSBAR_TYPE_INDETERMINATE) { static int frame = 0; gr_blit(gProgressBarIndeterminate[frame], 0, 0, width, height, dx, dy); frame = (frame + 1) % ui_parameters.indeterminate_frames; } } gettimeofday(&lastprogupd, NULL); }
// Draw the progress bar (if any) on the screen. Does not flip pages. // Should only be called with updateMutex locked. void ScreenRecoveryUI::draw_progress_locked() { if (currentIcon == ERROR) return; if (currentIcon == INSTALLING) { draw_install_overlay_locked(installingFrame); } if (progressBarType != EMPTY) { int iconHeight = gr_get_height(backgroundIcon[INSTALLING]); int width = gr_get_width(progressBarEmpty); int height = gr_get_height(progressBarEmpty); int dx = (gr_fb_width() - width)/2; int dy = (3*gr_fb_height() + iconHeight - 2*height)/4; // Erase behind the progress bar (in case this was a progress-only update) gr_color(0, 0, 0, 255); gr_fill(dx, dy, width, height); if (progressBarType == DETERMINATE) { float p = progressScopeStart + progress * progressScopeSize; int pos = (int) (p * width); if (pos > 0) { gr_blit(progressBarFill, 0, 0, pos, height, dx, dy); } if (pos < width-1) { gr_blit(progressBarEmpty, pos, 0, width-pos, height, dx+pos, dy); } } if (progressBarType == INDETERMINATE) { static int frame = 0; gr_blit(progressBarIndeterminate[frame], 0, 0, width, height, dx, dy); frame = (frame + 1) % indeterminate_frames; } } }