mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
Move rpng_nbio wrapper function to rpng_test.c
This commit is contained in:
parent
e912d3c49c
commit
1b0c9d7776
@ -377,40 +377,3 @@ error:
|
|||||||
free(rpng);
|
free(rpng);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
|
||||||
unsigned *width, unsigned *height)
|
|
||||||
{
|
|
||||||
bool ret = true;
|
|
||||||
|
|
||||||
struct rpng_t *rpng = rpng_nbio_load_image_argb_init(path);
|
|
||||||
|
|
||||||
if (!rpng)
|
|
||||||
GOTO_END_ERROR();
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (!rpng_nbio_load_image_argb_iterate(
|
|
||||||
rpng->buff_data, rpng))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
fprintf(stderr, "has_ihdr: %d\n", rpng->has_ihdr);
|
|
||||||
fprintf(stderr, "has_idat: %d\n", rpng->has_idat);
|
|
||||||
fprintf(stderr, "has_iend: %d\n", rpng->has_iend);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!rpng->has_ihdr || !rpng->has_idat || !rpng->has_iend)
|
|
||||||
GOTO_END_ERROR();
|
|
||||||
|
|
||||||
rpng_nbio_load_image_argb_process(rpng, data, width, height);
|
|
||||||
|
|
||||||
end:
|
|
||||||
rpng_nbio_load_image_free(rpng);
|
|
||||||
rpng = NULL;
|
|
||||||
if (!ret)
|
|
||||||
free(*data);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
@ -29,6 +29,49 @@
|
|||||||
#include <Imlib2.h>
|
#include <Imlib2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
||||||
|
unsigned *width, unsigned *height)
|
||||||
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
struct rpng_t *rpng = rpng_nbio_load_image_argb_init(path);
|
||||||
|
|
||||||
|
if (!rpng)
|
||||||
|
{
|
||||||
|
ret = false;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (!rpng_nbio_load_image_argb_iterate(
|
||||||
|
rpng->buff_data, rpng))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
fprintf(stderr, "has_ihdr: %d\n", rpng->has_ihdr);
|
||||||
|
fprintf(stderr, "has_idat: %d\n", rpng->has_idat);
|
||||||
|
fprintf(stderr, "has_iend: %d\n", rpng->has_iend);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!rpng->has_ihdr || !rpng->has_idat || !rpng->has_iend)
|
||||||
|
{
|
||||||
|
ret = false;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
rpng_nbio_load_image_argb_process(rpng, data, width, height);
|
||||||
|
|
||||||
|
end:
|
||||||
|
rpng_nbio_load_image_free(rpng);
|
||||||
|
rpng = NULL;
|
||||||
|
if (!ret)
|
||||||
|
free(*data);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int test_nonblocking_rpng(const char *in_path)
|
static int test_nonblocking_rpng(const char *in_path)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_IMLIB2
|
#ifdef HAVE_IMLIB2
|
||||||
|
@ -72,8 +72,15 @@ struct 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);
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb(const char *path, uint32_t **data,
|
struct rpng_t *rpng_nbio_load_image_argb_init(const char *path);
|
||||||
unsigned *width, unsigned *height);
|
|
||||||
|
void rpng_nbio_load_image_free(struct rpng_t *rpng);
|
||||||
|
|
||||||
|
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf,
|
||||||
|
struct rpng_t *rpng);
|
||||||
|
|
||||||
|
bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||||
|
uint32_t **data, unsigned *width, unsigned *height);
|
||||||
|
|
||||||
#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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user