All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] common lcd: simplify lcd_logo
Date: Fri, 8 Jun 2012 17:35:22 +0200	[thread overview]
Message-ID: <20120608173522.608394e8@wker> (raw)
In-Reply-To: <1337859764-16086-5-git-send-email-grinberg@compulab.co.il>

Hi,

On Thu, 24 May 2012 14:42:41 +0300
Igor Grinberg <grinberg@compulab.co.il> wrote:

> From: Nikita Kiryanov <nikita@compulab.co.il>
> 
> Simplify lcd_logo by extracting bmp unzip into its own function.
> 
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> ---
>  common/lcd.c |   30 ++++++++++++++++++++----------
>  1 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/common/lcd.c b/common/lcd.c
> index 448e0f0..855d3df 100644
> --- a/common/lcd.c
> +++ b/common/lcd.c
> @@ -810,6 +810,25 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
>  }
>  #endif
>  
> +#ifdef CONFIG_VIDEO_BMP_GZIP
> +static inline ulong __gunzip_bmp(ulong addr)
> +{
> +	bmp_image_t *bmp = (bmp_image_t *)addr;
> +	unsigned long len;
> +
> +	if (!((bmp->header.signature[0] == 'B') &&
> +			(bmp->header.signature[1] == 'M')))
> +		addr = (ulong)gunzip_bmp(addr, &len);
> +
> +	return addr;
> +}
> +#else
> +static inline ulong __gunzip_bmp(ulong addr)
> +{
> +	return addr;
> +}
> +#endif
> +
>  static void *lcd_logo(void)
>  {
>  #ifdef CONFIG_SPLASH_SCREEN
> @@ -840,16 +859,7 @@ static void *lcd_logo(void)
>  		}
>  #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>  
> -#ifdef CONFIG_VIDEO_BMP_GZIP
> -		bmp_image_t *bmp = (bmp_image_t *)addr;
> -		unsigned long len;
> -
> -		if (!((bmp->header.signature[0] == 'B') &&
> -			(bmp->header.signature[1] == 'M'))) {
> -			addr = (ulong)gunzip_bmp(addr, &len);
> -		}
> -#endif
> -
> +		addr = __gunzip_bmp(addr);
>  		if (lcd_display_bitmap(addr, x, y) == 0)
>  			return (void *)lcd_base;

We can simplify it even more by using existing code here:

                if (bmp_display(addr, x, y) == 0)
                        return (void *)lcd_base;

bmp_display() will check and gunzip if needed.

Thanks,

Anatolij

  reply	other threads:[~2012-06-08 15:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24 11:42 [U-Boot] [PATCH 0/7] common/lcd cleanup Igor Grinberg
2012-05-24 11:42 ` [U-Boot] [PATCH 1/7] common lcd: minor coding style changes Igor Grinberg
2012-06-08 13:51   ` Anatolij Gustschin
2012-05-24 11:42 ` [U-Boot] [PATCH 2/7] common lcd: simplify #ifdefs Igor Grinberg
2012-06-08 12:52   ` Anatolij Gustschin
2012-06-13 12:55     ` Nikita Kiryanov
2012-05-24 11:42 ` [U-Boot] [PATCH 3/7] common lcd: simplify bitmap_plot Igor Grinberg
2012-06-08 13:09   ` Anatolij Gustschin
2012-05-24 11:42 ` [U-Boot] [PATCH 4/7] common lcd: simplify lcd_logo Igor Grinberg
2012-06-08 15:35   ` Anatolij Gustschin [this message]
2012-05-24 11:42 ` [U-Boot] [PATCH 5/7] common lcd: simplify lcd_display Igor Grinberg
2012-05-24 11:42 ` [U-Boot] [PATCH 6/7] common lcd: simplify core functions Igor Grinberg
2012-05-24 11:42 ` [U-Boot] [PATCH 7/7] common lcd: simplify lcd_display_bitmap Igor Grinberg
2012-06-08 13:38   ` Anatolij Gustschin
2012-06-08  8:00 ` [U-Boot] [PATCH 0/7] common/lcd cleanup Igor Grinberg

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=20120608173522.608394e8@wker \
    --to=agust@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.