From 06dcd7543fa119523544f518b30aa3b922ee55bb Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 14 Mar 2015 03:02:59 +0100 Subject: [PATCH] (Image) Add texture image handle to nbio_image_t --- general.h | 1 + runloop_data.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/general.h b/general.h index 99e29ae69f..38498d787c 100644 --- a/general.h +++ b/general.h @@ -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; diff --git a/runloop_data.c b/runloop_data.c index 849213eda8..217f7a8cd8 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -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;