mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
(RPNG) More cleanups
This commit is contained in:
parent
a14850c915
commit
cb9c0828db
@ -595,31 +595,24 @@ bool png_reverse_filter_loop(struct rpng_t *rpng,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
const struct png_ihdr *ihdr = NULL;
|
const struct png_ihdr *ihdr = NULL;
|
||||||
struct rpng_process_t *pngp = NULL;
|
struct rpng_process_t *pngp = NULL;
|
||||||
rpng->process.adam7_restore_buf_size = 0;
|
|
||||||
rpng->process.restore_buf_size = 0;
|
if (!rpng)
|
||||||
rpng->process.palette = rpng->palette;
|
return false;
|
||||||
|
|
||||||
ihdr = &rpng->ihdr;
|
ihdr = &rpng->ihdr;
|
||||||
pngp = &rpng->process;
|
pngp = &rpng->process;
|
||||||
|
|
||||||
if (ihdr->interlace == 1)
|
if (!ihdr || !pngp)
|
||||||
{
|
return false;
|
||||||
do
|
|
||||||
{
|
|
||||||
ret = png_reverse_filter_adam7(data,
|
|
||||||
ihdr, pngp);
|
|
||||||
}while(ret == PNG_PROCESS_NEXT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (png_reverse_filter_init(ihdr, pngp) == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
do{
|
do
|
||||||
|
{
|
||||||
|
if (ihdr->interlace)
|
||||||
|
ret = png_reverse_filter_adam7(data, ihdr, pngp);
|
||||||
|
else
|
||||||
ret = png_reverse_filter_regular_loop(data,
|
ret = png_reverse_filter_regular_loop(data,
|
||||||
ihdr, pngp);
|
ihdr, pngp);
|
||||||
}while(ret == PNG_PROCESS_NEXT);
|
}while(ret == PNG_PROCESS_NEXT);
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == PNG_PROCESS_ERROR || ret == PNG_PROCESS_ERROR_END)
|
if (ret == PNG_PROCESS_ERROR || ret == PNG_PROCESS_ERROR_END)
|
||||||
return false;
|
return false;
|
||||||
@ -670,5 +663,13 @@ bool rpng_load_image_argb_process_init(struct rpng_t *rpng,
|
|||||||
if (!*data)
|
if (!*data)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
rpng->process.adam7_restore_buf_size = 0;
|
||||||
|
rpng->process.restore_buf_size = 0;
|
||||||
|
rpng->process.palette = rpng->palette;
|
||||||
|
|
||||||
|
if (rpng->ihdr.interlace != 1)
|
||||||
|
if (png_reverse_filter_init(&rpng->ihdr, &rpng->process) == -1)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user