mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 15:45:19 +00:00
Cleanups
This commit is contained in:
parent
ced83c41e6
commit
baba57c10a
@ -192,9 +192,9 @@ float gfx_display_get_dpi_scale_internal(
|
|||||||
static bool scale_cached = false;
|
static bool scale_cached = false;
|
||||||
gfx_ctx_metrics_t metrics;
|
gfx_ctx_metrics_t metrics;
|
||||||
|
|
||||||
if (scale_cached &&
|
if ( scale_cached
|
||||||
(width == last_width) &&
|
&& (width == last_width)
|
||||||
(height == last_height))
|
&& (height == last_height))
|
||||||
return scale;
|
return scale;
|
||||||
|
|
||||||
/* Determine the diagonal 'size' of the display
|
/* Determine the diagonal 'size' of the display
|
||||||
@ -367,13 +367,12 @@ float gfx_display_get_dpi_scale(
|
|||||||
* > If we are not using a widget scale factor override,
|
* > If we are not using a widget scale factor override,
|
||||||
* just set menu_scale_factor to 1.0 */
|
* just set menu_scale_factor to 1.0 */
|
||||||
if (p_disp->menu_driver_id == MENU_DRIVER_ID_RGUI)
|
if (p_disp->menu_driver_id == MENU_DRIVER_ID_RGUI)
|
||||||
menu_scale_factor = 1.0f;
|
menu_scale_factor = 1.0f;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
float _menu_scale_factor =
|
float _menu_scale_factor = settings->floats.menu_scale_factor;
|
||||||
settings->floats.menu_scale_factor;
|
menu_scale_factor = _menu_scale_factor;
|
||||||
menu_scale_factor = _menu_scale_factor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -383,9 +382,9 @@ float gfx_display_get_dpi_scale(
|
|||||||
* hardware property. To minimise performance overheads
|
* hardware property. To minimise performance overheads
|
||||||
* we therefore only call video_context_driver_get_metrics()
|
* we therefore only call video_context_driver_get_metrics()
|
||||||
* on first run, or when the current video resolution changes */
|
* on first run, or when the current video resolution changes */
|
||||||
if (!scale_cached ||
|
if ( !scale_cached
|
||||||
(width != last_width) ||
|
|| (width != last_width)
|
||||||
(height != last_height))
|
|| (height != last_height))
|
||||||
{
|
{
|
||||||
scale = gfx_display_get_dpi_scale_internal(width, height);
|
scale = gfx_display_get_dpi_scale_internal(width, height);
|
||||||
scale_cached = true;
|
scale_cached = true;
|
||||||
@ -396,9 +395,9 @@ float gfx_display_get_dpi_scale(
|
|||||||
|
|
||||||
/* Adjusted scale calculation may also be slow, so
|
/* Adjusted scale calculation may also be slow, so
|
||||||
* only update if something changes */
|
* only update if something changes */
|
||||||
if (scale_updated ||
|
if ( scale_updated
|
||||||
(menu_scale_factor != last_menu_scale_factor) ||
|
|| (menu_scale_factor != last_menu_scale_factor)
|
||||||
(p_disp->menu_driver_id != last_menu_driver_id))
|
|| (p_disp->menu_driver_id != last_menu_driver_id))
|
||||||
{
|
{
|
||||||
adjusted_scale = gfx_display_get_adjusted_scale(
|
adjusted_scale = gfx_display_get_adjusted_scale(
|
||||||
p_disp,
|
p_disp,
|
||||||
@ -496,9 +495,9 @@ void gfx_display_draw_text(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Don't draw outside of the screen */
|
/* Don't draw outside of the screen */
|
||||||
if (!draw_outside &&
|
if ( !draw_outside
|
||||||
((x < -64 || x > width + 64)
|
&& ((x < -64 || x > width + 64)
|
||||||
|| (y < -64 || y > height + 64))
|
|| (y < -64 || y > height + 64))
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1081,7 +1080,7 @@ void gfx_display_draw_keyboard(
|
|||||||
int ptr_width, ptr_height;
|
int ptr_width, ptr_height;
|
||||||
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
||||||
|
|
||||||
static float white[16] = {
|
static float white[16] = {
|
||||||
1.00, 1.00, 1.00, 1.00,
|
1.00, 1.00, 1.00, 1.00,
|
||||||
1.00, 1.00, 1.00, 1.00,
|
1.00, 1.00, 1.00, 1.00,
|
||||||
1.00, 1.00, 1.00, 1.00,
|
1.00, 1.00, 1.00, 1.00,
|
||||||
|
@ -270,50 +270,47 @@ bool gfx_thumbnail_set_system(gfx_thumbnail_path_data_t *path_data,
|
|||||||
* gfx_thumbnail_is_enabled() will go out of sync */
|
* gfx_thumbnail_is_enabled() will go out of sync */
|
||||||
if (playlist)
|
if (playlist)
|
||||||
{
|
{
|
||||||
const char *playlist_path = playlist_get_conf_path(playlist);
|
const char *playlist_path = playlist_get_conf_path(playlist);
|
||||||
const char *playlist_file = NULL;
|
|
||||||
bool playlist_valid = false;
|
|
||||||
|
|
||||||
/* Note: This is not considered an error
|
/* Note: This is not considered an error
|
||||||
* (just means that input playlist is ignored) */
|
* (just means that input playlist is ignored) */
|
||||||
if (string_is_empty(playlist_path))
|
if (!string_is_empty(playlist_path))
|
||||||
return true;
|
|
||||||
|
|
||||||
playlist_file = path_basename_nocompression(playlist_path);
|
|
||||||
|
|
||||||
/* Note: This is not considered an error
|
|
||||||
* (just means that input playlist is ignored) */
|
|
||||||
if (string_is_empty(playlist_file))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
/* Check for history/favourites playlists */
|
|
||||||
playlist_valid =
|
|
||||||
(string_is_equal(system, "history") &&
|
|
||||||
string_is_equal(playlist_file,
|
|
||||||
FILE_PATH_CONTENT_HISTORY)) ||
|
|
||||||
(string_is_equal(system, "favorites") &&
|
|
||||||
string_is_equal(playlist_file,
|
|
||||||
FILE_PATH_CONTENT_FAVORITES));
|
|
||||||
|
|
||||||
if (!playlist_valid)
|
|
||||||
{
|
{
|
||||||
/* This means we have to work a little harder
|
const char *playlist_file = path_basename_nocompression(playlist_path);
|
||||||
* i.e. check whether the cached playlist file
|
/* Note: This is not considered an error
|
||||||
* matches the database name */
|
* (just means that input playlist is ignored) */
|
||||||
char *playlist_name = NULL;
|
if (!string_is_empty(playlist_file))
|
||||||
char tmp[PATH_MAX_LENGTH];
|
{
|
||||||
strlcpy(tmp, playlist_file, sizeof(tmp));
|
/* Check for history/favourites playlists */
|
||||||
playlist_name = path_remove_extension(tmp);
|
bool playlist_valid =
|
||||||
playlist_valid = string_is_equal(playlist_name, system);
|
(string_is_equal(system, "history") &&
|
||||||
}
|
string_is_equal(playlist_file,
|
||||||
|
FILE_PATH_CONTENT_HISTORY)) ||
|
||||||
/* If we have a valid playlist, extract thumbnail modes */
|
(string_is_equal(system, "favorites") &&
|
||||||
if (playlist_valid)
|
string_is_equal(playlist_file,
|
||||||
{
|
FILE_PATH_CONTENT_FAVORITES));
|
||||||
path_data->playlist_right_mode =
|
|
||||||
playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT);
|
if (!playlist_valid)
|
||||||
path_data->playlist_left_mode =
|
{
|
||||||
playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT);
|
/* This means we have to work a little harder
|
||||||
|
* i.e. check whether the cached playlist file
|
||||||
|
* matches the database name */
|
||||||
|
char *playlist_name = NULL;
|
||||||
|
char tmp[PATH_MAX_LENGTH];
|
||||||
|
strlcpy(tmp, playlist_file, sizeof(tmp));
|
||||||
|
playlist_name = path_remove_extension(tmp);
|
||||||
|
playlist_valid = string_is_equal(playlist_name, system);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we have a valid playlist, extract thumbnail modes */
|
||||||
|
if (playlist_valid)
|
||||||
|
{
|
||||||
|
path_data->playlist_right_mode =
|
||||||
|
playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_RIGHT);
|
||||||
|
path_data->playlist_left_mode =
|
||||||
|
playlist_get_thumbnail_mode(playlist, PLAYLIST_THUMBNAIL_LEFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,8 +424,8 @@ static void gfx_widgets_move_end(void *userdata)
|
|||||||
|
|
||||||
gfx_animation_push(&entry);
|
gfx_animation_push(&entry);
|
||||||
|
|
||||||
unfold->flags |= DISPWIDG_FLAG_UNFOLDED;
|
unfold->flags |= DISPWIDG_FLAG_UNFOLDED
|
||||||
unfold->flags |= DISPWIDG_FLAG_UNFOLDING;
|
| DISPWIDG_FLAG_UNFOLDING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MOVING;
|
p_dispwidget->flags &= ~DISPGFX_WIDGET_FLAG_MOVING;
|
||||||
@ -1185,7 +1185,7 @@ static void gfx_widgets_draw_task_msg(
|
|||||||
|
|
||||||
if (msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
|
if (msg->flags & DISPWIDG_FLAG_TASK_FINISHED)
|
||||||
{
|
{
|
||||||
if (msg->flags & DISPWIDG_FLAG_TASK_ERROR)
|
if (msg->flags & DISPWIDG_FLAG_TASK_ERROR) /* TODO/FIXME - localize */
|
||||||
strlcpy(task_percentage, "Task failed", sizeof(task_percentage));
|
strlcpy(task_percentage, "Task failed", sizeof(task_percentage));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1266,11 +1266,7 @@ static void gfx_widgets_draw_task_msg(
|
|||||||
float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */
|
float cosine = 1.0f; /* cos(rad) = cos(0) = 1.0f */
|
||||||
float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */
|
float sine = 0.0f; /* sine(rad) = sine(0) = 0.0f */
|
||||||
if (!(msg->flags & DISPWIDG_FLAG_TASK_FINISHED))
|
if (!(msg->flags & DISPWIDG_FLAG_TASK_FINISHED))
|
||||||
{
|
|
||||||
radians = msg->hourglass_rotation;
|
radians = msg->hourglass_rotation;
|
||||||
cosine = cosf(radians);
|
|
||||||
sine = sinf(radians);
|
|
||||||
}
|
|
||||||
gfx_widgets_draw_icon(
|
gfx_widgets_draw_icon(
|
||||||
userdata,
|
userdata,
|
||||||
p_disp,
|
p_disp,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user