(RGUI) Cleanups
This commit is contained in:
parent
f879a723c6
commit
63157a6f09
|
@ -6072,9 +6072,7 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
|
||||||
if (!menu)
|
if (!menu)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
rgui = (rgui_t*)calloc(1, sizeof(rgui_t));
|
if (!(rgui = (rgui_t*)calloc(1, sizeof(rgui_t))))
|
||||||
|
|
||||||
if (!rgui)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
*userdata = rgui;
|
*userdata = rgui;
|
||||||
|
@ -6206,8 +6204,9 @@ static void rgui_free(void *data)
|
||||||
{
|
{
|
||||||
rgui_t *rgui = (rgui_t*)data;
|
rgui_t *rgui = (rgui_t*)data;
|
||||||
|
|
||||||
if (rgui)
|
if (!rgui)
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_GFX_WIDGETS
|
#ifdef HAVE_GFX_WIDGETS
|
||||||
if (rgui->widgets_supported)
|
if (rgui->widgets_supported)
|
||||||
gfx_display_deinit_white_texture();
|
gfx_display_deinit_white_texture();
|
||||||
|
@ -6224,7 +6223,6 @@ static void rgui_free(void *data)
|
||||||
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
rgui_thumbnail_free(&rgui->fs_thumbnail);
|
||||||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_set_texture(void *data)
|
static void rgui_set_texture(void *data)
|
||||||
|
@ -6249,10 +6247,8 @@ static void rgui_set_texture(void *data)
|
||||||
p_disp->framebuf_dirty = false;
|
p_disp->framebuf_dirty = false;
|
||||||
|
|
||||||
if (internal_upscale_level == RGUI_UPSCALE_NONE)
|
if (internal_upscale_level == RGUI_UPSCALE_NONE)
|
||||||
{
|
|
||||||
video_driver_set_texture_frame(rgui->frame_buf.data,
|
video_driver_set_texture_frame(rgui->frame_buf.data,
|
||||||
false, fb_width, fb_height, 1.0f);
|
false, fb_width, fb_height, 1.0f);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct video_viewport vp;
|
struct video_viewport vp;
|
||||||
|
@ -6263,10 +6259,8 @@ static void rgui_set_texture(void *data)
|
||||||
/* If viewport is currently the same size (or smaller)
|
/* If viewport is currently the same size (or smaller)
|
||||||
* than the menu framebuffer, no scaling is required */
|
* than the menu framebuffer, no scaling is required */
|
||||||
if ((vp.width <= fb_width) && (vp.height <= fb_height))
|
if ((vp.width <= fb_width) && (vp.height <= fb_height))
|
||||||
{
|
|
||||||
video_driver_set_texture_frame(rgui->frame_buf.data,
|
video_driver_set_texture_frame(rgui->frame_buf.data,
|
||||||
false, fb_width, fb_height, 1.0f);
|
false, fb_width, fb_height, 1.0f);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned out_width;
|
unsigned out_width;
|
||||||
|
@ -6303,9 +6297,8 @@ static void rgui_set_texture(void *data)
|
||||||
upscale_buf->data = NULL;
|
upscale_buf->data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
upscale_buf->data = (uint16_t*)
|
if (!(upscale_buf->data = (uint16_t*)
|
||||||
calloc(out_width * out_height, sizeof(uint16_t));
|
calloc(out_width * out_height, sizeof(uint16_t))))
|
||||||
if (!upscale_buf->data)
|
|
||||||
{
|
{
|
||||||
/* Uh oh... This could mean we don't have enough
|
/* Uh oh... This could mean we don't have enough
|
||||||
* memory, so disable upscaling and draw the usual
|
* memory, so disable upscaling and draw the usual
|
||||||
|
@ -6395,7 +6388,6 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, bool download_missing)
|
||||||
{
|
{
|
||||||
if (gfx_thumbnail_get_path(rgui->thumbnail_path_data,
|
if (gfx_thumbnail_get_path(rgui->thumbnail_path_data,
|
||||||
GFX_THUMBNAIL_LEFT, &left_thumbnail_path))
|
GFX_THUMBNAIL_LEFT, &left_thumbnail_path))
|
||||||
{
|
|
||||||
rgui->entry_has_left_thumbnail = rgui_request_thumbnail(
|
rgui->entry_has_left_thumbnail = rgui_request_thumbnail(
|
||||||
&rgui->mini_left_thumbnail,
|
&rgui->mini_left_thumbnail,
|
||||||
GFX_THUMBNAIL_LEFT,
|
GFX_THUMBNAIL_LEFT,
|
||||||
|
@ -6403,7 +6395,6 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, bool download_missing)
|
||||||
left_thumbnail_path,
|
left_thumbnail_path,
|
||||||
&thumbnails_missing);
|
&thumbnails_missing);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset 'load pending' state */
|
/* Reset 'load pending' state */
|
||||||
rgui->thumbnail_load_pending = false;
|
rgui->thumbnail_load_pending = false;
|
||||||
|
@ -6676,7 +6667,7 @@ static void rgui_populate_entries(void *data,
|
||||||
/* Check whether user language has changed */
|
/* Check whether user language has changed */
|
||||||
if (rgui->language != *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
if (rgui->language != *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
||||||
{
|
{
|
||||||
/* Reinitialise fonts */
|
/* Reinitialize fonts */
|
||||||
rgui_fonts_free(rgui);
|
rgui_fonts_free(rgui);
|
||||||
rgui_fonts_init(rgui);
|
rgui_fonts_init(rgui);
|
||||||
|
|
||||||
|
@ -6694,9 +6685,9 @@ static void rgui_populate_entries(void *data,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Check whether we are currently viewing a playlist */
|
/* Check whether we are currently viewing a playlist */
|
||||||
rgui->is_playlist = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST)) ||
|
rgui->is_playlist = string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_PLAYLIST_LIST))
|
||||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY)) ||
|
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_LOAD_CONTENT_HISTORY))
|
||||||
string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST));
|
|| string_is_equal(label, msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_FAVORITES_LIST));
|
||||||
|
|
||||||
/* Set menu title */
|
/* Set menu title */
|
||||||
menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title));
|
menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title));
|
||||||
|
@ -7120,20 +7111,21 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||||
if (!rgui || !settings)
|
if (!rgui || !settings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
|
||||||
{
|
|
||||||
if (menu_on)
|
if (menu_on)
|
||||||
|
{
|
||||||
|
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||||
{
|
{
|
||||||
/* Cache content video settings */
|
/* Cache content video settings */
|
||||||
rgui_get_video_config(&rgui->content_video_settings, settings->uints.video_aspect_ratio_idx);
|
rgui_get_video_config(&rgui->content_video_settings, settings->uints.video_aspect_ratio_idx);
|
||||||
|
|
||||||
/* Update menu viewport */
|
/* Update menu viewport */
|
||||||
rgui_update_menu_viewport(rgui, p_disp, settings->uints.menu_rgui_aspect_ratio_lock);
|
rgui_update_menu_viewport(rgui, p_disp, settings->uints.menu_rgui_aspect_ratio_lock);
|
||||||
|
|
||||||
/* Apply menu video settings */
|
/* Apply menu video settings */
|
||||||
rgui_set_video_config(rgui, settings, &rgui->menu_video_settings, false);
|
rgui_set_video_config(rgui, settings, &rgui->menu_video_settings, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||||
{
|
{
|
||||||
/* Restore content video settings *if* user
|
/* Restore content video settings *if* user
|
||||||
* has not changed video settings since menu was
|
* has not changed video settings since menu was
|
||||||
|
@ -7149,16 +7141,16 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
||||||
* resize events */
|
* resize events */
|
||||||
rgui->ignore_resize_events = false;
|
rgui->ignore_resize_events = false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Upscaling buffer is only required while menu is on. Save
|
/* Upscaling buffer is only required while menu is on. Save
|
||||||
* memory by freeing it whenever we switch back to the current
|
* memory by freeing it whenever we switch back to the current
|
||||||
* content */
|
* content */
|
||||||
if (!menu_on && rgui->upscale_buf.data)
|
if (rgui->upscale_buf.data)
|
||||||
{
|
{
|
||||||
free(rgui->upscale_buf.data);
|
free(rgui->upscale_buf.data);
|
||||||
rgui->upscale_buf.data = NULL;
|
rgui->upscale_buf.data = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_context_reset(void *data, bool is_threaded)
|
static void rgui_context_reset(void *data, bool is_threaded)
|
||||||
|
|
Loading…
Reference in New Issue