Create rpng_nbio_is_valid

This commit is contained in:
twinaphex 2015-09-01 12:39:17 +02:00
parent 0676738140
commit 09aac8a320
3 changed files with 14 additions and 3 deletions

View File

@ -248,3 +248,14 @@ bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng)
return true;
}
bool rpng_nbio_is_valid(struct rpng_t *rpng)
{
if (rpng->has_ihdr)
return true;
if (rpng->has_idat)
return true;
if (rpng->has_iend)
return true;
return false;
}

View File

@ -105,6 +105,8 @@ bool rpng_load_image_argb(const char *path, uint32_t **data,
struct rpng_t *rpng_nbio_load_image_argb_init(const char *path);
bool rpng_nbio_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,

View File

@ -185,9 +185,7 @@ static int cb_image_menu_generic(nbio_handle_t *nbio)
if (!nbio)
return -1;
if ( !nbio->image.handle->has_ihdr ||
!nbio->image.handle->has_idat ||
!nbio->image.handle->has_iend)
if (!rpng_nbio_is_valid(nbio->image.handle))
return -1;
retval = rpng_nbio_load_image_argb_process(nbio->image.handle,