Move gfx_thumbnail global state to rarch_state

This commit is contained in:
twinaphex 2020-06-10 17:22:02 +02:00
parent 66451f3ef0
commit e04bce7dd0
3 changed files with 45 additions and 45 deletions

View File

@ -38,38 +38,6 @@
#define DEFAULT_GFX_THUMBNAIL_STREAM_DELAY 83.333333f
#define DEFAULT_GFX_THUMBNAIL_FADE_DURATION 166.66667f
/* Structure containing all gfx_thumbnail
* global variables */
struct gfx_thumbnail_state
{
/* When streaming thumbnails, to minimise the processing
* of unnecessary images (i.e. when scrolling rapidly through
* playlists), we delay loading until an entry has been on screen
* for at least gfx_thumbnail_delay ms */
float stream_delay;
/* Duration in ms of the thumbnail 'fade in' animation */
float fade_duration;
/* When true, 'fade in' animation will also be
* triggered for missing thumbnails */
bool fade_missing;
/* Due to the asynchronous nature of thumbnail
* loading, it is quite possible to trigger a load
* then navigate to a different menu list before
* the load is complete/handled. As an additional
* safety check, we therefore tag the current menu
* list with counter value that is incremented whenever
* a list is cleared/set. This is sent as userdata when
* requesting a thumbnail, and the upload is only
* handled if the tag matches the most recent value
* at the time when the load completes */
uint64_t list_id;
};
typedef struct gfx_thumbnail_state gfx_thumbnail_state_t;
/* Utility structure, sent as userdata when pushing
* an image load */
typedef struct
@ -78,19 +46,6 @@ typedef struct
retro_time_t list_id;
} gfx_thumbnail_tag_t;
/* TODO/FIXME */
/* Global gfx_thumbnail_state structure */
static gfx_thumbnail_state_t gfx_thumb_state;
/* Global variable access */
/* Returns pointer to global gfx_thumbnail_state
* structure */
static gfx_thumbnail_state_t *gfx_thumb_get_ptr(void)
{
return &gfx_thumb_state;
}
/* Setters */
/* When streaming thumbnails, sets time in ms that an

View File

@ -92,6 +92,39 @@ typedef struct
} outline;
} gfx_thumbnail_shadow_t;
/* Structure containing all gfx_thumbnail
* global variables */
struct gfx_thumbnail_state
{
/* When streaming thumbnails, to minimise the processing
* of unnecessary images (i.e. when scrolling rapidly through
* playlists), we delay loading until an entry has been on screen
* for at least gfx_thumbnail_delay ms */
float stream_delay;
/* Duration in ms of the thumbnail 'fade in' animation */
float fade_duration;
/* When true, 'fade in' animation will also be
* triggered for missing thumbnails */
bool fade_missing;
/* Due to the asynchronous nature of thumbnail
* loading, it is quite possible to trigger a load
* then navigate to a different menu list before
* the load is complete/handled. As an additional
* safety check, we therefore tag the current menu
* list with counter value that is incremented whenever
* a list is cleared/set. This is sent as userdata when
* requesting a thumbnail, and the upload is only
* handled if the tag matches the most recent value
* at the time when the load completes */
uint64_t list_id;
};
typedef struct gfx_thumbnail_state gfx_thumbnail_state_t;
/* Setters */
/* When streaming thumbnails, sets time in ms that an
@ -239,6 +272,8 @@ void gfx_thumbnail_draw(
float alpha, float scale_factor,
gfx_thumbnail_shadow_t *shadow);
gfx_thumbnail_state_t *gfx_thumb_get_ptr(void);
RETRO_END_DECLS
#endif

View File

@ -138,6 +138,7 @@
#include "gfx/gfx_animation.h"
#include "gfx/gfx_display.h"
#include "gfx/gfx_thumbnail.h"
#include "input/input_osk.h"
@ -2145,6 +2146,8 @@ struct rarch_state
dispgfx_widget_t dispwidget_st;
#endif
gfx_thumbnail_state_t gfx_thumb_state;
input_keyboard_press_t keyboard_press_cb;
turbo_buttons_t input_driver_turbo_btns;
@ -3610,6 +3613,13 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
NULL
};
gfx_thumbnail_state_t *gfx_thumb_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
return &p_rarch->gfx_thumb_state;
}
menu_handle_t *menu_driver_get_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;