From 23f602a07a570de8a3a356b6b156fe036c38ab27 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 5 Sep 2006 17:06:14 -0700 Subject: Augment tinyjpeg so that we can decode straight into the buffer; clear the screen on startup. --- com32/lib/jpeg/rgba32.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'com32/lib/jpeg/rgba32.c') 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<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<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]; -- cgit v1.2.1