mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 18:58:21 +00:00
(rpng) Encapsulate incrementation of buffer position
This commit is contained in:
parent
3762502112
commit
cd79143038
@ -98,9 +98,10 @@ static bool png_read_plte_into_buf(uint8_t *buf,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng, unsigned *ret)
|
||||
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned ret;
|
||||
|
||||
struct png_chunk chunk = {0};
|
||||
|
||||
@ -181,7 +182,8 @@ bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng, unsign
|
||||
goto error;
|
||||
}
|
||||
|
||||
*ret = 4 + 4 + chunk.size + 4;
|
||||
ret = 4 + 4 + chunk.size + 4;
|
||||
rpng->buff_data += ret;
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -46,7 +46,6 @@ static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
||||
bool ret = true;
|
||||
struct rpng_t *rpng = NULL;
|
||||
void *ptr = NULL;
|
||||
unsigned val = 0;
|
||||
struct nbio_t* handle = (void*)nbio_open(path, NBIO_READ);
|
||||
|
||||
if (!handle)
|
||||
@ -89,10 +88,7 @@ static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
||||
}
|
||||
|
||||
while (rpng_nbio_load_image_argb_iterate(
|
||||
rpng->buff_data, rpng, &val))
|
||||
{
|
||||
rpng->buff_data += val;
|
||||
}
|
||||
rpng->buff_data, rpng));
|
||||
|
||||
#if 0
|
||||
fprintf(stderr, "has_ihdr: %d\n", rpng->has_ihdr);
|
||||
|
@ -110,7 +110,7 @@ bool rpng_is_valid(struct rpng_t *rpng);
|
||||
void rpng_nbio_load_image_free(struct rpng_t *rpng);
|
||||
|
||||
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf,
|
||||
struct rpng_t *rpng, unsigned *ret);
|
||||
struct rpng_t *rpng);
|
||||
|
||||
int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||
uint32_t **data, unsigned *width, unsigned *height);
|
||||
|
@ -263,13 +263,10 @@ static int rarch_main_data_image_iterate_transfer(nbio_handle_t *nbio)
|
||||
|
||||
for (i = 0; i < nbio->image.pos_increment; i++)
|
||||
{
|
||||
unsigned ret;
|
||||
if (!rpng_nbio_load_image_argb_iterate(
|
||||
nbio->image.handle->buff_data,
|
||||
nbio->image.handle, &ret))
|
||||
nbio->image.handle))
|
||||
goto error;
|
||||
|
||||
nbio->image.handle->buff_data += ret;
|
||||
}
|
||||
|
||||
nbio->image.frame_count++;
|
||||
|
Loading…
Reference in New Issue
Block a user