mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Updated libpng to current version.
This commit is contained in:
parent
bd2a951314
commit
ca7007613d
1 changed files with 286 additions and 287 deletions
|
@ -21,7 +21,7 @@ static void user_read_fn (png_structp png_ptr, png_bytep data, png_size_t length
|
|||
|
||||
// Read() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
// instead of an int, which is what Read() actually returns.
|
||||
check = (png_size_t)((File*)png_ptr->io_ptr)->Read (data, length);
|
||||
check = (png_size_t)((File*)png_get_io_ptr(png_ptr))->Read(data, length);
|
||||
|
||||
if (check != length)
|
||||
png_error(png_ptr, "Read Error");
|
||||
|
@ -61,7 +61,7 @@ bool Image::LoadPNG (File& file)
|
|||
return false; // out of memory
|
||||
}
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return false;
|
||||
|
@ -72,10 +72,9 @@ bool Image::LoadPNG (File& file)
|
|||
png_set_sig_bytes(png_ptr, 8); // we already read the 8 signature bytes
|
||||
|
||||
png_read_info(png_ptr, info_ptr); // read all PNG info up to image data
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
|
||||
NULL, NULL, NULL);
|
||||
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL);
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return false;
|
||||
|
@ -85,7 +84,7 @@ bool Image::LoadPNG (File& file)
|
|||
{
|
||||
png_get_bKGD(png_ptr, info_ptr, &pBackground);
|
||||
|
||||
if (setjmp (png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return false;
|
||||
|
@ -117,7 +116,7 @@ bool Image::LoadPNG (File& file)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (setjmp (png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
return false;
|
||||
|
@ -263,7 +262,7 @@ static void user_write_fn (png_structp png_ptr, png_bytep data, png_size_t lengt
|
|||
{
|
||||
png_uint_32 check;
|
||||
|
||||
check = ((File*)png_ptr->io_ptr)->Write (data, length);
|
||||
check = ((File*)png_get_io_ptr(png_ptr))->Write(data, length);
|
||||
if (check != length)
|
||||
{
|
||||
png_error(png_ptr, "Write Error");
|
||||
|
@ -272,7 +271,7 @@ static void user_write_fn (png_structp png_ptr, png_bytep data, png_size_t lengt
|
|||
|
||||
static void user_flush_fn(png_structp png_ptr)
|
||||
{
|
||||
((File*)png_ptr->io_ptr)->Flush ();
|
||||
((File*)png_get_io_ptr(png_ptr))->Flush();
|
||||
}
|
||||
|
||||
bool Image::SavePNG(File& file, bool transparent, bool interlaced, unsigned char* background) const
|
||||
|
@ -295,7 +294,7 @@ bool Image::SavePNG (File& file, bool transparent, bool interlaced, unsigned cha
|
|||
return false;
|
||||
}
|
||||
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp)NULL);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue