[devel] Fix inconsistent whitespace in pngtrans.c, pngwrite.c, and pngwtran.c

This commit is contained in:
Glenn Randers-Pehrson 2010-03-03 11:40:43 -06:00
parent 4e763f1b30
commit 45624d6c2c
3 changed files with 141 additions and 140 deletions

View File

@ -136,7 +136,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
} }
/* Also I added this in libpng-1.0.2a (what happens when we expand /* Also I added this in libpng-1.0.2a (what happens when we expand
* a less-than-8-bit grayscale to GA? */ * a less-than-8-bit grayscale to GA?) */
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8) if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
{ {
@ -223,10 +223,10 @@ png_do_invert(png_row_infop row_info, png_bytep row)
png_uint_32 i; png_uint_32 i;
png_uint_32 istop = row_info->rowbytes; png_uint_32 istop = row_info->rowbytes;
for (i = 0; i < istop; i+=2) for (i = 0; i < istop; i += 2)
{ {
*rp = (png_byte)(~(*rp)); *rp = (png_byte)(~(*rp));
rp+=2; rp += 2;
} }
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA && else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
@ -236,11 +236,11 @@ png_do_invert(png_row_infop row_info, png_bytep row)
png_uint_32 i; png_uint_32 i;
png_uint_32 istop = row_info->rowbytes; png_uint_32 istop = row_info->rowbytes;
for (i = 0; i < istop; i+=4) for (i = 0; i < istop; i += 4)
{ {
*rp = (png_byte)(~(*rp)); *rp = (png_byte)(~(*rp));
*(rp+1) = (png_byte)(~(*(rp+1))); *(rp + 1) = (png_byte)(~(*(rp + 1)));
rp+=4; rp += 4;
} }
} }
} }
@ -413,9 +413,9 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
png_debug(1, "in png_do_strip_filler"); png_debug(1, "in png_do_strip_filler");
{ {
png_bytep sp=row; png_bytep sp = row;
png_bytep dp=row; png_bytep dp = row;
png_uint_32 row_width=row_info->width; png_uint_32 row_width = row_info->width;
png_uint_32 i; png_uint_32 i;
if ((row_info->color_type == PNG_COLOR_TYPE_RGB || if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
@ -428,7 +428,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
/* This converts from RGBX or RGBA to RGB */ /* This converts from RGBX or RGBA to RGB */
if (flags & PNG_FLAG_FILLER_AFTER) if (flags & PNG_FLAG_FILLER_AFTER)
{ {
dp+=3; sp+=4; dp += 3; sp += 4;
for (i = 1; i < row_width; i++) for (i = 1; i < row_width; i++)
{ {
*dp++ = *sp++; *dp++ = *sp++;
@ -485,7 +485,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
dp += 6; dp += 6;
*/ */
sp+=2; sp += 2;
*dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++; *dp++ = *sp++;
@ -506,18 +506,18 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This converts from GX or GA to G */
if (flags & PNG_FLAG_FILLER_AFTER) if (flags & PNG_FLAG_FILLER_AFTER)
{ {
/* This converts from GX or GA to G */
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
*dp++ = *sp++; *dp++ = *sp++;
sp++; sp++;
} }
} }
/* This converts from XG or AG to G */
else else
{ {
/* This converts from XG or AG to G */
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
sp++; sp++;

View File

@ -879,8 +879,7 @@ png_write_flush(png_structp png_ptr)
if (!(png_ptr->zstream.avail_out)) if (!(png_ptr->zstream.avail_out))
{ {
/* Write the IDAT and reset the zlib output buffer */ /* Write the IDAT and reset the zlib output buffer */
png_write_IDAT(png_ptr, png_ptr->zbuf, png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
png_ptr->zbuf_size);
png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
wrote_IDAT = 1; wrote_IDAT = 1;
@ -1073,9 +1072,11 @@ png_set_filter(png_structp png_ptr, int method, int filters)
png_ptr->do_filter = PNG_FILTER_AVG; break; png_ptr->do_filter = PNG_FILTER_AVG; break;
case PNG_FILTER_VALUE_PAETH: case PNG_FILTER_VALUE_PAETH:
png_ptr->do_filter = PNG_FILTER_PAETH; break; png_ptr->do_filter = PNG_FILTER_PAETH; break;
default: png_ptr->do_filter = (png_byte)filters; break; default:
png_ptr->do_filter = (png_byte)filters; break;
#else #else
default: png_warning(png_ptr, "Unknown row filter for method 0"); default:
png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_WRITE_FILTER_SUPPORTED */ #endif /* PNG_WRITE_FILTER_SUPPORTED */
} }

View File

@ -342,9 +342,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
/* This converts from ARGB to RGBA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This converts from ARGB to RGBA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -357,9 +357,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save; *(dp++) = save;
} }
} }
/* This converts from AARRGGBB to RRGGBBAA */
else else
{ {
/* This converts from AARRGGBB to RRGGBBAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -382,9 +382,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{ {
/* This converts from AG to GA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This converts from AG to GA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -396,9 +396,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save; *(dp++) = save;
} }
} }
/* This converts from AAGG to GGAA */
else else
{ {
/* This converts from AAGG to GGAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -428,9 +428,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{ {
/* This inverts the alpha channel in RGBA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This inverts the alpha channel in RGBA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -445,9 +445,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
/* This inverts the alpha channel in RRGGBBAA */
else else
{ {
/* This inverts the alpha channel in RRGGBBAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -470,9 +470,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
} }
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{ {
/* This inverts the alpha channel in GA */
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
/* This inverts the alpha channel in GA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -483,9 +483,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
} }
} }
/* This inverts the alpha channel in GGAA */
else else
{ {
/* This inverts the alpha channel in GGAA */
png_bytep sp, dp; png_bytep sp, dp;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@ -532,8 +532,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{ {
*(rp) = (png_byte)((*rp - *(rp+1))&0xff); *(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff); *(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
} }
} }
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
@ -550,15 +550,15 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel) for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{ {
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL); png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL); png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)((red >> 8) & 0xff); *(rp ) = (png_byte)((red >> 8) & 0xff);
*(rp+1) = (png_byte)(red & 0xff); *(rp + 1) = (png_byte)(red & 0xff);
*(rp+4) = (png_byte)((blue >> 8) & 0xff); *(rp + 4) = (png_byte)((blue >> 8) & 0xff);
*(rp+5) = (png_byte)(blue & 0xff); *(rp + 5) = (png_byte)(blue & 0xff);
} }
} }
} }