(Image) Add texture image handle to nbio_image_t

This commit is contained in:
twinaphex 2015-03-14 03:02:59 +01:00
parent 4124fb7130
commit 06dcd7543f
2 changed files with 11 additions and 6 deletions

View File

@ -403,6 +403,7 @@ typedef int (*transfer_cb_t )(void *data, size_t len);
typedef struct nbio_image_handle
{
struct texture_image ti;
bool is_blocking;
bool is_finished;
transfer_cb_t cb;

View File

@ -166,10 +166,10 @@ static int rarch_main_iterate_http_poll(void)
#ifdef HAVE_MENU
static int cb_image_menu_wallpaper(void *data, size_t len)
{
struct texture_image ti = {0};
uint32_t **pixels = &ti.pixels;
unsigned *width = &ti.width;
unsigned *height = &ti.height;
uint32_t **pixels = NULL;
unsigned *width = NULL;
unsigned *height = NULL;
nbio_handle_t *nbio = (nbio_handle_t*)data;
if (!nbio || !data)
@ -180,12 +180,16 @@ static int cb_image_menu_wallpaper(void *data, size_t len)
!nbio->image.handle->has_iend)
return -1;
pixels = &nbio->image.ti.pixels;
width = &nbio->image.ti.width;
height = &nbio->image.ti.height;
rpng_nbio_load_image_argb_process(nbio->image.handle, pixels, width, height);
if (driver.menu_ctx && driver.menu_ctx->load_background)
driver.menu_ctx->load_background(&ti);
driver.menu_ctx->load_background(&nbio->image.ti);
texture_image_free(&ti);
texture_image_free(&nbio->image.ti);
nbio->image.is_blocking = true;
nbio->image.is_finished = true;