[libpng16] Imported from libpng-1.6.0beta05.tar

This commit is contained in:
Glenn Randers-Pehrson
2012-02-02 23:11:45 -06:00
parent 96cf4bde0e
commit f3af706c2a
186 changed files with 8544 additions and 20666 deletions

View File

@@ -1,8 +1,8 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.6.0 [February 14, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -287,7 +287,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
{
png_bytep bp = row;
png_size_t i;
unsigned int mask;
png_byte mask;
png_size_t row_bytes = row_info->rowbytes;
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
@@ -301,22 +301,20 @@ png_do_shift(png_row_infop row_info, png_bytep row,
for (i = 0; i < row_bytes; i++, bp++)
{
png_uint_16 v;
int j;
unsigned int v, out;
v = *bp;
out = 0;
*bp = 0;
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
{
if (j > 0)
out |= v << j;
*bp |= (png_byte)((v << j) & 0xff);
else
out |= (v >> (-j)) & mask;
*bp |= (png_byte)((v >> (-j)) & mask);
}
*bp = (png_byte)(out & 0xff);
}
}
@@ -329,23 +327,21 @@ png_do_shift(png_row_infop row_info, png_bytep row,
for (i = 0; i < istop; i++, bp++)
{
const unsigned int c = i%channels;
png_uint_16 v;
int j;
unsigned int v, out;
int c = (int)(i%channels);
v = *bp;
out = 0;
*bp = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
out |= v << j;
*bp |= (png_byte)((v << j) & 0xff);
else
out |= v >> (-j);
*bp |= (png_byte)((v >> (-j)) & 0xff);
}
*bp = (png_byte)(out & 0xff);
}
}
@@ -357,22 +353,22 @@ png_do_shift(png_row_infop row_info, png_bytep row,
for (bp = row, i = 0; i < istop; i++)
{
const unsigned int c = i%channels;
int c = (int)(i%channels);
png_uint_16 value, v;
int j;
unsigned int value, v;
v = png_get_uint_16(bp);
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
value = 0;
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
{
if (j > 0)
value |= v << j;
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
else
value |= v >> (-j);
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
}
*bp++ = (png_byte)((value >> 8) & 0xff);
*bp++ = (png_byte)(value >> 8);
*bp++ = (png_byte)(value & 0xff);
}
}