mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
(RPNG) Create png_reverse_filter_iterate
This commit is contained in:
parent
6506f6ce85
commit
a7e761c0d1
@ -390,31 +390,42 @@ static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *i
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool png_reverse_filter_iterate(uint32_t *data, const struct png_ihdr *ihdr,
|
||||||
|
struct rpng_process_t *pngp)
|
||||||
|
{
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
|
if (pngp->h < ihdr->height)
|
||||||
|
{
|
||||||
|
unsigned filter = *pngp->inflate_buf++;
|
||||||
|
pngp->restore_buf_size += 1;
|
||||||
|
ret = png_reverse_filter_copy_line(data,
|
||||||
|
ihdr, pngp, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == 1 || ret == -1)
|
||||||
|
{
|
||||||
|
png_reverse_filter_deinit(pngp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
pngp->h++;
|
||||||
|
pngp->inflate_buf += pngp->pitch;
|
||||||
|
pngp->restore_buf_size += pngp->pitch;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool png_reverse_filter_regular(uint32_t *data, const struct png_ihdr *ihdr,
|
static bool png_reverse_filter_regular(uint32_t *data, const struct png_ihdr *ihdr,
|
||||||
struct rpng_process_t *pngp)
|
struct rpng_process_t *pngp)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
do{
|
do{
|
||||||
ret = 1;
|
ret = png_reverse_filter_iterate(data, ihdr, pngp);
|
||||||
|
|
||||||
if (pngp->h < ihdr->height)
|
if (ret != 0)
|
||||||
{
|
|
||||||
unsigned filter = *pngp->inflate_buf++;
|
|
||||||
pngp->restore_buf_size += 1;
|
|
||||||
ret = png_reverse_filter_copy_line(data,
|
|
||||||
ihdr, pngp, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == 1 || ret == -1)
|
|
||||||
{
|
|
||||||
png_reverse_filter_deinit(pngp);
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
pngp->h++;
|
|
||||||
pngp->inflate_buf += pngp->pitch;
|
|
||||||
pngp->restore_buf_size += pngp->pitch;
|
|
||||||
data += ihdr->width;
|
data += ihdr->width;
|
||||||
}while(1);
|
}while(1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user