summaryrefslogtreecommitdiff
path: root/com32/lib/jpeg/rgba32.c
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/jpeg/rgba32.c
parent0cd5e05574453627bc9d5fba7bb9c6a6b2d3dd22 (diff)
downloadsyslinux-23f602a07a570de8a3a356b6b156fe036c38ab27.tar.gz
Augment tinyjpeg so that we can decode straight into the buffer;
clear the screen on startup.
Diffstat (limited to 'com32/lib/jpeg/rgba32.c')
-rw-r--r--com32/lib/jpeg/rgba32.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/com32/lib/jpeg/rgba32.c b/com32/lib/jpeg/rgba32.c
index 2934bcd8..2ad91125 100644
--- a/com32/lib/jpeg/rgba32.c
+++ b/com32/lib/jpeg/rgba32.c
@@ -84,7 +84,7 @@ static void YCrCB_to_RGBA32_1x1(struct jdec_private *priv)
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = priv->width*4 - 8*4;
+ offset_to_next_row = priv->bytes_per_row[0] - 8*4;
for (i=0; i<8; i++) {
for (j=0;j<8;j++) {
@@ -140,7 +140,7 @@ static void YCrCB_to_RGBA32_2x1(struct jdec_private *priv)
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = priv->width*4 - 16*4;
+ offset_to_next_row = priv->bytes_per_row[0] - 16*4;
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
@@ -206,11 +206,11 @@ static void YCrCB_to_RGBA32_1x2(struct jdec_private *priv)
#define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5))
p = priv->plane[0];
- p2 = priv->plane[0] + priv->width*4;
+ p2 = priv->plane[0] + priv->bytes_per_row[0];
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = 2*priv->width*4 - 8*4;
+ offset_to_next_row = 2*priv->bytes_per_row[0] - 8*4;
for (i=0; i<8; i++) {
for (j=0; j<8; j++) {
@@ -277,11 +277,11 @@ static void YCrCB_to_RGBA32_2x2(struct jdec_private *priv)
#define FIX(x) ((int)((x) * (1UL<<SCALEBITS) + 0.5))
p = priv->plane[0];
- p2 = priv->plane[0] + priv->width*4;
+ p2 = priv->plane[0] + priv->bytes_per_row[0];
Y = priv->Y;
Cb = priv->Cb;
Cr = priv->Cr;
- offset_to_next_row = (priv->width*4*2) - 16*4;
+ offset_to_next_row = 2*priv->bytes_per_row[0] - 16*4;
for (i=0; i<8; i++) {
for (j=0;j<8;j++) {
@@ -353,7 +353,10 @@ static int initialize_rgba32(struct jdec_private *priv,
{
if (priv->components[0] == NULL)
priv->components[0] = (uint8_t *)malloc(priv->width * priv->height * 4);
- bytes_per_blocklines[0] = priv->width * 4;
+ if (!priv->bytes_per_row[0])
+ priv->bytes_per_row[0] = priv->width * 4;
+
+ bytes_per_blocklines[0] = priv->bytes_per_row[0];
bytes_per_mcu[0] = 4*8;
return !priv->components[0];