[devel] Fix inconsistent whitespace and indentation.
This commit is contained in:
parent
262d0ff047
commit
3ea36758ef
73
pngrtran.c
73
pngrtran.c
@ -680,13 +680,16 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
||||
|
||||
switch(error_action)
|
||||
{
|
||||
case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
||||
case 1:
|
||||
png_ptr->transformations |= PNG_RGB_TO_GRAY;
|
||||
break;
|
||||
|
||||
case 2: png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN;
|
||||
case 2:
|
||||
png_ptr->transformations |= PNG_RGB_TO_GRAY_WARN;
|
||||
break;
|
||||
|
||||
case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
|
||||
case 3:
|
||||
png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
|
||||
}
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
@ -774,7 +777,8 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
!(color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
png_ptr->mode |= PNG_BACKGROUND_IS_GRAY;
|
||||
} else if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
||||
}
|
||||
else if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
||||
!(png_ptr->transformations & PNG_BACKGROUND_EXPAND) &&
|
||||
(png_ptr->transformations & PNG_GRAY_TO_RGB) &&
|
||||
png_ptr->background.red == png_ptr->background.green &&
|
||||
@ -953,7 +957,8 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
(double)png_ptr->background.green/255.0, gs) * 255.0
|
||||
+ .5);
|
||||
back.blue = (png_byte)(pow(
|
||||
(double)png_ptr->background.blue/255.0, gs) * 255.0 + .5);
|
||||
(double)png_ptr->background.blue/255.0, gs) * 255.0
|
||||
+ .5);
|
||||
}
|
||||
|
||||
back_1.red = (png_byte)(pow(
|
||||
@ -1895,15 +1900,15 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
void /* PRIVATE */
|
||||
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_uint_32 row_width;
|
||||
png_debug(1, "in png_do_read_invert_alpha");
|
||||
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
row_width = row_info->width;
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
{
|
||||
/* This inverts the alpha channel in RGBA */
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This inverts the alpha channel in RGBA */
|
||||
png_bytep sp = row + row_info->rowbytes;
|
||||
png_bytep dp = sp;
|
||||
png_uint_32 i;
|
||||
@ -1950,9 +1955,9 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
{
|
||||
/* This inverts the alpha channel in GA */
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This inverts the alpha channel in GA */
|
||||
png_bytep sp = row + row_info->rowbytes;
|
||||
png_bytep dp = sp;
|
||||
png_uint_32 i;
|
||||
@ -1963,9 +1968,9 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
*(--dp) = *(--sp);
|
||||
}
|
||||
}
|
||||
/* This inverts the alpha channel in GGAA */
|
||||
else
|
||||
{
|
||||
/* This inverts the alpha channel in GGAA */
|
||||
png_bytep sp = row + row_info->rowbytes;
|
||||
png_bytep dp = sp;
|
||||
png_uint_32 i;
|
||||
@ -1984,7 +1989,6 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
@ -2006,9 +2010,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes the data from G to GX */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This changes the data from G to GX */
|
||||
png_bytep sp = row + (png_size_t)row_width;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
for (i = 1; i < row_width; i++)
|
||||
@ -2021,9 +2025,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
row_info->pixel_depth = 16;
|
||||
row_info->rowbytes = row_width * 2;
|
||||
}
|
||||
/* This changes the data from G to XG */
|
||||
else
|
||||
{
|
||||
/* This changes the data from G to XG */
|
||||
png_bytep sp = row + (png_size_t)row_width;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2038,9 +2042,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
/* This changes the data from GG to GGXX */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This changes the data from GG to GGXX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 1; i < row_width; i++)
|
||||
@ -2056,9 +2060,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
row_info->pixel_depth = 32;
|
||||
row_info->rowbytes = row_width * 4;
|
||||
}
|
||||
/* This changes the data from GG to XXGG */
|
||||
else
|
||||
{
|
||||
/* This changes the data from GG to XXGG */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2078,9 +2082,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes the data from RGB to RGBX */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This changes the data from RGB to RGBX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 3;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
for (i = 1; i < row_width; i++)
|
||||
@ -2095,9 +2099,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
row_info->pixel_depth = 32;
|
||||
row_info->rowbytes = row_width * 4;
|
||||
}
|
||||
/* This changes the data from RGB to XRGB */
|
||||
else
|
||||
{
|
||||
/* This changes the data from RGB to XRGB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 3;
|
||||
png_bytep dp = sp + (png_size_t)row_width;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2114,9 +2118,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
}
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
/* This changes the data from RRGGBB to RRGGBBXX */
|
||||
if (flags & PNG_FLAG_FILLER_AFTER)
|
||||
{
|
||||
/* This changes the data from RRGGBB to RRGGBBXX */
|
||||
png_bytep sp = row + (png_size_t)row_width * 6;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 1; i < row_width; i++)
|
||||
@ -2136,9 +2140,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
|
||||
row_info->pixel_depth = 64;
|
||||
row_info->rowbytes = row_width * 8;
|
||||
}
|
||||
/* This changes the data from RRGGBB to XXRRGGBB */
|
||||
else
|
||||
{
|
||||
/* This changes the data from RRGGBB to XXRRGGBB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 6;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2178,6 +2182,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes G to RGB */
|
||||
png_bytep sp = row + (png_size_t)row_width - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2189,6 +2194,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This changes GG to RRGGBB */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 4;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2206,6 +2212,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
/* This changes GA to RGBA */
|
||||
png_bytep sp = row + (png_size_t)row_width * 2 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 2;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2218,6 +2225,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This changes GGAA to RRGGBBAA */
|
||||
png_bytep sp = row + (png_size_t)row_width * 4 - 1;
|
||||
png_bytep dp = sp + (png_size_t)row_width * 4;
|
||||
for (i = 0; i < row_width; i++)
|
||||
@ -2348,13 +2356,13 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
w = red;
|
||||
else
|
||||
{
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
|
||||
png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff)
|
||||
>> png_ptr->gamma_shift][red>>8];
|
||||
png_uint_16 green_1 =
|
||||
png_ptr->gamma_16_to_1[(green&0xff) >>
|
||||
png_ptr->gamma_shift][green>>8];
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
|
||||
png_ptr->gamma_shift][blue>>8];
|
||||
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff)
|
||||
>> png_ptr->gamma_shift][blue>>8];
|
||||
png_uint_16 gray16 = (png_uint_16)((rc*red_1 + gc*green_1
|
||||
+ bc*blue_1)>>15);
|
||||
w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
|
||||
@ -2850,8 +2858,10 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
||||
for (i = 0; i < row_width; i++, sp += 6)
|
||||
{
|
||||
png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
|
||||
png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3));
|
||||
png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5));
|
||||
png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
|
||||
+ *(sp + 3));
|
||||
png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
|
||||
+ *(sp + 5));
|
||||
if (r == trans_color->red && g == trans_color->green &&
|
||||
b == trans_color->blue)
|
||||
{
|
||||
@ -2884,8 +2894,10 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
||||
for (i = 0; i < row_width; i++, sp += 6)
|
||||
{
|
||||
png_uint_16 r = (png_uint_16)(((*sp) << 8) + *(sp + 1));
|
||||
png_uint_16 g = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3));
|
||||
png_uint_16 b = (png_uint_16)(((*(sp+4)) << 8) + *(sp+5));
|
||||
png_uint_16 g = (png_uint_16)(((*(sp + 2)) << 8)
|
||||
+ *(sp + 3));
|
||||
png_uint_16 b = (png_uint_16)(((*(sp + 4)) << 8)
|
||||
+ *(sp + 5));
|
||||
|
||||
if (r == trans_color->red && g == trans_color->green &&
|
||||
b == trans_color->blue)
|
||||
@ -2970,7 +2982,8 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
||||
dp = row;
|
||||
for (i = 0; i < row_width; i++, sp += 4, dp += 2)
|
||||
{
|
||||
png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3));
|
||||
png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
|
||||
+ *(sp + 3));
|
||||
|
||||
if (a == (png_uint_16)0xffff)
|
||||
{
|
||||
@ -3011,7 +3024,8 @@ png_do_background(png_row_infop row_info, png_bytep row,
|
||||
dp = row;
|
||||
for (i = 0; i < row_width; i++, sp += 4, dp += 2)
|
||||
{
|
||||
png_uint_16 a = (png_uint_16)(((*(sp+2)) << 8) + *(sp+3));
|
||||
png_uint_16 a = (png_uint_16)(((*(sp + 2)) << 8)
|
||||
+ *(sp + 3));
|
||||
if (a == (png_uint_16)0xffff)
|
||||
png_memcpy(dp, sp, 2);
|
||||
|
||||
@ -3965,7 +3979,6 @@ png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
|
||||
g) * 255.0 + .5);
|
||||
}
|
||||
|
||||
|
||||
png_ptr->gamma_from_1 = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)256);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user