mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Back out READ/WRITE_INTERLACING changes
Now that the code works consistently so that these just switch off the support for having libpng do the interlace/deinterlace the old names make more sense, restoring them avoids cruft in the configuration file and avoids an unnecessary version specific change. Signed-off-by: John Bowler <jbowler@acm.org>
This commit is contained in:
parent
caa716d859
commit
504ebd427d
@ -148,13 +148,6 @@
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* WRITE_INTERLACING was used instead of WRITE_INTERLACE prior to 1.7 */
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
# define PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# endif
|
||||
#endif /* WRITE_INTERLACE check */
|
||||
|
||||
/* Work round for GCC complaints about casting a (double) function result to
|
||||
* an unsigned:
|
||||
*/
|
||||
@ -951,11 +944,11 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, filters);
|
||||
|
||||
{
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
int passes = png_set_interlace_handling(png_ptr);
|
||||
# else /* !WRITE_INTERLACE */
|
||||
# else /* !WRITE_INTERLACING */
|
||||
int passes = 1;
|
||||
# endif /* !WRITE_INTERLACE */
|
||||
# endif /* !WRITE_INTERLACING */
|
||||
int pass;
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
|
||||
@ -116,17 +116,6 @@ typedef png_byte *png_const_bytep;
|
||||
# define png_const_structp png_structp
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* READ_INTERLACING was used instead of READ_DEINTERLACE. */
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
# define PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# endif
|
||||
/* WRITE_INTERLACING was used instead of WRITE_INTERLACE. */
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
# define PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <float.h> /* For floating point constants */
|
||||
#include <stdlib.h> /* For malloc */
|
||||
#include <string.h> /* For memcpy, memset */
|
||||
@ -3549,7 +3538,7 @@ transform_row(png_const_structp pp, png_byte buffer[TRANSFORM_ROWMAX],
|
||||
* interlacing support. If there is no write interlacing we can't generate test
|
||||
* cases with interlace:
|
||||
*/
|
||||
#ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
# define INTERLACE_LAST PNG_INTERLACE_LAST
|
||||
# define check_interlace_type(type) ((void)(type))
|
||||
# define set_write_interlace_handling(pp,type) png_set_interlace_handling(pp)
|
||||
@ -3560,7 +3549,7 @@ static void
|
||||
check_interlace_type(int const interlace_type)
|
||||
{
|
||||
/* Prior to 1.7.0 libpng does not support the write of an interlaced image
|
||||
* unless PNG_WRITE_INTERLACE_SUPPORTED, even with do_interlace so the
|
||||
* unless PNG_WRITE_INTERLACING_SUPPORTED, even with do_interlace so the
|
||||
* code here does the pixel interlace itself, so:
|
||||
*/
|
||||
if (interlace_type != PNG_INTERLACE_NONE)
|
||||
@ -3580,10 +3569,10 @@ check_interlace_type(int const interlace_type)
|
||||
# define check_interlace_type(type) ((void)(type))
|
||||
# define INTERLACE_LAST PNG_INTERLACE_LAST
|
||||
# define do_own_interlace 1
|
||||
#endif /* WRITE_INTERLACE tests */
|
||||
#endif /* WRITE_INTERLACING tests */
|
||||
|
||||
#define CAN_WRITE_INTERLACE\
|
||||
PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACE_SUPPORTED
|
||||
PNG_LIBPNG_VER >= 10700 || defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
|
||||
/* The following two routines use the PNG interlace support macros from
|
||||
* png.h to interlace or deinterlace rows.
|
||||
@ -4074,7 +4063,7 @@ make_size(png_store* const ps, png_byte const colour_type, int bdlo,
|
||||
width, height, 0);
|
||||
make_size_image(ps, colour_type, DEPTH(bdlo), PNG_INTERLACE_NONE,
|
||||
width, height, 1);
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
make_size_image(ps, colour_type, DEPTH(bdlo), PNG_INTERLACE_ADAM7,
|
||||
width, height, 0);
|
||||
# endif
|
||||
@ -4945,7 +4934,7 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
|
||||
|
||||
if (pass != png_get_current_pass_number(pp))
|
||||
png_error(pp, "png_get_current_pass_number is broken");
|
||||
#endif
|
||||
#endif /* USER_TRANSFORM_INFO */
|
||||
|
||||
y = PNG_ROW_FROM_PASS_ROW(y, pass);
|
||||
}
|
||||
@ -4957,19 +4946,19 @@ progressive_row(png_structp ppIn, png_bytep new_row, png_uint_32 y, int pass)
|
||||
row = store_image_row(dp->ps, pp, 0, y);
|
||||
|
||||
/* Combine the new row into the old: */
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (dp->do_interlace)
|
||||
#endif
|
||||
#endif /* READ_INTERLACING */
|
||||
{
|
||||
if (dp->interlace_type == PNG_INTERLACE_ADAM7)
|
||||
deinterlace_row(row, new_row, dp->pixel_size, dp->w, pass);
|
||||
else
|
||||
row_copy(row, new_row, dp->pixel_size * dp->w);
|
||||
}
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
else
|
||||
png_progressive_combine_row(pp, row, new_row);
|
||||
#endif /* PNG_READ_DEINTERLACE_SUPPORTED */
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
}
|
||||
|
||||
else if (dp->interlace_type == PNG_INTERLACE_ADAM7 &&
|
||||
@ -5440,7 +5429,7 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
|
||||
for (h=1; h<=16; h+=hinc[bdlo]) for (w=1; w<=16; w+=winc[bdlo])
|
||||
{
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Test with pngvalid generated interlaced images first; we have
|
||||
* already verify these are ok (unless pngvalid has self-consistent
|
||||
* read/write errors, which is unlikely), so this detects errors in the
|
||||
@ -5454,9 +5443,9 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_DEINTERLACE */
|
||||
# endif /* READ_INTERLACING */
|
||||
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test the libpng write side against the pngvalid read side: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 0), 1/*do_interlace*/,
|
||||
@ -5466,8 +5455,8 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
return 0;
|
||||
# endif
|
||||
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Test both together: */
|
||||
standard_test(&pm->this, FILEID(colour_type, DEPTH(bdlo), 0/*palette*/,
|
||||
PNG_INTERLACE_ADAM7, w, h, 0), 0/*do_interlace*/,
|
||||
@ -5476,7 +5465,7 @@ test_size(png_modifier* const pm, png_byte const colour_type,
|
||||
if (fail(pm))
|
||||
return 0;
|
||||
# endif
|
||||
# endif /* READ_DEINTERLACE */
|
||||
# endif /* READ_INTERLACING */
|
||||
}
|
||||
}
|
||||
|
||||
@ -11381,10 +11370,10 @@ int main(int argc, char **argv)
|
||||
{
|
||||
# if CAN_WRITE_INTERLACE
|
||||
pm.interlace_type = PNG_INTERLACE_ADAM7;
|
||||
# else
|
||||
# else /* !CAN_WRITE_INTERLACE */
|
||||
fprintf(stderr, "pngvalid: no write interlace support\n");
|
||||
return SKIP;
|
||||
# endif
|
||||
# endif /* !CAN_WRITE_INTERLACE */
|
||||
}
|
||||
|
||||
else if (strcmp(*argv, "--use-input-precision") == 0)
|
||||
|
||||
@ -31,13 +31,6 @@
|
||||
# include "../../png.h"
|
||||
#endif
|
||||
|
||||
#if PNG_LIBPNG_VER < 10700
|
||||
/* READ_INTERLACING was used instead of READ_DEINTERLACE. */
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
# define PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int
|
||||
read_png(FILE *fp)
|
||||
{
|
||||
@ -77,12 +70,12 @@ read_png(FILE *fp)
|
||||
|
||||
{
|
||||
png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
int passes = png_set_interlace_handling(png_ptr);
|
||||
# else
|
||||
# else /* !READ_INTERLACING */
|
||||
int passes = png_get_interlace_type(png_ptr, info_ptr) ==
|
||||
PNG_INTERLACE_ADAM7 ? PNG_INTERLACE_ADAM7_PASSES : 1;
|
||||
# endif
|
||||
# endif /* !READ_INTERLACING */
|
||||
int pass;
|
||||
|
||||
png_start_read_image(png_ptr);
|
||||
@ -91,10 +84,10 @@ read_png(FILE *fp)
|
||||
{
|
||||
png_uint_32 y = height;
|
||||
|
||||
# ifndef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifndef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (passes == PNG_INTERLACE_ADAM7_PASSES)
|
||||
y = PNG_PASS_ROWS(y, pass);
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
|
||||
/* NOTE: this trashes the row each time; interlace handling won't
|
||||
* work, but this avoids memory thrashing for speed testing.
|
||||
|
||||
@ -37,6 +37,6 @@ option SETJMP on
|
||||
option STDIO on
|
||||
option READ_EXPAND on
|
||||
option READ_IMAGE on
|
||||
option READ_DEINTERLACE on
|
||||
option READ_INTERLACING on
|
||||
option READ_STRIP_16_TO_8 on
|
||||
option USER_LIMITS on
|
||||
|
||||
@ -36,6 +36,6 @@ option STDIO on
|
||||
option READ_bKGD on
|
||||
option READ_GAMMA on
|
||||
option READ_EXPAND on
|
||||
option READ_DEINTERLACE on
|
||||
option READ_INTERLACING on
|
||||
option READ_STRIP_16_TO_8 on
|
||||
option READ_GRAY_TO_RGB on
|
||||
|
||||
@ -53,8 +53,7 @@
|
||||
#include <setjmp.h>
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_EASY_ACCESS_SUPPORTED) &&\
|
||||
(defined(PNG_READ_DEINTERLACE_SUPPORTED) ||\
|
||||
defined(PNG_READ_INTERLACING_SUPPORTED))
|
||||
defined(PNG_READ_INTERLACING_SUPPORTED)
|
||||
|
||||
/* zlib.h defines the structure z_stream, an instance of which is included
|
||||
* in this structure and is required for decompressing the LZ compressed
|
||||
|
||||
10
example.c
10
example.c
@ -524,15 +524,15 @@ void read_png(FILE *fp, int sig_read) /* File is already open */
|
||||
/* Add filler (or alpha) byte (before/after each RGB triplet) */
|
||||
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
|
||||
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Turn on interlace handling. REQUIRED if you are not using
|
||||
* png_read_image(). To see how to handle interlacing passes,
|
||||
* see the png_read_row() method below:
|
||||
*/
|
||||
number_passes = png_set_interlace_handling(png_ptr);
|
||||
#else
|
||||
#else /* !READ_INTERLACING */
|
||||
number_passes = 1;
|
||||
#endif /* READ_DEINTERLACE */
|
||||
#endif /* !READ_INTERLACING */
|
||||
|
||||
|
||||
/* Optional call to gamma correct and add the background to the palette
|
||||
@ -715,7 +715,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
*/
|
||||
png_bytep old_row = ((png_bytep *)our_data)[row_num];
|
||||
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* If both rows are allocated then copy the new row
|
||||
* data to the corresponding row data.
|
||||
*/
|
||||
@ -744,7 +744,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
||||
* to pass the current row as new_row, and the function will combine
|
||||
* the old row and the new row.
|
||||
*/
|
||||
#endif /* READ_DEINTERLACE */
|
||||
#endif /* READ_INTERLACING */
|
||||
}
|
||||
|
||||
end_callback(png_structp png_ptr, png_infop info)
|
||||
|
||||
8
png.h
8
png.h
@ -1462,8 +1462,8 @@ PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p
|
||||
true_bits));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_DEINTERLACE_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACE_SUPPORTED)
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
/* Have the code handle the interlacing. Returns the number of passes.
|
||||
* MUST be called before png_read_update_info or png_start_read_image,
|
||||
* otherwise it will not have the desired effect. Note that it is still
|
||||
@ -1915,7 +1915,7 @@ PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
|
||||
*/
|
||||
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
|
||||
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Function that combines rows. 'new_row' is a flag that should come from
|
||||
* the callback and be non-NULL if anything needs to be done; the library
|
||||
* stores its own version of the new data internally and ignores the passed
|
||||
@ -1923,7 +1923,7 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
|
||||
*/
|
||||
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
|
||||
png_bytep old_row, png_const_bytep new_row));
|
||||
#endif /* READ_DEINTERLACE */
|
||||
#endif /* READ_INTERLACING */
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
|
||||
|
||||
14
pngpread.c
14
pngpread.c
@ -359,9 +359,9 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
|
||||
* the height of an interlaced image with just the rows up to this
|
||||
* one:
|
||||
*/
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (!png_ptr->do_interlace)
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
{
|
||||
affirm(PNG_ROW_IN_INTERLACE_PASS(row_number, pass) && row != NULL);
|
||||
row_number = PNG_PASS_ROWS(row_number+1, pass);
|
||||
@ -533,17 +533,17 @@ png_push_read_process_IDAT(png_structp png_ptr, png_bytep *bufferp,
|
||||
* libpng is handling the de-interlace; when the app does it it
|
||||
* only see the real rows.
|
||||
*/
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (png_ptr->do_interlace)
|
||||
{
|
||||
# ifdef PNG_TRANSFORM_MECH_SUPPORTED
|
||||
row_buffer = png_ptr->transformed_row;
|
||||
if (row_buffer == NULL)
|
||||
# endif
|
||||
# endif /* TRANSFORM_MECH */
|
||||
row_buffer = png_ptr->row_buffer;
|
||||
break;
|
||||
}
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
continue;
|
||||
|
||||
case png_row_skip:
|
||||
@ -552,10 +552,10 @@ png_push_read_process_IDAT(png_structp png_ptr, png_bytep *bufferp,
|
||||
* of 'NULL' to mean this row doesn't contribute to the output
|
||||
* is historical and not documented;
|
||||
*/
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (png_ptr->do_interlace)
|
||||
break;
|
||||
# endif
|
||||
# endif /* READ_INTERLACING */
|
||||
continue;
|
||||
|
||||
default:
|
||||
|
||||
@ -420,7 +420,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
||||
* is doing the interlace handling (this is the historical
|
||||
* behavior!)
|
||||
*/
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (!png_ptr->do_interlace) continue;
|
||||
# else /* !do_interlace */
|
||||
continue;
|
||||
|
||||
14
pngrutil.c
14
pngrutil.c
@ -3118,7 +3118,7 @@ copy_row(png_const_structrp png_ptr, png_bytep dp, png_const_bytep sp,
|
||||
clear/*clear partial byte at end of row*/);
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
static void
|
||||
combine_row(png_const_structrp png_ptr, png_bytep dp, png_const_bytep sp,
|
||||
png_uint_32 x/*in INPUT*/, png_uint_32 width/*of INPUT*/, int display)
|
||||
@ -3495,13 +3495,13 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
|
||||
}
|
||||
}
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
#else /* !READ_DEINTERLACE */
|
||||
#else /* !READ_INTERLACING */
|
||||
/* No read deinterlace support, so 'combine' always reduces to 'copy', there
|
||||
* is no 'display' argument:
|
||||
*/
|
||||
# define combine_row(pp, dp, sp, x, w, display)\
|
||||
copy_row(pp, dp, sp, x, w, 0/*!clear*/)
|
||||
#endif /* !READ_DEINTERLACE */
|
||||
#endif /* !READ_INTERLACING */
|
||||
|
||||
static void
|
||||
png_read_filter_row_sub(png_alloc_size_t row_bytes, unsigned int bpp,
|
||||
@ -4360,7 +4360,7 @@ png_read_process_IDAT(png_structrp png_ptr, png_bytep transformed_row,
|
||||
* allocated here.
|
||||
*/
|
||||
# if defined(PNG_PROGRESSIVE_READ_SUPPORTED) ||\
|
||||
defined(PNG_READ_DEINTERLACE_SUPPORTED)
|
||||
defined(PNG_READ_INTERLACING_SUPPORTED)
|
||||
if (png_ptr->transform_list != NULL &&
|
||||
(save_row || (png_ptr->do_interlace && pass < 6U)))
|
||||
{
|
||||
@ -4374,7 +4374,7 @@ png_read_process_IDAT(png_structrp png_ptr, png_bytep transformed_row,
|
||||
copy_row(png_ptr, png_ptr->transformed_row,
|
||||
pixel_buffer.buffer, x, pixels, 1/*clear*/);
|
||||
}
|
||||
# endif /* PROGRESSIVE_READ || READ_DEINTERLACE */
|
||||
# endif /* PROGRESSIVE_READ || READ_INTERLACING */
|
||||
} /* transform_list != NULL */
|
||||
# endif /* TRANSFORM_MECH */
|
||||
|
||||
@ -4407,14 +4407,14 @@ png_read_free_row_buffers(png_structrp png_ptr)
|
||||
{
|
||||
/* The transformed row only gets saved if needed: */
|
||||
# if (defined(PNG_PROGRESSIVE_READ_SUPPORTED) ||\
|
||||
defined(PNG_READ_DEINTERLACE_SUPPORTED)) &&\
|
||||
defined(PNG_READ_INTERLACING_SUPPORTED)) &&\
|
||||
defined(PNG_TRANSFORM_MECH_SUPPORTED)
|
||||
if (png_ptr->transformed_row != NULL)
|
||||
{
|
||||
png_free(png_ptr, png_ptr->transformed_row);
|
||||
png_ptr->transformed_row = NULL;
|
||||
}
|
||||
# endif /* PROGRESSIVE_READ || READ_DEINTERLACE */
|
||||
# endif /* PROGRESSIVE_READ || READ_INTERLACING */
|
||||
|
||||
if (png_ptr->row_buffer != NULL)
|
||||
{
|
||||
|
||||
10
pngstruct.h
10
pngstruct.h
@ -450,12 +450,12 @@ struct png_struct_def
|
||||
png_bytep row_buffer; /* primary row buffer */
|
||||
#endif /* WRITE_FILTER || READ */
|
||||
#if (defined(PNG_PROGRESSIVE_READ_SUPPORTED) ||\
|
||||
defined(PNG_READ_DEINTERLACE_SUPPORTED)) &&\
|
||||
defined(PNG_READ_INTERLACING_SUPPORTED)) &&\
|
||||
defined(PNG_TRANSFORM_MECH_SUPPORTED)
|
||||
png_bytep transformed_row; /* pointer to the transformed row, if
|
||||
* required. May point to row_buffer.
|
||||
*/
|
||||
#endif /* (PROGRESSIVE_READ || READ_DEINTERLACE) && TRANSFORM_MECH */
|
||||
#endif /* (PROGRESSIVE_READ || READ_INTERLACING) && TRANSFORM_MECH */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
png_alloc_size_t row_bytes_read; /* Total read in row */
|
||||
@ -489,10 +489,10 @@ struct png_struct_def
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
unsigned int read_started :1; /* at least one call to png_read_row */
|
||||
#endif
|
||||
#if defined (PNG_READ_DEINTERLACE_SUPPORTED) ||\
|
||||
defined (PNG_WRITE_INTERLACE_SUPPORTED)
|
||||
#if defined (PNG_READ_INTERLACING_SUPPORTED) ||\
|
||||
defined (PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
unsigned int do_interlace :1; /* libpng handles the interlace */
|
||||
# endif /* READ_DEINTERLACE, WRITE_INTERLACE */
|
||||
# endif /* R/W INTERLACING */
|
||||
unsigned int pass :3; /* current (interlace) pass (0 - 6) */
|
||||
|
||||
/* The next two fields are just used by the IDAT process functions to store
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
defined PNG_READ_tEXt_SUPPORTED &&\
|
||||
defined PNG_READ_tIME_SUPPORTED &&\
|
||||
defined PNG_READ_zTXt_SUPPORTED &&\
|
||||
defined PNG_WRITE_INTERLACE_SUPPORTED
|
||||
defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||
|
||||
#ifdef PNG_ZLIB_HEADER
|
||||
# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
|
||||
@ -1381,8 +1381,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
pngtest_debug("Writing row data");
|
||||
|
||||
#if defined(PNG_READ_DEINTERLACE_SUPPORTED) &&\
|
||||
defined(PNG_WRITE_INTERLACE_SUPPORTED)
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) &&\
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
/* Both must be defined for libpng to be able to handle the interlace,
|
||||
* otherwise it gets handled below by simply reading and writing the passes
|
||||
* directly.
|
||||
@ -1393,7 +1393,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
if (png_set_interlace_handling(write_ptr) != num_passes)
|
||||
png_error(write_ptr,
|
||||
"png_set_interlace_handling(write): wrong pass count ");
|
||||
#endif
|
||||
#endif /* R/W INTERLACING */
|
||||
|
||||
#ifdef PNGTEST_TIMING
|
||||
t_stop = (float)clock();
|
||||
|
||||
18
pngtrans.c
18
pngtrans.c
@ -978,8 +978,8 @@ png_init_row_info(png_structrp png_ptr)
|
||||
png_ptr->row_input_pixel_depth = png_depth;
|
||||
}
|
||||
|
||||
#if defined(PNG_READ_DEINTERLACE_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACE_SUPPORTED)
|
||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||
int PNGAPI
|
||||
png_set_interlace_handling(png_structrp png_ptr)
|
||||
{
|
||||
@ -989,7 +989,7 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->read_struct)
|
||||
{
|
||||
# ifdef PNG_READ_DEINTERLACE_SUPPORTED
|
||||
# ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (png_ptr->interlaced)
|
||||
{
|
||||
png_ptr->do_interlace = 1;
|
||||
@ -997,15 +997,15 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||
}
|
||||
|
||||
return 1;
|
||||
# else /* !READ_DEINTERLACE */
|
||||
# else /* !READ_INTERLACING */
|
||||
png_app_error(png_ptr, "no de-interlace support");
|
||||
/* return 0 below */
|
||||
# endif /* !READ_DEINTERLACE */
|
||||
# endif /* !READ_INTERLACING */
|
||||
}
|
||||
|
||||
else /* write */
|
||||
{
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
if (png_ptr->interlaced)
|
||||
{
|
||||
png_ptr->do_interlace = 1;
|
||||
@ -1013,17 +1013,17 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||
}
|
||||
|
||||
return 1;
|
||||
# else /* !WRITE_INTERLACE */
|
||||
# else /* !WRITE_INTERLACING */
|
||||
png_app_error(png_ptr, "no interlace support");
|
||||
/* return 0 below */
|
||||
# endif /* !WRITE_INTERLACE */
|
||||
# endif /* !WRITE_INTERLACING */
|
||||
}
|
||||
}
|
||||
|
||||
/* API CHANGE: 1.7.0: returns 0 if called with a NULL png_ptr */
|
||||
return 0;
|
||||
}
|
||||
#endif /* READ_DEINTERLACE || WRITE_INTERLACE */
|
||||
#endif /* READ_INTERLACING || WRITE_INTERLACING */
|
||||
|
||||
#ifdef PNG_MNG_READ_FEATURES_SUPPORTED
|
||||
/* Undoes intrapixel differencing, this is called immediately after the PNG
|
||||
|
||||
14
pngwrite.c
14
pngwrite.c
@ -599,7 +599,7 @@ png_write_image(png_structrp png_ptr, png_bytepp image)
|
||||
|
||||
png_debug(1, "in png_write_image");
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Initialize interlace handling. If image is not interlaced,
|
||||
* this will set pass to 1
|
||||
*/
|
||||
@ -626,7 +626,7 @@ png_write_image(png_structrp png_ptr, png_bytepp image)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PNG_WRITE_INTERLACE_SUPPORTED) ||\
|
||||
#if defined(PNG_WRITE_INTERLACING_SUPPORTED) ||\
|
||||
defined(PNG_WRITE_TRANSFORMS_SUPPORTED)
|
||||
static void
|
||||
write_row_buffered(png_structrp png_ptr, png_const_bytep row,
|
||||
@ -727,7 +727,7 @@ copy_row(png_const_structrp png_ptr, png_bytep row_buffer,
|
||||
}
|
||||
#endif /* WRITE_TRANSFORMS */
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
static void
|
||||
interlace_row_lbd(png_const_structrp png_ptr, png_bytep dp, png_const_bytep sp,
|
||||
png_uint_32 x, unsigned int count, const unsigned int B)
|
||||
@ -821,7 +821,7 @@ interlace_row_byte(png_const_structrp png_ptr, png_bytep dp, png_const_bytep sp,
|
||||
--count, sp += inc * cbytes, dp += cbytes)
|
||||
memcpy(dp, sp, cbytes);
|
||||
}
|
||||
#endif /* WRITE_INTERLACE */
|
||||
#endif /* WRITE_INTERLACING */
|
||||
|
||||
static void
|
||||
write_row_unbuffered(png_structrp png_ptr, png_const_bytep row,
|
||||
@ -935,7 +935,7 @@ write_row_interlaced(png_structrp png_ptr, png_const_bytep row)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Interlace a row then write it out. */
|
||||
static int
|
||||
interlace_row(png_structrp png_ptr, png_const_bytep row)
|
||||
@ -1004,7 +1004,7 @@ interlace_row(png_structrp png_ptr, png_const_bytep row)
|
||||
|
||||
return write_row;
|
||||
}
|
||||
#endif /* WRITE_INTERLACE */
|
||||
#endif /* WRITE_INTERLACING */
|
||||
|
||||
/* Called by user to write a row of image data */
|
||||
void PNGAPI
|
||||
@ -1067,7 +1067,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
|
||||
if (png_ptr->interlaced == PNG_INTERLACE_NONE)
|
||||
write_row_non_interlaced(png_ptr, row);
|
||||
|
||||
# ifdef PNG_WRITE_INTERLACE_SUPPORTED
|
||||
# ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* Optional: libpng does the interlacing, app passes every row of the
|
||||
* image the required number of times.
|
||||
*/
|
||||
|
||||
@ -545,18 +545,13 @@ option PROGRESSIVE_READ requires READ
|
||||
option SEQUENTIAL_READ requires READ
|
||||
|
||||
# Added to 1.7.0: png_read_image now requires the deinterlace code
|
||||
option READ_IMAGE requires SEQUENTIAL_READ READ_DEINTERLACE
|
||||
option READ_IMAGE requires SEQUENTIAL_READ READ_INTERLACING
|
||||
|
||||
# This is not talking about reading interlaced PNG files, it is talking about
|
||||
# libpng support to 'widen' the interlaced passes to the full row width. If
|
||||
# you take the rows libpng provides and expand them yourself you do not need
|
||||
# this code.
|
||||
#
|
||||
# READ_INTERLACING is for backward compatibility with older version of libpng;
|
||||
# applications had to use this to see if they needed to do their own interlace
|
||||
# handling.
|
||||
option READ_INTERLACING disabled
|
||||
option READ_DEINTERLACE requires READ enables READ_INTERLACING
|
||||
option READ_INTERLACING requires READ
|
||||
|
||||
option READ_COMPOSITE_NODIV requires READ
|
||||
= NO_READ_COMPOSITE_NODIV NO_READ_COMPOSITED_NODIV
|
||||
@ -595,8 +590,7 @@ option WRITE_USER_TRANSFORM requires WRITE_TRANSFORMS enables TRANSFORM_MECH
|
||||
|
||||
# This just disables the code within libpng to implement image interlacing on
|
||||
# write; the app can still write interlaced images by doing it itself.
|
||||
option WRITE_INTERLACING disabled
|
||||
option WRITE_INTERLACE requires WRITE enables WRITE_INTERLACING
|
||||
option WRITE_INTERLACING requires WRITE
|
||||
|
||||
# The following is no longer implemented:
|
||||
option WRITE_WEIGHTED_FILTER requires WRITE
|
||||
@ -998,7 +992,7 @@ option SIMPLIFIED_READ,
|
||||
READ_RGB_TO_GRAY, READ_ALPHA_MODE, READ_BACKGROUND, READ_STRIP_ALPHA,
|
||||
READ_FILLER, READ_SWAP, READ_PACK, READ_GRAY_TO_RGB, READ_GAMMA,
|
||||
READ_tRNS, READ_bKGD, READ_gAMA, READ_cHRM, READ_sRGB, READ_sBIT,
|
||||
READ_DEINTERLACE
|
||||
READ_INTERLACING
|
||||
|
||||
# AFIRST and BGR read options:
|
||||
# Prior to libpng 1.6.8 these were disabled but switched on if the low level
|
||||
|
||||
@ -53,7 +53,6 @@
|
||||
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||
#define PNG_READ_DEINTERLACE_SUPPORTED
|
||||
#define PNG_READ_EXPAND_16_SUPPORTED
|
||||
#define PNG_READ_EXPAND_SUPPORTED
|
||||
#define PNG_READ_FILLER_SUPPORTED
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user