From 0b29a8969e918d6c09d0798d381cf74594bdf3a0 Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Tue, 3 Feb 2015 13:32:27 +0200 Subject: lcd: introduce lcd_set_cmap Reduce the lcd_display_bitmap #ifdef complexity by extracting Atmel-specific code for setting cmap for bitmap images into a new function lcd_set_cmap(). A default version is implemented with the remainder of the code. Signed-off-by: Nikita Kiryanov Reviewed-by: Simon Glass Tested-by: Bo Shen Tested-by: Josh Wu Cc: Bo Shen Cc: Simon Glass Cc: Anatolij Gustschin --- drivers/video/atmel_lcdfb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/video/atmel_lcdfb.c') diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 2a71ebae16..5add1369ef 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -11,6 +11,7 @@ #include #include #include +#include #include /* configurable parameters */ @@ -80,6 +81,16 @@ void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue) #endif } +void lcd_set_cmap(bmp_image_t *bmp, unsigned colors) +{ + int i; + + for (i = 0; i < colors; ++i) { + bmp_color_table_entry_t cte = bmp->color_table[i]; + lcd_setcolreg(i, cte.red, cte.green, cte.blue); + } +} + void lcd_ctrl_init(void *lcdbase) { unsigned long value; -- cgit v1.2.1