From e04bce7dd034c60ed71fb6e2af20eb643f59f00b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 10 Jun 2020 17:22:02 +0200 Subject: [PATCH] Move gfx_thumbnail global state to rarch_state --- gfx/gfx_thumbnail.c | 45 --------------------------------------------- gfx/gfx_thumbnail.h | 35 +++++++++++++++++++++++++++++++++++ retroarch.c | 10 ++++++++++ 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/gfx/gfx_thumbnail.c b/gfx/gfx_thumbnail.c index 9d51e3a3d2..c698cb0cff 100644 --- a/gfx/gfx_thumbnail.c +++ b/gfx/gfx_thumbnail.c @@ -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 diff --git a/gfx/gfx_thumbnail.h b/gfx/gfx_thumbnail.h index 50d0a1af67..0c2283c3d0 100644 --- a/gfx/gfx_thumbnail.h +++ b/gfx/gfx_thumbnail.h @@ -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 diff --git a/retroarch.c b/retroarch.c index e0d3e0d313..8ee3967c30 100644 --- a/retroarch.c +++ b/retroarch.c @@ -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;