summaryrefslogtreecommitdiff
path: root/trunk/jdcolext.c
diff options
context:
space:
mode:
authordcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2011-09-08 23:54:40 +0000
committerdcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2011-09-08 23:54:40 +0000
commitce61a9dd8b021c6a6ca147c721af4f6886985e9a (patch)
tree2635f7aaa429868e7f8cebe0dbd9f3ce0bc4b23a /trunk/jdcolext.c
parent0c0340fe0ebb95acaaaf3122e12c454371573d5c (diff)
When decompressing to a 4-byte RGB buffer, set the unused byte to 0xFF so it can be interpreted as an opaque alpha channel.
git-svn-id: https://libjpeg-turbo.svn.sourceforge.net/svnroot/libjpeg-turbo@699 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'trunk/jdcolext.c')
-rw-r--r--trunk/jdcolext.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/trunk/jdcolext.c b/trunk/jdcolext.c
index d0ccca3..af7ea7e 100644
--- a/trunk/jdcolext.c
+++ b/trunk/jdcolext.c
@@ -54,6 +54,10 @@ ycc_rgb_convert_internal (j_decompress_ptr cinfo,
y = GETJSAMPLE(inptr0[col]);
cb = GETJSAMPLE(inptr1[col]);
cr = GETJSAMPLE(inptr2[col]);
+ /* Initialize 4-byte pixels so the alpha channel will be opaque */
+#if RGB_PIXELSIZE == 4
+ *(unsigned int *)outptr = 0xFFFFFFFF;
+#endif
/* Range-limiting is essential due to noise introduced by DCT losses. */
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
outptr[RGB_GREEN] = range_limit[y +
@@ -86,6 +90,10 @@ gray_rgb_convert_internal (j_decompress_ptr cinfo,
inptr = input_buf[0][input_row++];
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
+ /* Initialize 4-byte pixels so the alpha channel will be opaque */
+#if RGB_PIXELSIZE == 4
+ *(unsigned int *)outptr = 0xFFFFFFFF;
+#endif
/* We can dispense with GETJSAMPLE() here */
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
outptr += RGB_PIXELSIZE;