mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-13 09:51:31 +00:00
video: fix bug in cfb_console.c code
Fix bug in drawing long version/info strings: U-Boot version string like "U-Boot 2009.03-05647-g7c51e06 (Apr 23 2009 - 12:40:00) MPC83XX" is long and doesn't wrap around correctly while drawing beside the logo. Such long strings partially overwrite the logo. This patch is an attempt to fix it. Signed-off-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
parent
28afe0160f
commit
3dcbe628d6
1 changed files with 33 additions and 3 deletions
|
@ -1181,6 +1181,7 @@ static void *video_logo (void)
|
||||||
{
|
{
|
||||||
char info[128];
|
char info[128];
|
||||||
extern char version_string;
|
extern char version_string;
|
||||||
|
int space, len, y_off = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_SPLASH_SCREEN
|
#ifdef CONFIG_SPLASH_SCREEN
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -1198,6 +1199,18 @@ static void *video_logo (void)
|
||||||
logo_plot (video_fb_address, VIDEO_COLS, 0, 0);
|
logo_plot (video_fb_address, VIDEO_COLS, 0, 0);
|
||||||
|
|
||||||
sprintf (info, " %s", &version_string);
|
sprintf (info, " %s", &version_string);
|
||||||
|
|
||||||
|
space = (VIDEO_LINE_LEN / 2 - VIDEO_INFO_X) / VIDEO_FONT_WIDTH;
|
||||||
|
len = strlen(info);
|
||||||
|
|
||||||
|
if (len > space) {
|
||||||
|
video_drawchars (VIDEO_INFO_X, VIDEO_INFO_Y,
|
||||||
|
(uchar *)info, space);
|
||||||
|
video_drawchars (VIDEO_INFO_X + VIDEO_FONT_WIDTH,
|
||||||
|
VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
|
||||||
|
(uchar *)info + space, len - space);
|
||||||
|
y_off = 1;
|
||||||
|
} else
|
||||||
video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info);
|
video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, (uchar *)info);
|
||||||
|
|
||||||
#ifdef CONFIG_CONSOLE_EXTRA_INFO
|
#ifdef CONFIG_CONSOLE_EXTRA_INFO
|
||||||
|
@ -1206,12 +1219,29 @@ static void *video_logo (void)
|
||||||
|
|
||||||
for (i = 1; i < n; i++) {
|
for (i = 1; i < n; i++) {
|
||||||
video_get_info_str (i, info);
|
video_get_info_str (i, info);
|
||||||
if (*info)
|
if (!*info)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
len = strlen(info);
|
||||||
|
if (len > space) {
|
||||||
|
video_drawchars (VIDEO_INFO_X,
|
||||||
|
VIDEO_INFO_Y +
|
||||||
|
(i + y_off) * VIDEO_FONT_HEIGHT,
|
||||||
|
(uchar *)info, space);
|
||||||
|
y_off++;
|
||||||
|
video_drawchars (VIDEO_INFO_X + VIDEO_FONT_WIDTH,
|
||||||
|
VIDEO_INFO_Y +
|
||||||
|
(i + y_off) * VIDEO_FONT_HEIGHT,
|
||||||
|
(uchar *)info + space,
|
||||||
|
len - space);
|
||||||
|
} else {
|
||||||
video_drawstring (VIDEO_INFO_X,
|
video_drawstring (VIDEO_INFO_X,
|
||||||
VIDEO_INFO_Y + i * VIDEO_FONT_HEIGHT,
|
VIDEO_INFO_Y +
|
||||||
|
(i + y_off) * VIDEO_FONT_HEIGHT,
|
||||||
(uchar *)info);
|
(uchar *)info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (video_fb_address + VIDEO_LOGO_HEIGHT * VIDEO_LINE_LEN);
|
return (video_fb_address + VIDEO_LOGO_HEIGHT * VIDEO_LINE_LEN);
|
||||||
|
|
Loading…
Add table
Reference in a new issue