Create rpng_set_buf_ptr

This commit is contained in:
twinaphex 2015-09-01 13:00:02 +02:00
parent d5837f4b7c
commit 511b2c6d83
3 changed files with 14 additions and 0 deletions

View File

@ -254,6 +254,9 @@ bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
bool rpng_is_valid(struct rpng_t *rpng)
{
if (!rpng)
return false;
if (rpng->has_ihdr)
return true;
if (rpng->has_idat)
@ -262,3 +265,11 @@ bool rpng_is_valid(struct rpng_t *rpng)
return true;
return false;
}
void rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data)
{
if (!rpng)
return false;
rpng->buff_data = data;
}

View File

@ -107,6 +107,8 @@ struct rpng_t *rpng_nbio_load_image_argb_init(const char *path);
bool rpng_is_valid(struct rpng_t *rpng);
void rpng_set_buf_ptr(struct rpng_t *rpng, uint8_t *data);
void rpng_nbio_load_image_free(struct rpng_t *rpng);
bool rpng_nbio_load_image_argb_iterate(struct rpng_t *rpng);

View File

@ -434,6 +434,7 @@ static int cb_nbio_generic(nbio_handle_t *nbio, size_t *len)
return -1;
}
rpng_set_buf_ptr(nbio->image.handle, (uint8_t*)ptr);
nbio->image.handle->buff_data = (uint8_t*)ptr;
nbio->image.pos_increment = (*len / 2) ? (*len / 2) : 1;
nbio->image.processing_pos_increment = (*len / 4) ? (*len / 4) : 1;