mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Split up deinit code from png_reverse_filter
This commit is contained in:
parent
ef09b9a855
commit
3fc262ecac
@ -124,7 +124,6 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
unsigned i;
|
||||
bool ret = true;
|
||||
|
||||
for (; pngp->h < ihdr->height;
|
||||
pngp->h++, pngp->inflate_buf += pngp->pitch, data += ihdr->width)
|
||||
@ -173,7 +172,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
break;
|
||||
|
||||
default:
|
||||
GOTO_END_ERROR();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ihdr->color_type == 0)
|
||||
@ -192,9 +191,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
memcpy(pngp->prev_scanline, pngp->decoded_scanline, pngp->pitch);
|
||||
}
|
||||
|
||||
end:
|
||||
png_reverse_filter_deinit(pngp);
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool png_reverse_filter_adam7(uint32_t *data,
|
||||
@ -213,6 +210,7 @@ static bool png_reverse_filter_adam7(uint32_t *data,
|
||||
|
||||
for (; pngp->pass < ARRAY_SIZE(passes); pngp->pass++)
|
||||
{
|
||||
bool ret = true;
|
||||
unsigned pass_width, pass_height;
|
||||
struct png_ihdr tmp_ihdr;
|
||||
uint32_t *tmp_data = NULL;
|
||||
@ -245,8 +243,12 @@ static bool png_reverse_filter_adam7(uint32_t *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!png_reverse_filter(tmp_data,
|
||||
&tmp_ihdr, pngp))
|
||||
ret = png_reverse_filter(tmp_data,
|
||||
&tmp_ihdr, pngp);
|
||||
|
||||
png_reverse_filter_deinit(pngp);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
free(tmp_data);
|
||||
return false;
|
||||
|
@ -353,8 +353,13 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
|
||||
&rpng.ihdr, &pngp))
|
||||
GOTO_END_ERROR();
|
||||
}
|
||||
else if (!png_reverse_filter(*data,
|
||||
&rpng.ihdr, &pngp))
|
||||
else
|
||||
ret = png_reverse_filter(*data,
|
||||
&rpng.ihdr, &pngp);
|
||||
|
||||
png_reverse_filter_deinit(&pngp);
|
||||
|
||||
if (!ret)
|
||||
GOTO_END_ERROR();
|
||||
|
||||
end:
|
||||
|
@ -257,6 +257,7 @@ bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng)
|
||||
bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||
uint32_t **data, unsigned *width, unsigned *height)
|
||||
{
|
||||
bool ret = true;
|
||||
struct rpng_process_t pngp = {0};
|
||||
z_stream stream = {0};
|
||||
|
||||
@ -313,11 +314,13 @@ bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!png_reverse_filter(*data,
|
||||
&rpng->ihdr, &pngp))
|
||||
return false;
|
||||
}
|
||||
ret = png_reverse_filter(*data,
|
||||
&rpng->ihdr, &pngp);
|
||||
|
||||
png_reverse_filter_deinit(&pngp);
|
||||
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user