1. 参考文档
http://blog.csdn.net/u010223349/article/details/40392789
2. 代码路径
alps/bootable/recovery/screen_ui.cpp
// 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) {
gr_surface icon = installation[installingFrame];
gr_blit(icon, 0, 0, gr_get_width(icon), gr_get_height(icon), iconX, iconY);
}
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);
}
}
}
}
}
解析:
int dx = (gr_fb_width() - width)/2; //进度条横坐标
int dy = (gr_fb_height() - 8 * height)/4; //进度条纵坐标
通过调节dy的除数(这里是4)来改变进度条上下位置,除数越大越靠上移动,
如:
int dy = (gr_fb_height() - 8 * height)/6; //进度条往屏幕上方移动
阅读(1727) | 评论(0) | 转发(0) |