mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
(rpng) Cleanups
This commit is contained in:
parent
3d219c14d1
commit
8d2eceaa22
8 changed files with 28 additions and 30 deletions
|
@ -571,8 +571,7 @@ static int png_reverse_filter_adam7(uint32_t **data_,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int png_reverse_filter_iterate(struct rpng_t *rpng,
|
int png_reverse_filter_iterate(rpng_t *rpng, uint32_t **data)
|
||||||
uint32_t **data)
|
|
||||||
{
|
{
|
||||||
if (!rpng)
|
if (!rpng)
|
||||||
return false;
|
return false;
|
||||||
|
@ -583,7 +582,7 @@ int png_reverse_filter_iterate(struct rpng_t *rpng,
|
||||||
return png_reverse_filter_regular_iterate(data, &rpng->ihdr, &rpng->process);
|
return png_reverse_filter_regular_iterate(data, &rpng->ihdr, &rpng->process);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rpng_load_image_argb_process_inflate_init(struct rpng_t *rpng,
|
int rpng_load_image_argb_process_inflate_init(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height)
|
uint32_t **data, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
int zstatus;
|
int zstatus;
|
||||||
|
@ -669,7 +668,7 @@ bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_load_image_argb_process_init(struct rpng_t *rpng,
|
bool rpng_load_image_argb_process_init(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height)
|
uint32_t **data, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
rpng->process.inflate_buf_size = 0;
|
rpng->process.inflate_buf_size = 0;
|
||||||
|
|
|
@ -40,10 +40,9 @@ bool png_read_plte(uint8_t *buf,
|
||||||
|
|
||||||
bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf);
|
bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf);
|
||||||
|
|
||||||
int png_reverse_filter_iterate(struct rpng_t *rpng,
|
int png_reverse_filter_iterate(rpng_t *rpng, uint32_t **data);
|
||||||
uint32_t **data);
|
|
||||||
|
|
||||||
bool rpng_load_image_argb_process_init(struct rpng_t *rpng,
|
bool rpng_load_image_argb_process_init(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height);
|
uint32_t **data, unsigned *width, unsigned *height);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -97,7 +97,7 @@ static bool png_parse_ihdr_fio(FILE **fd,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_load_image_argb_iterate(FILE **fd, struct rpng_t *rpng)
|
bool rpng_load_image_argb_iterate(FILE **fd, rpng_t *rpng)
|
||||||
{
|
{
|
||||||
struct png_chunk chunk = {0};
|
struct png_chunk chunk = {0};
|
||||||
FILE *file = *fd;
|
FILE *file = *fd;
|
||||||
|
@ -200,7 +200,7 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
|
||||||
long pos, file_len;
|
long pos, file_len;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char header[8] = {0};
|
char header[8] = {0};
|
||||||
struct rpng_t rpng = {{0}};
|
rpng_t rpng = {{0}};
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ struct rpng_process_t
|
||||||
zlib_file_handle_t handle;
|
zlib_file_handle_t handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rpng_t
|
struct rpng
|
||||||
{
|
{
|
||||||
struct rpng_process_t process;
|
struct rpng_process_t process;
|
||||||
bool has_ihdr;
|
bool has_ihdr;
|
||||||
|
@ -165,7 +165,7 @@ static INLINE uint32_t dword_be(const uint8_t *buf)
|
||||||
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
|
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rpng_load_image_argb_process_inflate_init(struct rpng_t *rpng,
|
int rpng_load_image_argb_process_inflate_init(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height);
|
uint32_t **data, unsigned *width, unsigned *height);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -66,7 +66,7 @@ static bool png_parse_ihdr(uint8_t *buf,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_iterate(struct rpng_t *rpng)
|
bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned ret;
|
unsigned ret;
|
||||||
|
@ -165,7 +165,7 @@ error:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height)
|
uint32_t **data, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
if (!rpng->process.initialized)
|
if (!rpng->process.initialized)
|
||||||
|
@ -188,7 +188,7 @@ int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||||
return png_reverse_filter_iterate(rpng, data);
|
return png_reverse_filter_iterate(rpng, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpng_nbio_load_image_free(struct rpng_t *rpng)
|
void rpng_nbio_load_image_free(rpng_t *rpng)
|
||||||
{
|
{
|
||||||
if (!rpng)
|
if (!rpng)
|
||||||
return;
|
return;
|
||||||
|
@ -206,7 +206,7 @@ void rpng_nbio_load_image_free(struct rpng_t *rpng)
|
||||||
free(rpng);
|
free(rpng);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
|
bool rpng_nbio_load_image_argb_start(rpng_t *rpng)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char header[8] = {0};
|
char header[8] = {0};
|
||||||
|
@ -225,7 +225,7 @@ bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_is_valid(struct rpng_t *rpng)
|
bool rpng_is_valid(rpng_t *rpng)
|
||||||
{
|
{
|
||||||
if (!rpng)
|
if (!rpng)
|
||||||
return false;
|
return false;
|
||||||
|
@ -239,7 +239,7 @@ bool rpng_is_valid(struct rpng_t *rpng)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data)
|
bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data)
|
||||||
{
|
{
|
||||||
if (!rpng)
|
if (!rpng)
|
||||||
return false;
|
return false;
|
||||||
|
@ -249,9 +249,9 @@ bool rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rpng_t *rpng_alloc(void)
|
rpng_t *rpng_alloc(void)
|
||||||
{
|
{
|
||||||
struct rpng_t *rpng = (struct rpng_t*)calloc(1, sizeof(struct rpng_t));
|
rpng_t *rpng = (rpng_t*)calloc(1, sizeof(rpng_t));
|
||||||
if (!rpng)
|
if (!rpng)
|
||||||
return NULL;
|
return NULL;
|
||||||
return rpng;
|
return rpng;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
||||||
int retval;
|
int retval;
|
||||||
size_t file_len;
|
size_t file_len;
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
struct rpng_t *rpng = NULL;
|
rpng_t *rpng = NULL;
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
struct nbio_t* handle = (void*)nbio_open(path, NBIO_READ);
|
struct nbio_t* handle = (void*)nbio_open(path, NBIO_READ);
|
||||||
|
|
||||||
|
|
|
@ -33,27 +33,27 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct rpng_t;
|
typedef struct rpng rpng_t;
|
||||||
|
|
||||||
bool rpng_load_image_argb(const char *path, uint32_t **data,
|
bool rpng_load_image_argb(const char *path, uint32_t **data,
|
||||||
unsigned *width, unsigned *height);
|
unsigned *width, unsigned *height);
|
||||||
|
|
||||||
struct rpng_t *rpng_nbio_load_image_argb_init(const char *path);
|
rpng_t *rpng_nbio_load_image_argb_init(const char *path);
|
||||||
|
|
||||||
bool rpng_is_valid(struct rpng_t *rpng);
|
bool rpng_is_valid(rpng_t *rpng);
|
||||||
|
|
||||||
bool rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data);
|
bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data);
|
||||||
|
|
||||||
struct rpng_t *rpng_alloc(void);
|
rpng_t *rpng_alloc(void);
|
||||||
|
|
||||||
void rpng_nbio_load_image_free(struct rpng_t *rpng);
|
void rpng_nbio_load_image_free(rpng_t *rpng);
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_iterate(struct rpng_t *rpng);
|
bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng);
|
||||||
|
|
||||||
int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
int rpng_nbio_load_image_argb_process(rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height);
|
uint32_t **data, unsigned *width, unsigned *height);
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng);
|
bool rpng_nbio_load_image_argb_start(rpng_t *rpng);
|
||||||
|
|
||||||
#ifdef HAVE_ZLIB_DEFLATE
|
#ifdef HAVE_ZLIB_DEFLATE
|
||||||
bool rpng_save_image_argb(const char *path, const uint32_t *data,
|
bool rpng_save_image_argb(const char *path, const uint32_t *data,
|
||||||
|
|
|
@ -56,7 +56,7 @@ typedef struct nbio_image_handle
|
||||||
bool is_finished;
|
bool is_finished;
|
||||||
transfer_cb_t cb;
|
transfer_cb_t cb;
|
||||||
#ifdef HAVE_RPNG
|
#ifdef HAVE_RPNG
|
||||||
struct rpng_t *handle;
|
rpng_t *handle;
|
||||||
#endif
|
#endif
|
||||||
unsigned processing_pos_increment;
|
unsigned processing_pos_increment;
|
||||||
unsigned pos_increment;
|
unsigned pos_increment;
|
||||||
|
|
Loading…
Add table
Reference in a new issue