From bfdcc65e1163b4891643c2a670570c478b9af2a4 Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Thu, 9 Aug 2012 00:14:53 +0000 Subject: common lcd: simplify lcd_display_bitmap Move highly platform dependant code into its own functions to reduce the number of #ifdefs in lcd_display_bitmap To avoid breaking the mcc200 board which does not #define CONFIG_CMD_BMP, this patch also implements bmp_display() for mcc200. Signed-off-by: Nikita Kiryanov Signed-off-by: Igor Grinberg --- board/mcc200/lcd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'board') diff --git a/board/mcc200/lcd.c b/board/mcc200/lcd.c index d8f754c..893f4b7 100644 --- a/board/mcc200/lcd.c +++ b/board/mcc200/lcd.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef CONFIG_LCD @@ -210,4 +211,23 @@ void show_progress (int size, int tot) } #endif + +int bmp_display(ulong addr, int x, int y) +{ + int ret; + bmp_image_t *bmp = (bmp_image_t *)addr; + + if (!bmp) { + printf("There is no valid bmp file at the given address\n"); + return 1; + } + + ret = lcd_display_bitmap((ulong)bmp, x, y); + + if ((unsigned long)bmp != addr) + free(bmp); + + return ret; +} + #endif /* CONFIG_LCD */ -- cgit v1.1