From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 09/12] lcd: introduce getters for bg/fg color
Date: Tue, 02 Dec 2014 13:01:07 +0200 [thread overview]
Message-ID: <547D9BF3.1070608@compulab.co.il> (raw)
In-Reply-To: <CAPnjgZ3nDt24OqKHmdTm_s69difetLLxuYc4XHJzxwrxw3J4CA@mail.gmail.com>
Hi Simon,
On 11/30/2014 09:27 PM, Simon Glass wrote:
> Hi Nikita,
>
> On 30 November 2014 at 05:29, Nikita Kiryanov <nikita@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 <nikita@compulab.co.il>
>> c: Anatolij Gustschin <agust@denx.de>
>> Cc: Simon Glass <sjg@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
next prev parent reply other threads:[~2014-12-02 11:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-30 12:29 [U-Boot] [PATCH V2 00/12] cleanup and refactor lcd.c Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 01/12] lcd: remove CONFIG_SYS_INVERT_COLORS Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 02/12] lcd: cleanup lcd_drawchars Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 03/12] mpc8xx_lcd: get rid of CONFIG_EDT32F10 Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 04/12] lcd: remove LCD_MONOCHROME Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 05/12] lcd: rename console_(row|col) Nikita Kiryanov
2014-11-30 19:24 ` Simon Glass
2014-11-30 12:29 ` [U-Boot] [PATCH V2 06/12] lcd: replace CONSOLE_(ROWS|COLS) with variables Nikita Kiryanov
[not found] ` <CAPnjgZ1wG2WyirHCjKZUXiYHEmu22akN7nLDjpZA9vwOj3vAcA@mail.gmail.com>
2014-12-02 11:34 ` Nikita Kiryanov
2014-12-02 17:38 ` Simon Glass
2014-11-30 12:29 ` [U-Boot] [PATCH V2 07/12] lcd: expand console api Nikita Kiryanov
2014-11-30 19:25 ` Simon Glass
2014-11-30 12:29 ` [U-Boot] [PATCH V2 08/12] lcd: get rid of COLOR_MASK Nikita Kiryanov
2014-11-30 19:26 ` Simon Glass
2014-11-30 12:29 ` [U-Boot] [PATCH V2 09/12] lcd: introduce getters for bg/fg color Nikita Kiryanov
2014-11-30 19:27 ` Simon Glass
2014-12-02 11:01 ` Nikita Kiryanov [this message]
2014-11-30 12:29 ` [U-Boot] [PATCH V2 10/12] lcd: make lcd_drawchars() independant of lcd_base Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 11/12] lcd: refactor lcd console stuff into its own file Nikita Kiryanov
2014-11-30 12:29 ` [U-Boot] [PATCH V2 12/12] lcd_console: remove unused defines Nikita Kiryanov
2014-11-30 19:32 ` Simon Glass
2014-11-30 13:22 ` [U-Boot] [PATCH V2 00/12] cleanup and refactor lcd.c Nikita Kiryanov
2014-11-30 13:22 ` [U-Boot] [PATCH V2 11/12] lcd: refactor lcd console stuff into its own file Nikita Kiryanov
2014-11-30 19:32 ` Simon Glass
2014-12-02 4:10 ` [U-Boot] [PATCH V2 00/12] cleanup and refactor lcd.c Stephen Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=547D9BF3.1070608@compulab.co.il \
--to=nikita@compulab.co.il \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox