mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
(RPNG) Rewrite rpng_nbio_load_image_process
This commit is contained in:
parent
533f647fe0
commit
9a0bd3c650
@ -191,26 +191,17 @@ bool rpng_nbio_load_image_argb_iterate(uint8_t *buf, struct rpng_t *rpng)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height)
|
uint32_t **data, unsigned *width, unsigned *height)
|
||||||
{
|
{
|
||||||
int retval = 0;
|
|
||||||
|
|
||||||
if (!rpng->process.initialized)
|
if (!rpng->process.initialized)
|
||||||
{
|
{
|
||||||
if (!rpng_load_image_argb_process_init(rpng, data, width,
|
if (!rpng_load_image_argb_process_init(rpng, data, width,
|
||||||
height))
|
height))
|
||||||
return false;
|
return PNG_PROCESS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
do{
|
return png_reverse_filter_iterate(rpng, data);
|
||||||
retval = png_reverse_filter_iterate(rpng, data);
|
|
||||||
}while(retval == PNG_PROCESS_NEXT);
|
|
||||||
|
|
||||||
if (retval == PNG_PROCESS_ERROR || retval == PNG_PROCESS_ERROR_END)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpng_nbio_load_image_free(struct rpng_t *rpng)
|
void rpng_nbio_load_image_free(struct rpng_t *rpng)
|
||||||
|
@ -23,6 +23,14 @@
|
|||||||
#include <formats/rpng.h>
|
#include <formats/rpng.h>
|
||||||
#include <formats/tga.h>
|
#include <formats/tga.h>
|
||||||
|
|
||||||
|
enum image_process_code
|
||||||
|
{
|
||||||
|
IMAGE_PROCESS_ERROR = -2,
|
||||||
|
IMAGE_PROCESS_ERROR_END = -1,
|
||||||
|
IMAGE_PROCESS_NEXT = 0,
|
||||||
|
IMAGE_PROCESS_END = 1,
|
||||||
|
};
|
||||||
|
|
||||||
struct texture_image
|
struct texture_image
|
||||||
{
|
{
|
||||||
unsigned width;
|
unsigned width;
|
||||||
|
@ -113,7 +113,7 @@ void rpng_nbio_load_image_free(struct rpng_t *rpng);
|
|||||||
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf,
|
bool rpng_nbio_load_image_argb_iterate(uint8_t *buf,
|
||||||
struct rpng_t *rpng);
|
struct rpng_t *rpng);
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
int rpng_nbio_load_image_argb_process(struct rpng_t *rpng,
|
||||||
uint32_t **data, unsigned *width, unsigned *height);
|
uint32_t **data, unsigned *width, unsigned *height);
|
||||||
|
|
||||||
bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng);
|
bool rpng_nbio_load_image_argb_start(struct rpng_t *rpng);
|
||||||
|
@ -166,10 +166,7 @@ static int rarch_main_iterate_http_poll(void)
|
|||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
static int cb_image_menu_wallpaper(void *data, size_t len)
|
static int cb_image_menu_wallpaper(void *data, size_t len)
|
||||||
{
|
{
|
||||||
uint32_t **pixels = NULL;
|
int retval;
|
||||||
unsigned *width = NULL;
|
|
||||||
unsigned *height = NULL;
|
|
||||||
|
|
||||||
nbio_handle_t *nbio = (nbio_handle_t*)data;
|
nbio_handle_t *nbio = (nbio_handle_t*)data;
|
||||||
|
|
||||||
if (!nbio || !data)
|
if (!nbio || !data)
|
||||||
@ -180,11 +177,13 @@ static int cb_image_menu_wallpaper(void *data, size_t len)
|
|||||||
!nbio->image.handle->has_iend)
|
!nbio->image.handle->has_iend)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
pixels = &nbio->image.ti.pixels;
|
do{
|
||||||
width = &nbio->image.ti.width;
|
retval = rpng_nbio_load_image_argb_process(nbio->image.handle,
|
||||||
height = &nbio->image.ti.height;
|
&nbio->image.ti.pixels, &nbio->image.ti.width, &nbio->image.ti.height);
|
||||||
|
}while(retval == IMAGE_PROCESS_NEXT);
|
||||||
|
|
||||||
rpng_nbio_load_image_argb_process(nbio->image.handle, pixels, width, height);
|
if (retval == IMAGE_PROCESS_ERROR || retval == IMAGE_PROCESS_ERROR_END)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (driver.menu_ctx && driver.menu_ctx->load_background)
|
if (driver.menu_ctx && driver.menu_ctx->load_background)
|
||||||
driver.menu_ctx->load_background(&nbio->image.ti);
|
driver.menu_ctx->load_background(&nbio->image.ti);
|
||||||
@ -525,7 +524,13 @@ void do_data_nbio_state_checks(nbio_handle_t *nbio)
|
|||||||
|
|
||||||
if (nbio->image.handle)
|
if (nbio->image.handle)
|
||||||
{
|
{
|
||||||
if (!nbio->image.is_blocking)
|
#if 0
|
||||||
|
if (nbio->image.is_blocking_on_processing)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (!nbio->image.is_blocking)
|
||||||
{
|
{
|
||||||
if (rarch_main_iterate_image_transfer(nbio) == -1)
|
if (rarch_main_iterate_image_transfer(nbio) == -1)
|
||||||
rarch_main_iterate_image_parse(nbio);
|
rarch_main_iterate_image_parse(nbio);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user