Don't call anim_get_ptr inside gfx_thumbnail.c

This commit is contained in:
twinaphex 2021-04-08 01:30:42 +02:00
parent e5e8e9b5d8
commit 5334ddd199
3 changed files with 45 additions and 17 deletions

View File

@ -430,8 +430,13 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail)
* gfx_thumbnail_process_streams() for improved
* performance */
void gfx_thumbnail_process_stream(
gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id,
playlist_t *playlist, size_t idx, gfx_thumbnail_t *thumbnail, bool on_screen,
gfx_thumbnail_path_data_t *path_data,
gfx_animation_t *p_anim,
enum gfx_thumbnail_id thumbnail_id,
playlist_t *playlist,
size_t idx,
gfx_thumbnail_t *thumbnail,
bool on_screen,
unsigned gfx_thumbnail_upscale_threshold,
bool network_on_demand_thumbnails
)
@ -446,7 +451,6 @@ void gfx_thumbnail_process_stream(
* GFX_THUMBNAIL_STATUS_UNKNOWN */
if (thumbnail->status == GFX_THUMBNAIL_STATUS_UNKNOWN)
{
gfx_animation_t *p_anim = anim_get_ptr();
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
/* Check if stream delay timer has elapsed */
@ -504,8 +508,10 @@ void gfx_thumbnail_process_stream(
* performance */
void gfx_thumbnail_process_streams(
gfx_thumbnail_path_data_t *path_data,
gfx_animation_t *p_anim,
playlist_t *playlist, size_t idx,
gfx_thumbnail_t *right_thumbnail, gfx_thumbnail_t *left_thumbnail,
gfx_thumbnail_t *right_thumbnail,
gfx_thumbnail_t *left_thumbnail,
bool on_screen,
unsigned gfx_thumbnail_upscale_threshold,
bool network_on_demand_thumbnails
@ -526,7 +532,6 @@ void gfx_thumbnail_process_streams(
{
/* Check if stream delay timer has elapsed */
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
gfx_animation_t *p_anim = anim_get_ptr();
float delta_time = p_anim->delta_time;
bool request_right = false;
bool request_left = false;

View File

@ -28,6 +28,7 @@
#include <boolean.h>
#include "gfx_animation.h"
#include "gfx_thumbnail_path.h"
RETRO_BEGIN_DECLS
@ -204,8 +205,13 @@ void gfx_thumbnail_reset(gfx_thumbnail_t *thumbnail);
* gfx_thumbnail_process_streams() for improved
* performance */
void gfx_thumbnail_process_stream(
gfx_thumbnail_path_data_t *path_data, enum gfx_thumbnail_id thumbnail_id,
playlist_t *playlist, size_t idx, gfx_thumbnail_t *thumbnail, bool on_screen,
gfx_thumbnail_path_data_t *path_data,
gfx_animation_t *p_anim,
enum gfx_thumbnail_id thumbnail_id,
playlist_t *playlist,
size_t idx,
gfx_thumbnail_t *thumbnail,
bool on_screen,
unsigned gfx_thumbnail_upscale_threshold,
bool network_on_demand_thumbnails
);
@ -224,8 +230,10 @@ void gfx_thumbnail_process_stream(
* performance */
void gfx_thumbnail_process_streams(
gfx_thumbnail_path_data_t *path_data,
gfx_animation_t *p_anim,
playlist_t *playlist, size_t idx,
gfx_thumbnail_t *right_thumbnail, gfx_thumbnail_t *left_thumbnail,
gfx_thumbnail_t *right_thumbnail,
gfx_thumbnail_t *left_thumbnail,
bool on_screen,
unsigned gfx_thumbnail_upscale_threshold,
bool network_on_demand_thumbnails

View File

@ -3168,20 +3168,27 @@ static bool materialui_render_process_entry_playlist_thumb_list(
bool network_on_demand_thumbnails)
{
bool on_screen = first_entry_found && !last_entry_found;
gfx_animation_t *p_anim = anim_get_ptr();
/* Load thumbnails for all on-screen entries
* and free thumbnails for all off-screen entries */
if (mui->secondary_thumbnail_enabled)
gfx_thumbnail_process_streams(
mui->thumbnail_path_data, mui->playlist, playlist_idx,
&node->thumbnails.primary, &node->thumbnails.secondary,
mui->thumbnail_path_data,
p_anim,
mui->playlist, playlist_idx,
&node->thumbnails.primary,
&node->thumbnails.secondary,
on_screen,
thumbnail_upscale_threshold,
network_on_demand_thumbnails);
else
gfx_thumbnail_process_stream(
mui->thumbnail_path_data, GFX_THUMBNAIL_RIGHT,
mui->playlist, playlist_idx, &node->thumbnails.primary,
mui->thumbnail_path_data,
p_anim,
GFX_THUMBNAIL_RIGHT,
mui->playlist, playlist_idx,
&node->thumbnails.primary,
on_screen,
thumbnail_upscale_threshold,
network_on_demand_thumbnails);
@ -3202,15 +3209,19 @@ static bool materialui_render_process_entry_playlist_dual_icon(
unsigned thumbnail_upscale_threshold,
bool network_on_demand_thumbnails)
{
bool on_screen = first_entry_found && !last_entry_found;
gfx_animation_t *p_anim = anim_get_ptr();
bool on_screen = first_entry_found && !last_entry_found;
/* Load thumbnails for all on-screen entries
* and free thumbnails for all off-screen entries
* > Note that secondary thumbnail is force
* enabled in dual icon mode */
gfx_thumbnail_process_streams(
mui->thumbnail_path_data, mui->playlist, playlist_idx,
&node->thumbnails.primary, &node->thumbnails.secondary,
mui->thumbnail_path_data,
p_anim,
mui->playlist, playlist_idx,
&node->thumbnails.primary,
&node->thumbnails.secondary,
on_screen,
thumbnail_upscale_threshold,
network_on_demand_thumbnails);
@ -3231,6 +3242,7 @@ static bool materialui_render_process_entry_playlist_desktop(
unsigned thumbnail_upscale_threshold,
bool network_on_demand_thumbnails)
{
gfx_animation_t *p_anim = anim_get_ptr();
gfx_thumbnail_state_t *p_gfx_thumb = gfx_thumb_get_ptr();
bool is_selected = (entry_idx == selection);
/* We want to load (and keep in memory)
@ -3250,8 +3262,11 @@ static bool materialui_render_process_entry_playlist_desktop(
* > Note that secondary thumbnail is force
* enabled */
gfx_thumbnail_process_streams(
mui->thumbnail_path_data, mui->playlist, playlist_idx,
&node->thumbnails.primary, &node->thumbnails.secondary,
mui->thumbnail_path_data,
p_anim,
mui->playlist, playlist_idx,
&node->thumbnails.primary,
&node->thumbnails.secondary,
is_on_screen,
thumbnail_upscale_threshold,
network_on_demand_thumbnails);