simplify
This commit is contained in:
@@ -14,12 +14,6 @@
|
|||||||
#include <png.h>
|
#include <png.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* The png_jmpbuf() macro, used in error handling, became available in
|
|
||||||
* libpng version 1.0.6. If you want to be able to run your code with older
|
|
||||||
* versions of libpng, you must define the macro yourself (but only if it
|
|
||||||
* is not already defined by libpng!).
|
|
||||||
*/
|
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
#define png_jmpbuf(png) ((png)->jmpbuf)
|
#define png_jmpbuf(png) ((png)->jmpbuf)
|
||||||
#endif
|
#endif
|
||||||
@@ -207,16 +201,10 @@ static SDL_Surface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro
|
|||||||
}
|
}
|
||||||
ASSERT( img );
|
ASSERT( img );
|
||||||
|
|
||||||
/* alloca to prevent memleaks if libpng longjmps us */
|
png_byte *pixels = (png_byte *) img->pixels;
|
||||||
png_byte **row_pointers = (png_byte **) alloca( sizeof(png_byte*) * height );
|
|
||||||
|
|
||||||
for( unsigned y = 0; y < height; ++y )
|
for( unsigned y = 0; y < height; ++y )
|
||||||
{
|
png_read_row( png, pixels + img->pitch*y, NULL );
|
||||||
png_byte *p = (png_byte *) img->pixels;
|
|
||||||
row_pointers[y] = p + img->pitch*y;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_read_image( png, row_pointers );
|
|
||||||
png_read_end( png, info_ptr );
|
png_read_end( png, info_ptr );
|
||||||
png_destroy_read_struct( &png, &info_ptr, png_infopp_NULL );
|
png_destroy_read_struct( &png, &info_ptr, png_infopp_NULL );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user