From nobody Sat Nov 23 12:33:10 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 78.46.105.101 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1548802806130298.8457830234171; Tue, 29 Jan 2019 15:00:06 -0800 (PST) Received: from [172.30.0.99] (mailu_mailman-core_1.mailu_default [172.30.0.99]) by coreboot.org (Postfix) with ESMTP id 7B6FA1123150; Tue, 29 Jan 2019 23:00:03 +0000 (UTC) Received: from cfa51d96e5da (mailu_mailman-web_1.mailu_default [172.30.0.8]) by coreboot.org (Postfix) with ESMTP id 757F01120F40 for ; Tue, 29 Jan 2019 23:00:00 +0000 (UTC) MIME-Version: 1.0 From: "Joseph Pacheco-Corwin" To: seabios@seabios.org Date: Tue, 29 Jan 2019 23:00:00 -0000 Message-ID: <154880280047.22.10816731878247758698@cfa51d96e5da> In-Reply-To: <20190129213747.GC16328@morn.lan> References: <20190129213747.GC16328@morn.lan> User-Agent: HyperKitty on https://mail.coreboot.org/ X-Spam-Level: ** Message-ID-Hash: A6OITR3PIAP5II6KI4GPV6XY2ENA3MLQ X-Message-ID-Hash: A6OITR3PIAP5II6KI4GPV6XY2ENA3MLQ X-MailFrom: hammersamatom@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.0 Precedence: list Subject: [SeaBIOS] Re: bmp/bootsplash: Added support for 16/24/32bpp in one function List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / Authentication-Results: coreboot.org Content-Type: text/plain; charset="utf-8" I've removed the extra unneeded comments. I will keep this in mind for the = future, thank you. --- src/bmp.c | 19 +++++++++---------- src/bootsplash.c | 8 ++++---- src/util.h | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/bmp.c b/src/bmp.c index 96a2b3f..fecc295 100644 --- a/src/bmp.c +++ b/src/bmp.c @@ -56,10 +56,9 @@ typedef struct tagRGBQUAD { * arrange horizontal pixel data, add extra space in the dest buffer * for every line */ -static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width, - int height, int bytes_per_line_des= t) +static void raw_data_format_adjust(u8 *src, u8 *dest, int width, + int height, int bytes_per_line_src, int bytes_per_line_dest) { - int bytes_per_line_src =3D 3 * width; int i; for (i =3D 0 ; i < height ; i++) { memcpy(dest + i * bytes_per_line_dest, @@ -95,22 +94,22 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *= data, int data_size) } =20 /* get bmp properties */ -void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height) +void bmp_get_info(struct bmp_decdata *bmp, int *width, int *height, int *b= pp) { *width =3D bmp->width; *height =3D bmp->height; + *bpp =3D bmp->bpp; } =20 /* flush flat picture data to *pc */ -int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width - , int height, int depth, int bytes_per_line_dest) +int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width, + int height, int depth, int bytes_per_line_dest) { if (bmp->datap =3D=3D pic) return 0; - /* now only support 24bpp bmp file */ - if ((depth =3D=3D 24) && (bmp->bpp =3D=3D 24)) { - raw_data_format_adjust_24bpp(bmp->datap, pic, width, height, - bytes_per_line_dest); + if ((depth =3D=3D bmp->bpp) && (bmp->bpp%8 =3D=3D 0)) { + raw_data_format_adjust(bmp->datap, pic, width, height, + (bmp->bpp/8)*width, bytes_per_line_dest); return 0; } return 1; diff --git a/src/bootsplash.c b/src/bootsplash.c index 165c98d..a251bf4 100644 --- a/src/bootsplash.c +++ b/src/bootsplash.c @@ -172,10 +172,10 @@ enable_bootsplash(void) dprintf(1, "bmp_decode failed with return code %d...\n", ret); goto done; } - bmp_get_size(bmp, &width, &height); - bpp_require =3D 24; + bmp_get_info(bmp, &width, &height, &bpp_require); } - /* jpeg would use 16 or 24 bpp video mode, BMP use 24bpp mode only */ + + // jpeg would use 16 or 24 bpp video mode, BMP uses 16/24/32 bpp mode. =20 // Try to find a graphics mode with the corresponding dimensions. int videomode =3D find_videomode(vesa_info, mode_info, width, height, @@ -192,7 +192,7 @@ enable_bootsplash(void) dprintf(3, "bytes per scanline: %d\n", mode_info->bytes_per_scanline); dprintf(3, "bits per pixel: %d\n", depth); =20 - // Allocate space for image and decompress it. + // Allocate space for image and decompress it. =20 int imagesize =3D height * mode_info->bytes_per_scanline; picture =3D malloc_tmphigh(imagesize); if (!picture) { diff --git a/src/util.h b/src/util.h index 6dd080f..9c06850 100644 --- a/src/util.h +++ b/src/util.h @@ -12,7 +12,7 @@ void handle_1553(struct bregs *regs); // bmp.c struct bmp_decdata *bmp_alloc(void); int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size= ); -void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height); +void bmp_get_info(struct bmp_decdata *bmp, int *width, int *height, int *b= pp); int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width , int height, int depth, int bytes_per_line_dest); =20 --=20 2.20.1 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org