Hi Simon,
On 11/30/2014 09:27 PM, Simon Glass wrote:
Hi Nikita,
On 30 November 2014 at 05:29, Nikita Kiryanov <nik...@compulab.co.il> wrote:
Introduce lcd_getbgcolor() and lcd_getfgcolor(), and use them where
applicable.
This is a preparatory step for extracting lcd console code into its own
file.
Signed-off-by: Nikita Kiryanov <nik...@compulab.co.il>
c: Anatolij Gustschin <ag...@denx.de>
Cc: Simon Glass <s...@chromium.org>
---
Changes in V2:
- New patch.
common/lcd.c | 20 +++++++++++++++-----
include/lcd.h | 14 ++++++++++++++
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c
index f98aaaf..a75c616 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -186,7 +186,7 @@ static void console_scrollup(void)
/* Clear the last rows */
#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
- lcd_color_bg,
+ lcd_getbgcolor(),
CONSOLE_ROW_SIZE * rows);
#else
u32 *ppix = lcd_console_address +
@@ -195,7 +195,7 @@ static void console_scrollup(void)
for (i = 0;
i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
i++) {
- *ppix++ = lcd_color_bg;
+ *ppix++ = lcd_getbgcolor();
}
#endif
lcd_sync();
@@ -342,7 +342,7 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str,
int count)
for (c = 0; c < 8; ++c) {
*d++ = (bits & 0x80) ?
- lcd_color_fg : lcd_color_bg;
+ lcd_getfgcolor() : lcd_getbgcolor();
Won't this slow things down slightly?
I suppose.. Although, perhaps the compiler is smart enough to optimize
this?
Should you cache the values at the top?
I don't know if it's necessary, but I don't mind doing that.
bits <<= 1;
}
}
@@ -460,7 +460,7 @@ void lcd_clear(void)
/* set framebuffer to background color */
#if (LCD_BPP != LCD_COLOR32)
memset((char *)lcd_base,
- lcd_color_bg,
+ lcd_getbgcolor(),
lcd_line_length * panel_info.vl_row);
#else
u32 *ppix = lcd_base;
@@ -468,7 +468,7 @@ void lcd_clear(void)
for (i = 0;
i < (lcd_line_length *
panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
i++) {
- *ppix++ = lcd_color_bg;
+ *ppix++ = lcd_getbgcolor();
}
#endif
#endif
@@ -575,6 +575,11 @@ static void lcd_setfgcolor(int color)
lcd_color_fg = color;
}
+int lcd_getfgcolor(void)
+{
+ return lcd_color_fg;
+}
+
/*----------------------------------------------------------------------*/
static void lcd_setbgcolor(int color)
@@ -582,6 +587,11 @@ static void lcd_setbgcolor(int color)
lcd_color_bg = color;
}
+int lcd_getbgcolor(void)
+{
+ return lcd_color_bg;
+}
+
/************************************************************************/
/* ** Chipset depending Bitmap / Logo stuff... */
/************************************************************************/
diff --git a/include/lcd.h b/include/lcd.h
index 01609ac..2235b9b 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -291,6 +291,20 @@ int lcd_get_screen_rows(void);
int lcd_get_screen_columns(void);
/**
+ * Get the background color of the LCD
+ *
+ * @return background color value
This is just the raw value of the pixel in the display I think.
I'll rephrase it to include a reference to the pixels.
+ */
+int lcd_getbgcolor(void);
+
+/**
+ * Get the foreground color of the LCD
+ *
+ * @return foreground color value
+ */
+int lcd_getfgcolor(void);
+
+/**
* Set the position of the text cursor
*
* @param col Column to place cursor (0 = left side)
--
1.9.1
Regards,
Simon
--
Regards,
Nikita Kiryanov
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot