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: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@699 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2011-09-08 23:54:40 +00:00
parent b4570bbf8c
commit c08e8c15bc
7 changed files with 136 additions and 20 deletions

View File

@@ -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;