aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/vesa
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-09-05 17:06:14 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-09-05 17:06:14 -0700
commit23f602a07a570de8a3a356b6b156fe036c38ab27 (patch)
treedf0746687069b53ef0ffa6ccfee955b67ad184c9 /com32/lib/sys/vesa
parent0cd5e05574453627bc9d5fba7bb9c6a6b2d3dd22 (diff)
downloadsyslinux-23f602a07a570de8a3a356b6b156fe036c38ab27.tar.gz
syslinux-23f602a07a570de8a3a356b6b156fe036c38ab27.tar.xz
syslinux-23f602a07a570de8a3a356b6b156fe036c38ab27.zip
Augment tinyjpeg so that we can decode straight into the buffer;
clear the screen on startup.
Diffstat (limited to 'com32/lib/sys/vesa')
-rw-r--r--com32/lib/sys/vesa/background.c30
-rw-r--r--com32/lib/sys/vesa/initvesa.c2
2 files changed, 13 insertions, 19 deletions
diff --git a/com32/lib/sys/vesa/background.c b/com32/lib/sys/vesa/background.c
index 026cbc75..64a46045 100644
--- a/com32/lib/sys/vesa/background.c
+++ b/com32/lib/sys/vesa/background.c
@@ -160,10 +160,8 @@ static int read_jpeg_file(FILE *fp, uint8_t *header, int len)
size_t length_of_file = filesize(fp);
unsigned int width, height;
int rv = -1;
- unsigned char *components[3], *in_row_ptr;
- uint32_t *out_row_ptr;
- int bytes_per_row, copy_bytes;
- int i;
+ unsigned char *components[1];
+ unsigned int bytes_per_row[1];
jpeg_file = malloc(length_of_file);
if (!jpeg_file)
@@ -181,28 +179,24 @@ static int read_jpeg_file(FILE *fp, uint8_t *header, int len)
goto err;
tinyjpeg_get_size(jdec, &width, &height);
- if (width > 4096 || height > 4096)
+ if (width > VIDEO_X_SIZE || height > VIDEO_Y_SIZE)
goto err;
- tinyjpeg_decode(jdec, TINYJPEG_FMT_BGRA32);
- tinyjpeg_get_components(jdec, components);
-
- bytes_per_row = width << 2;
- copy_bytes = min(width, (unsigned int)VIDEO_X_SIZE) << 2;
- in_row_ptr = components[0];
- out_row_ptr = (uint32_t *)&__vesacon_background[0];
+ components[0] = (void *)&__vesacon_background[0];
+ tinyjpeg_set_components(jdec, components, 1);
+ bytes_per_row[0] = VIDEO_X_SIZE << 2;
+ tinyjpeg_set_bytes_per_row(jdec, bytes_per_row, 1);
- for (i = 0; i < (int)height; i++) {
- memcpy(out_row_ptr, in_row_ptr, copy_bytes);
- in_row_ptr += bytes_per_row;
- out_row_ptr += VIDEO_X_SIZE;
- }
+ tinyjpeg_decode(jdec, TINYJPEG_FMT_BGRA32);
rv = 0;
err:
+ /* Don't use tinyjpeg_free() here, since we didn't allow tinyjpeg
+ to allocate the frame buffer */
if (jdec)
- tinyjpeg_free(jdec);
+ free(jdec);
+
if (jpeg_file)
free(jpeg_file);
diff --git a/com32/lib/sys/vesa/initvesa.c b/com32/lib/sys/vesa/initvesa.c
index ad551a91..82c99406 100644
--- a/com32/lib/sys/vesa/initvesa.c
+++ b/com32/lib/sys/vesa/initvesa.c
@@ -164,7 +164,7 @@ static int vesacon_set_mode(void)
/* Now set video mode */
rm.eax.w[0] = 0x4F02; /* Set SVGA video mode */
- rm.ebx.w[0] = mode | 0xC000; /* Don't clear video RAM, use linear fb */
+ rm.ebx.w[0] = mode | 0x4000; /* Clear video RAM, use linear fb */
__intcall(0x10, &rm, &rm);
if ( rm.eax.w[0] != 0x004F ) {
rm.eax.w[0] = 0x0003; /* Set regular text mode */