Simplify some code in gfx_display.c

This commit is contained in:
libretroadmin 2023-05-28 21:34:57 +02:00
parent 976d7b8067
commit 3b823d18d5
3 changed files with 9 additions and 14 deletions

View File

@ -123,7 +123,7 @@ static gfx_display_ctx_driver_t *gfx_display_ctx_drivers[] = {
NULL,
};
float gfx_display_get_adjusted_scale(
static float gfx_display_get_adjusted_scale(
gfx_display_t *p_disp,
float base_scale, float scale_factor, unsigned width)
{

View File

@ -308,10 +308,6 @@ bool gfx_display_reset_textures_list_buffer(
int gfx_display_osk_ptr_at_pos(void *data, int x, int y,
unsigned width, unsigned height);
float gfx_display_get_adjusted_scale(
gfx_display_t *p_disp,
float base_scale, float scale_factor, unsigned width);
float gfx_display_get_dpi_scale(
gfx_display_t *p_disp,
void *settings_data,

View File

@ -139,9 +139,9 @@ static float gfx_display_get_widget_pixel_scale(
* to optimise). We therefore cache the pixel scale,
* and only update on first run or when the video
* size changes */
if (!scale_cached ||
(width != last_width) ||
(height != last_height))
if ( !scale_cached
|| (width != last_width)
|| (height != last_height))
{
/* Baseline reference is a 1080p display */
scale = (float)(
@ -156,13 +156,12 @@ static float gfx_display_get_widget_pixel_scale(
/* Adjusted scale calculation may also be slow, so
* only update if something changes */
if (scale_updated ||
(menu_scale_factor != last_menu_scale_factor) ||
(p_disp->menu_driver_id != last_menu_driver_id))
if ( scale_updated
|| (menu_scale_factor != last_menu_scale_factor)
|| (p_disp->menu_driver_id != last_menu_driver_id))
{
adjusted_scale = gfx_display_get_adjusted_scale(
p_disp,
scale, menu_scale_factor, width);
adjusted_scale = scale * menu_scale_factor;
adjusted_scale = (adjusted_scale > 0.0001f) ? adjusted_scale : 1.0f;
last_menu_scale_factor = menu_scale_factor;
last_menu_driver_id = p_disp->menu_driver_id;
}