mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
(task_image.c) Cleanups
This commit is contained in:
parent
020b714113
commit
a0fcb1b694
@ -1390,6 +1390,7 @@ static int generic_action_ok(const char *path,
|
||||
|
||||
if (filestream_exists(action_path))
|
||||
task_push_image_load(action_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
}
|
||||
break;
|
||||
|
@ -1887,6 +1887,7 @@ static void materialui_context_reset(void *data, bool is_threaded)
|
||||
|
||||
if (filestream_exists(settings->paths.path_menu_wallpaper))
|
||||
task_push_image_load(settings->paths.path_menu_wallpaper,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
}
|
||||
|
||||
|
@ -396,6 +396,7 @@ static void ozone_update_thumbnail_image(void *data)
|
||||
ozone_handle_t *ozone = (ozone_handle_t*)data;
|
||||
const char *right_thumbnail_path = NULL;
|
||||
const char *left_thumbnail_path = NULL;
|
||||
bool supports_rgba = video_driver_supports_rgba();
|
||||
|
||||
if (!ozone)
|
||||
return;
|
||||
@ -404,6 +405,7 @@ static void ozone_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(right_thumbnail_path))
|
||||
task_push_image_load(right_thumbnail_path,
|
||||
supports_rgba,
|
||||
menu_display_handle_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&ozone->thumbnail);
|
||||
@ -415,6 +417,7 @@ static void ozone_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(left_thumbnail_path))
|
||||
task_push_image_load(left_thumbnail_path,
|
||||
supports_rgba,
|
||||
menu_display_handle_left_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&ozone->left_thumbnail);
|
||||
|
@ -1561,21 +1561,6 @@ static void rgui_render_particle_effect(rgui_t *rgui)
|
||||
rgui_render_border(rgui, rgui_frame_buf.data, fb_width, fb_height);
|
||||
}
|
||||
|
||||
static void request_wallpaper(const char *path)
|
||||
{
|
||||
/* Ensure that path is valid... */
|
||||
if (!string_is_empty(path))
|
||||
{
|
||||
if (filestream_exists(path))
|
||||
{
|
||||
/* Unlike thumbnails, we don't worry about queued images
|
||||
* here - in general, wallpaper is loaded once per session
|
||||
* and then forgotten, so performance issues are not a concern */
|
||||
task_push_image_load(path, menu_display_handle_wallpaper_upload, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void process_wallpaper(rgui_t *rgui, struct texture_image *image)
|
||||
{
|
||||
unsigned x, y;
|
||||
@ -1607,10 +1592,8 @@ static bool request_thumbnail(thumbnail_t *thumbnail, enum menu_thumbnail_id thu
|
||||
{
|
||||
/* Do nothing if current thumbnail path hasn't changed */
|
||||
if (!string_is_empty(path) && !string_is_empty(thumbnail->path))
|
||||
{
|
||||
if (string_is_equal(thumbnail->path, path))
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 'Reset' current thumbnail */
|
||||
thumbnail->width = 0;
|
||||
@ -1627,7 +1610,9 @@ static bool request_thumbnail(thumbnail_t *thumbnail, enum menu_thumbnail_id thu
|
||||
{
|
||||
/* Would like to cancel any existing image load tasks
|
||||
* here, but can't see how to do it... */
|
||||
if(task_push_image_load(thumbnail->path, (thumbnail_id == MENU_THUMBNAIL_LEFT) ?
|
||||
if(task_push_image_load(thumbnail->path,
|
||||
video_driver_supports_rgba(),
|
||||
(thumbnail_id == MENU_THUMBNAIL_LEFT) ?
|
||||
menu_display_handle_left_thumbnail_upload : menu_display_handle_thumbnail_upload, NULL))
|
||||
{
|
||||
*queue_size = *queue_size + 1;
|
||||
@ -2220,7 +2205,14 @@ end:
|
||||
wallpaper_path[0] = '\0';
|
||||
|
||||
fill_pathname_resolve_relative(wallpaper_path, theme_path, wallpaper_file, sizeof(wallpaper_path));
|
||||
request_wallpaper(wallpaper_path);
|
||||
/* Ensure that path is valid... */
|
||||
if (path_is_valid(wallpaper_path))
|
||||
/* Unlike thumbnails, we don't worry about queued images
|
||||
* here - in general, wallpaper is loaded once per session
|
||||
* and then forgotten, so performance issues are not a concern */
|
||||
task_push_image_load(wallpaper_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -910,8 +910,8 @@ static void stripes_update_thumbnail_path(void *data, unsigned i, char pos)
|
||||
if (pos == 'R' || (pos == 'L' && string_is_equal(stripes_thumbnails_ident('R'),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))))
|
||||
{
|
||||
if (!string_is_empty(entry.label))
|
||||
strlcpy(new_path, entry.label,
|
||||
if (!string_is_empty(entry->label))
|
||||
strlcpy(new_path, entry->label,
|
||||
sizeof(new_path));
|
||||
goto end;
|
||||
}
|
||||
@ -1062,6 +1062,7 @@ static void stripes_update_savestate_thumbnail_path(void *data, unsigned i)
|
||||
static void stripes_update_thumbnail_image(void *data)
|
||||
{
|
||||
stripes_handle_t *stripes = (stripes_handle_t*)data;
|
||||
bool supports_rgba = video_driver_supports_rgba();
|
||||
if (!stripes)
|
||||
return;
|
||||
|
||||
@ -1069,6 +1070,7 @@ static void stripes_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(stripes->thumbnail_file_path))
|
||||
task_push_image_load(stripes->thumbnail_file_path,
|
||||
supports_rgba,
|
||||
menu_display_handle_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&stripes->thumbnail);
|
||||
@ -1081,6 +1083,7 @@ static void stripes_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(stripes->left_thumbnail_file_path))
|
||||
task_push_image_load(stripes->left_thumbnail_file_path,
|
||||
supports_rgba,
|
||||
menu_display_handle_left_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&stripes->left_thumbnail);
|
||||
@ -1142,9 +1145,9 @@ static void stripes_update_savestate_thumbnail_image(void *data)
|
||||
if (!stripes)
|
||||
return;
|
||||
|
||||
if (!string_is_empty(stripes->savestate_thumbnail_file_path)
|
||||
&& filestream_exists(stripes->savestate_thumbnail_file_path))
|
||||
if (path_is_valid(stripes->savestate_thumbnail_file_path))
|
||||
task_push_image_load(stripes->savestate_thumbnail_file_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_savestate_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&stripes->savestate_thumbnail);
|
||||
@ -1524,6 +1527,7 @@ static void stripes_list_switch_new(stripes_handle_t *stripes,
|
||||
if(filestream_exists(path))
|
||||
{
|
||||
task_push_image_load(path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
if (!string_is_empty(stripes->bg_file_path))
|
||||
free(stripes->bg_file_path);
|
||||
@ -1835,12 +1839,15 @@ static void stripes_init_horizontal_list(stripes_handle_t *stripes)
|
||||
info.list = stripes->horizontal_list;
|
||||
info.path = strdup(
|
||||
settings->paths.directory_playlist);
|
||||
#if 0
|
||||
/* TODO/FIXME - will need to look what to do here */
|
||||
info.label = strdup(
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST));
|
||||
info.enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST;
|
||||
#endif
|
||||
info.exts = strdup(
|
||||
file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT));
|
||||
info.type_default = FILE_TYPE_PLAIN;
|
||||
info.enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST;
|
||||
|
||||
if (!string_is_empty(info.path))
|
||||
{
|
||||
@ -3691,6 +3698,7 @@ static void stripes_context_reset_background(const char *iconpath)
|
||||
|
||||
if (filestream_exists(path))
|
||||
task_push_image_load(path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
|
||||
if (path)
|
||||
@ -4161,11 +4169,14 @@ static int stripes_list_push(void *data, void *userdata,
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
#if 0
|
||||
/* TODO/FIXME - figure out what to do here */
|
||||
menu_entries_append_enum(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_COLLECTION_LIST),
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST),
|
||||
MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST,
|
||||
MENU_SETTING_ACTION, 0, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (frontend_driver_parse_drive_list(info->list, true) != 0)
|
||||
|
@ -1017,6 +1017,7 @@ static void xmb_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(right_thumbnail_path))
|
||||
task_push_image_load(right_thumbnail_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&xmb->thumbnail);
|
||||
@ -1028,6 +1029,7 @@ static void xmb_update_thumbnail_image(void *data)
|
||||
{
|
||||
if (filestream_exists(left_thumbnail_path))
|
||||
task_push_image_load(left_thumbnail_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_left_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&xmb->left_thumbnail);
|
||||
@ -1187,6 +1189,7 @@ static void xmb_update_savestate_thumbnail_image(void *data)
|
||||
|
||||
if (path_is_valid(xmb->savestate_thumbnail_file_path))
|
||||
task_push_image_load(xmb->savestate_thumbnail_file_path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_savestate_thumbnail_upload, NULL);
|
||||
else
|
||||
video_driver_texture_unload(&xmb->savestate_thumbnail);
|
||||
@ -1640,6 +1643,7 @@ static void xmb_list_switch_new(xmb_handle_t *xmb,
|
||||
if (filestream_exists(path))
|
||||
{
|
||||
task_push_image_load(path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
if (!string_is_empty(xmb->bg_file_path))
|
||||
free(xmb->bg_file_path);
|
||||
@ -5022,6 +5026,7 @@ static void xmb_context_reset_background(const char *iconpath)
|
||||
|
||||
if (filestream_exists(path))
|
||||
task_push_image_load(path,
|
||||
video_driver_supports_rgba(),
|
||||
menu_display_handle_wallpaper_upload, NULL);
|
||||
|
||||
#ifdef ORBIS
|
||||
|
@ -24,10 +24,6 @@
|
||||
#include <string/stdstring.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
#include "../gfx/video_driver.h"
|
||||
#endif
|
||||
|
||||
#include "task_file_transfer.h"
|
||||
#include "tasks_internal.h"
|
||||
|
||||
@ -286,7 +282,9 @@ bool task_image_load_handler(retro_task_t *task)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void *user_data)
|
||||
bool task_push_image_load(const char *fullpath,
|
||||
bool supports_rgba,
|
||||
retro_task_callback_t cb, void *user_data)
|
||||
{
|
||||
nbio_handle_t *nbio = NULL;
|
||||
struct nbio_image_handle *image = NULL;
|
||||
@ -313,10 +311,8 @@ bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void *
|
||||
nbio->msg_queue = NULL;
|
||||
nbio->cb = &cb_nbio_image_thumbnail;
|
||||
|
||||
#ifdef RARCH_INTERNAL
|
||||
if (video_driver_supports_rgba())
|
||||
if (supports_rgba)
|
||||
BIT32_SET(nbio->status_flags, NBIO_FLAG_IMAGE_SUPPORTS_RGBA);
|
||||
#endif
|
||||
|
||||
image = (struct nbio_image_handle*)malloc(sizeof(*image));
|
||||
if (!image)
|
||||
@ -342,6 +338,7 @@ bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void *
|
||||
image->ti.width = 0;
|
||||
image->ti.height = 0;
|
||||
image->ti.pixels = NULL;
|
||||
/* TODO/FIXME - shouldn't we set this ? */
|
||||
image->ti.supports_rgba = false;
|
||||
|
||||
if (strstr(fullpath, ".png"))
|
||||
|
@ -69,6 +69,7 @@ bool task_push_pl_entry_thumbnail_download(const char *system, playlist_t *playl
|
||||
#endif
|
||||
|
||||
bool task_push_image_load(const char *fullpath,
|
||||
bool supports_rgba,
|
||||
retro_task_callback_t cb, void *userdata);
|
||||
|
||||
#ifdef HAVE_LIBRETRODB
|
||||
|
Loading…
x
Reference in New Issue
Block a user