Re: [PATCH 2/5] commands: splash: honour line_length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25.09.24 16:34, Sascha Hauer wrote:
> the splash command has an option for setting a background colour. This
> doesn't always fill the whole screen as expected.
> 
> struct fb_info has a line_length field that specifies the length in
> bytes of a single line. That length may be bigger than the actually
> visible area as specified by xres. In this case filling the area as
> calculated by xres*yres fills the invisible pixels between xres and
> line_length, but it doesn't fill the whole visible area. Fix this by
> iterating over the lines, filling the visible area of each line.

I have trouble understanding this. What is line_length if not
bytes per pixel multiplied by xres?

As gu_memset_pixel already takes bytes (bits) per pixel into account,
this looked correct to me before your change?

Thanks,
Ahmad

> 
> Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
> ---
>  commands/splash.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/commands/splash.c b/commands/splash.c
> index 2eb7c5dc39..74754392e2 100644
> --- a/commands/splash.c
> +++ b/commands/splash.c
> @@ -62,9 +62,13 @@ static int do_splash(int argc, char *argv[])
>  
>  	buf = gui_screen_render_buffer(sc);
>  
> -	if (do_bg)
> -		gu_memset_pixel(sc->info, buf, bg_color,
> -				sc->s.width * sc->s.height);
> +	if (do_bg) {
> +		int y;
> +		for (y = 0; y < sc->s.height; y++) {
> +			gu_memset_pixel(sc->info, buf + sc->info->line_length * y,
> +					bg_color, sc->s.width);
> +		}
> +	}
>  
>  	ret = image_renderer_file(sc, &s, image_file);
>  	if (ret > 0)
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux