mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-13 22:31:57 +00:00
Create palette in rpng_process_t
This commit is contained in:
parent
c97096287d
commit
93706c67e8
libretro-common
@ -90,8 +90,7 @@ static void deinterlace_pass(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
}
|
||||
|
||||
static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp,
|
||||
const uint32_t *palette)
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
unsigned i, h;
|
||||
unsigned bpp;
|
||||
@ -166,7 +165,7 @@ static bool png_reverse_filter(uint32_t *data, const struct png_ihdr *ihdr,
|
||||
copy_line_rgb(data, decoded_scanline, ihdr->width, ihdr->depth);
|
||||
else if (ihdr->color_type == 3)
|
||||
copy_line_plt(data, decoded_scanline, ihdr->width,
|
||||
ihdr->depth, palette);
|
||||
ihdr->depth, pngp->palette);
|
||||
else if (ihdr->color_type == 4)
|
||||
copy_line_gray_alpha(data, decoded_scanline, ihdr->width,
|
||||
ihdr->depth);
|
||||
@ -184,8 +183,7 @@ end:
|
||||
|
||||
static bool png_reverse_filter_adam7(uint32_t *data,
|
||||
const struct png_ihdr *ihdr,
|
||||
struct rpng_process_t *pngp,
|
||||
const uint32_t *palette)
|
||||
struct rpng_process_t *pngp)
|
||||
{
|
||||
unsigned pass;
|
||||
static const struct adam7_pass passes[] = {
|
||||
@ -234,7 +232,7 @@ static bool png_reverse_filter_adam7(uint32_t *data,
|
||||
}
|
||||
|
||||
if (!png_reverse_filter(tmp_data,
|
||||
&tmp_ihdr, pngp, palette))
|
||||
&tmp_ihdr, pngp))
|
||||
{
|
||||
free(tmp_data);
|
||||
return false;
|
||||
|
@ -340,15 +340,16 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
|
||||
|
||||
process.total_out = stream.total_out;
|
||||
process.inflate_buf = rpng.inflate_buf;
|
||||
process.palette = rpng.palette;
|
||||
|
||||
if (rpng.ihdr.interlace == 1)
|
||||
{
|
||||
if (!png_reverse_filter_adam7(*data,
|
||||
&rpng.ihdr, &process, rpng.palette))
|
||||
&rpng.ihdr, &process))
|
||||
GOTO_END_ERROR();
|
||||
}
|
||||
else if (!png_reverse_filter(*data,
|
||||
&rpng.ihdr, &process, rpng.palette))
|
||||
&rpng.ihdr, &process))
|
||||
GOTO_END_ERROR();
|
||||
|
||||
end:
|
||||
|
@ -299,15 +299,16 @@ bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||
|
||||
process.total_out = stream.total_out;
|
||||
process.inflate_buf = rpng->inflate_buf;
|
||||
process.palette = rpng->palette;
|
||||
|
||||
if (rpng->ihdr.interlace == 1)
|
||||
{
|
||||
if (!png_reverse_filter_adam7(*data,
|
||||
&rpng->ihdr, &process, rpng->palette))
|
||||
&rpng->ihdr, &process))
|
||||
return false;
|
||||
}
|
||||
else if (!png_reverse_filter(*data,
|
||||
&rpng->ihdr, &process, rpng->palette))
|
||||
&rpng->ihdr, &process))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -63,6 +63,7 @@ struct png_ihdr
|
||||
struct rpng_process_t
|
||||
{
|
||||
const uint8_t *inflate_buf;
|
||||
const uint32_t *palette;
|
||||
size_t total_out;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user