(rpng) Cleanups

This commit is contained in:
Twinaphex 2015-09-06 13:02:44 +02:00
parent 3d219c14d1
commit 8d2eceaa22
8 changed files with 28 additions and 30 deletions

View File

@ -571,8 +571,7 @@ static int png_reverse_filter_adam7(uint32_t **data_,
return ret;
}
int png_reverse_filter_iterate(struct rpng_t *rpng,
uint32_t **data)
int png_reverse_filter_iterate(rpng_t *rpng, uint32_t **data)
{
if (!rpng)
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);
}
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)
{
int zstatus;
@ -669,7 +668,7 @@ bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf)
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)
{
rpng->process.inflate_buf_size = 0;

View File

@ -40,10 +40,9 @@ bool png_read_plte(uint8_t *buf,
bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf);
int png_reverse_filter_iterate(struct rpng_t *rpng,
uint32_t **data);
int png_reverse_filter_iterate(rpng_t *rpng, 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);
#endif

View File

@ -97,7 +97,7 @@ static bool png_parse_ihdr_fio(FILE **fd,
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};
FILE *file = *fd;
@ -200,7 +200,7 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
long pos, file_len;
FILE *file;
char header[8] = {0};
struct rpng_t rpng = {{0}};
rpng_t rpng = {{0}};
bool ret = true;
int retval = 0;

View File

@ -132,7 +132,7 @@ struct rpng_process_t
zlib_file_handle_t handle;
};
struct rpng_t
struct rpng
{
struct rpng_process_t process;
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);
}
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);
#endif

View File

@ -66,7 +66,7 @@ static bool png_parse_ihdr(uint8_t *buf,
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 ret;
@ -165,7 +165,7 @@ error:
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)
{
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);
}
void rpng_nbio_load_image_free(struct rpng_t *rpng)
void rpng_nbio_load_image_free(rpng_t *rpng)
{
if (!rpng)
return;
@ -206,7 +206,7 @@ void rpng_nbio_load_image_free(struct rpng_t *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;
char header[8] = {0};
@ -225,7 +225,7 @@ bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
return true;
}
bool rpng_is_valid(struct rpng_t *rpng)
bool rpng_is_valid(rpng_t *rpng)
{
if (!rpng)
return false;
@ -239,7 +239,7 @@ bool rpng_is_valid(struct rpng_t *rpng)
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)
return false;
@ -249,9 +249,9 @@ bool rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data)
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)
return NULL;
return rpng;

View File

@ -44,7 +44,7 @@ static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
int retval;
size_t file_len;
bool ret = true;
struct rpng_t *rpng = NULL;
rpng_t *rpng = NULL;
void *ptr = NULL;
struct nbio_t* handle = (void*)nbio_open(path, NBIO_READ);

View File

@ -33,27 +33,27 @@
extern "C" {
#endif
struct rpng_t;
typedef struct rpng rpng_t;
bool rpng_load_image_argb(const char *path, uint32_t **data,
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);
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
bool rpng_save_image_argb(const char *path, const uint32_t *data,

View File

@ -56,7 +56,7 @@ typedef struct nbio_image_handle
bool is_finished;
transfer_cb_t cb;
#ifdef HAVE_RPNG
struct rpng_t *handle;
rpng_t *handle;
#endif
unsigned processing_pos_increment;
unsigned pos_increment;