diff --git a/makefile b/makefile index b8a12b5d7..9d28c5641 100644 --- a/makefile +++ b/makefile @@ -13,7 +13,7 @@ RANLIB=echo prefix=/usr/local OBJS = png.o pngrcb.o pngrutil.o pngtrans.o pngwutil.o \ - pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o + pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngwtran.o pngmem.o pngerror.o pngpread.o all: libpng.a pngtest diff --git a/makefile.aco b/makefile.aco index 2d8d408af..6ae1b8e4d 100644 --- a/makefile.aco +++ b/makefile.aco @@ -1,3 +1,4 @@ +# makefile for libpng on Acorn RISCOS # Project: libpng diff --git a/makefile.gcc b/makefile.dj2 similarity index 96% rename from makefile.gcc rename to makefile.dj2 index afc792371..495c0c600 100644 --- a/makefile.gcc +++ b/makefile.dj2 @@ -1,4 +1,4 @@ -# gcc/DOS makefile for libpng +# DJGPP (DOS gcc) makefile for libpng # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # For conditions of distribution and use, see copyright notice in png.h diff --git a/png.h b/png.h index c17d7863f..53aea082c 100644 --- a/png.h +++ b/png.h @@ -5,15 +5,16 @@ May 25, 1996 Note: This is a beta version. It reads and writes valid files - on the platforms I have, but it has had limited portability - testing. Furthermore, you may have to modify the - includes below to get it to work on your system, and you - may have to supply the correct compiler flags in the makefile. - Read the readme.txt for more information, and how to contact - me if you have any problems, or if you want your compiler/ - platform to be supported in the next official libpng release. + on the platforms I have, and has had a wide testing program. + You may have to modify the includes below to get it to work on + your system, and you may have to supply the correct compiler + flags in the makefile, if you can't find a makefile suitable for + your operating system/compiler combination. Read the libpng.txt + for more information, and how to contact me if you have any + problems, or if you want your compiler/platform to be supported + in the next official libpng release. - See readme.txt for more information + See libpng.txt for more information Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Contributing Authors: @@ -33,17 +34,18 @@ and Group 42, Inc. disclaim all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. The Contributing Authors and Group 42, Inc. - assume no liability for damages, direct or consequential, which may - result from the use of the PNG Reference Library. + assume no liability for direct, indirect, incidental, special, exemplary, + or consequential damages, which may result from the use of the PNG + Reference Library, even if advised of the possibility of such damage. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: 1. The origin of this source code must not be misrepresented. 2. Altered versions must be plainly marked as such and must not be - misrepresented as being the original source. + misrepresented as being the original source. 3. This Copyright notice may not be removed or altered from any source or - altered source distribution. + altered source distribution. The Contributing Authors and Group 42, Inc. specifically permit, without fee, and encourage the use of this source code as a component to @@ -763,7 +765,7 @@ extern void * png_realloc PNGARG((png_structp png_ptr, void * ptr, extern void png_free PNGARG((png_structp png_ptr, void * ptr)); /* allocate memory for an internal libpng struct */ -extern voidp png_create_struct PNGARG((uInt type)); +extern png_voidp png_create_struct PNGARG((uInt type)); /* free memory from internal libpng struct */ extern void png_destroy_struct PNGARG((voidp struct_ptr)); diff --git a/pngmem.c b/pngmem.c index d3fc99170..60645f0a9 100644 --- a/pngmem.c +++ b/pngmem.c @@ -221,7 +221,7 @@ png_create_struct(uInt type) if ((struct_ptr = (png_voidp)farmalloc(size)) != NULL) #else # if defined(_MSC_VER) && defined(MAXSEG_64K) - if ((struct_ptr = (png_voidp)halloc(size)) != NULL) + if ((struct_ptr = (png_voidp)halloc(size,1)) != NULL) # else if ((struct_ptr = (png_voidp)malloc(size)) != NULL) # endif diff --git a/pngtest.png b/pngtest.png index fc40f5ff8..69383a6b6 100644 Binary files a/pngtest.png and b/pngtest.png differ diff --git a/pngtodo.txt b/pngtodo.txt index 3423f527e..8b8089b72 100644 --- a/pngtodo.txt +++ b/pngtodo.txt @@ -8,8 +8,6 @@ for 0.9 after 1.0 overlaying one image on top of another - make pull reader use push reader internally to reduce code, and - increase amount of image read in an error situation optional palette creation histogram creation text conversion between different code types diff --git a/pngwrite.c b/pngwrite.c index fd68e7a2a..338c369c3 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -409,16 +409,6 @@ png_write_row(png_structp png_ptr, png_bytep row) /* find a filter if necessary, filter the row and write it out */ png_write_find_filter(png_ptr, &(png_ptr->row_info)); - - /* trade current and prev rows so next filter references are correct */ - if (png_ptr->prev_row) - { - png_bytep tptr; - - tptr = png_ptr->prev_row; - png_ptr->prev_row = png_ptr->row_buf; - png_ptr->row_buf = tptr; - } } #if defined(PNG_WRITE_FLUSH_SUPPORTED) diff --git a/pngwutil.c b/pngwutil.c index 5ca26ef8a..c9821bc85 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -912,6 +912,7 @@ png_write_finish_row(png_structp png_ptr) /* next row */ png_ptr->row_number++; + /* see if we are done */ if (png_ptr->row_number < png_ptr->num_rows) return; @@ -947,13 +948,15 @@ png_write_finish_row(png_structp png_ptr) } /* reset the row above the image for the next pass */ - if (png_ptr->prev_row) - png_memset(png_ptr->prev_row, 0, (((png_uint_32)png_ptr->usr_channels * - (png_uint_32)png_ptr->usr_bit_depth * png_ptr->width + 7) >> 3) + 1); - - /* if we have more data to get, go get it */ if (png_ptr->pass < 7) + { + if (png_ptr->prev_row) + png_memset(png_ptr->prev_row, 0, + (((png_uint_32)png_ptr->usr_channels * + (png_uint_32)png_ptr->usr_bit_depth * + png_ptr->width + 7) >> 3) + 1); return; + } } /* if we get here, we've just written the last row, so we need @@ -1345,6 +1348,16 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) /* repeat until all data has been compressed */ } while (png_ptr->zstream->avail_in); + /* swap the current and previous rows */ + if (png_ptr->prev_row) + { + png_bytep tptr; + + tptr = png_ptr->prev_row; + png_ptr->prev_row = png_ptr->row_buf; + png_ptr->row_buf = tptr; + } + /* finish row - updates counters and flushes zlib if last row */ png_write_finish_row(png_ptr);