(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)
|
||||
return NULL;
|
||||
|
||||
rgui = (rgui_t*)calloc(1, sizeof(rgui_t));
|
||||
|
||||
if (!rgui)
|
||||
if (!(rgui = (rgui_t*)calloc(1, sizeof(rgui_t))))
|
||||
goto error;
|
||||
|
||||
*userdata = rgui;
|
||||
|
@ -6206,8 +6204,9 @@ static void rgui_free(void *data)
|
|||
{
|
||||
rgui_t *rgui = (rgui_t*)data;
|
||||
|
||||
if (rgui)
|
||||
{
|
||||
if (!rgui)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
if (rgui->widgets_supported)
|
||||
gfx_display_deinit_white_texture();
|
||||
|
@ -6225,7 +6224,6 @@ static void rgui_free(void *data)
|
|||
rgui_thumbnail_free(&rgui->mini_thumbnail);
|
||||
rgui_thumbnail_free(&rgui->mini_left_thumbnail);
|
||||
}
|
||||
}
|
||||
|
||||
static void rgui_set_texture(void *data)
|
||||
{
|
||||
|
@ -6249,10 +6247,8 @@ static void rgui_set_texture(void *data)
|
|||
p_disp->framebuf_dirty = false;
|
||||
|
||||
if (internal_upscale_level == RGUI_UPSCALE_NONE)
|
||||
{
|
||||
video_driver_set_texture_frame(rgui->frame_buf.data,
|
||||
false, fb_width, fb_height, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct video_viewport vp;
|
||||
|
@ -6263,10 +6259,8 @@ static void rgui_set_texture(void *data)
|
|||
/* If viewport is currently the same size (or smaller)
|
||||
* than the menu framebuffer, no scaling is required */
|
||||
if ((vp.width <= fb_width) && (vp.height <= fb_height))
|
||||
{
|
||||
video_driver_set_texture_frame(rgui->frame_buf.data,
|
||||
false, fb_width, fb_height, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned out_width;
|
||||
|
@ -6303,9 +6297,8 @@ static void rgui_set_texture(void *data)
|
|||
upscale_buf->data = NULL;
|
||||
}
|
||||
|
||||
upscale_buf->data = (uint16_t*)
|
||||
calloc(out_width * out_height, sizeof(uint16_t));
|
||||
if (!upscale_buf->data)
|
||||
if (!(upscale_buf->data = (uint16_t*)
|
||||
calloc(out_width * out_height, sizeof(uint16_t))))
|
||||
{
|
||||
/* Uh oh... This could mean we don't have enough
|
||||
* 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,
|
||||
GFX_THUMBNAIL_LEFT, &left_thumbnail_path))
|
||||
{
|
||||
rgui->entry_has_left_thumbnail = rgui_request_thumbnail(
|
||||
&rgui->mini_left_thumbnail,
|
||||
GFX_THUMBNAIL_LEFT,
|
||||
|
@ -6403,7 +6395,6 @@ static void rgui_load_current_thumbnails(rgui_t *rgui, bool download_missing)
|
|||
left_thumbnail_path,
|
||||
&thumbnails_missing);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset 'load pending' state */
|
||||
rgui->thumbnail_load_pending = false;
|
||||
|
@ -6676,7 +6667,7 @@ static void rgui_populate_entries(void *data,
|
|||
/* Check whether user language has changed */
|
||||
if (rgui->language != *msg_hash_get_uint(MSG_HASH_USER_LANGUAGE))
|
||||
{
|
||||
/* Reinitialise fonts */
|
||||
/* Reinitialize fonts */
|
||||
rgui_fonts_free(rgui);
|
||||
rgui_fonts_init(rgui);
|
||||
|
||||
|
@ -6694,9 +6685,9 @@ static void rgui_populate_entries(void *data,
|
|||
#endif
|
||||
|
||||
/* 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)) ||
|
||||
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));
|
||||
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_DEFERRED_FAVORITES_LIST));
|
||||
|
||||
/* Set 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)
|
||||
return;
|
||||
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
if (menu_on)
|
||||
{
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
/* Cache content video settings */
|
||||
rgui_get_video_config(&rgui->content_video_settings, settings->uints.video_aspect_ratio_idx);
|
||||
|
||||
/* Update menu viewport */
|
||||
rgui_update_menu_viewport(rgui, p_disp, settings->uints.menu_rgui_aspect_ratio_lock);
|
||||
|
||||
/* Apply menu video settings */
|
||||
rgui_set_video_config(rgui, settings, &rgui->menu_video_settings, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aspect_ratio_lock != RGUI_ASPECT_RATIO_LOCK_NONE)
|
||||
{
|
||||
/* Restore content video settings *if* user
|
||||
* has not changed video settings since menu was
|
||||
|
@ -7149,17 +7141,17 @@ static void rgui_toggle(void *userdata, bool menu_on)
|
|||
* resize events */
|
||||
rgui->ignore_resize_events = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Upscaling buffer is only required while menu is on. Save
|
||||
* memory by freeing it whenever we switch back to the current
|
||||
* content */
|
||||
if (!menu_on && rgui->upscale_buf.data)
|
||||
if (rgui->upscale_buf.data)
|
||||
{
|
||||
free(rgui->upscale_buf.data);
|
||||
rgui->upscale_buf.data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void rgui_context_reset(void *data, bool is_threaded)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue