mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 22:13:51 +00:00
(Ozone+XMB) Savestate thumbnail aspect ratio (#14139)
This commit is contained in:
parent
b021f96522
commit
91c8541e20
@ -787,8 +787,10 @@ void gfx_thumbnail_get_draw_dimensions(
|
||||
unsigned width, unsigned height, float scale_factor,
|
||||
float *draw_width, float *draw_height)
|
||||
{
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
float display_aspect;
|
||||
float thumbnail_aspect;
|
||||
float core_aspect;
|
||||
|
||||
/* Sanity check */
|
||||
if (!thumbnail || (width < 1) || (height < 1))
|
||||
@ -797,20 +799,31 @@ void gfx_thumbnail_get_draw_dimensions(
|
||||
if ((thumbnail->width < 1) || (thumbnail->height < 1))
|
||||
goto error;
|
||||
|
||||
/* Account for display/thumbnail aspect ratio
|
||||
/* Account for display/thumbnail/core aspect ratio
|
||||
* differences */
|
||||
display_aspect = (float)width / (float)height;
|
||||
thumbnail_aspect = (float)thumbnail->width / (float)thumbnail->height;
|
||||
core_aspect = (thumbnail->core_aspect && video_st)
|
||||
? video_st->av_info.geometry.aspect_ratio : thumbnail_aspect;
|
||||
|
||||
if (thumbnail_aspect > display_aspect)
|
||||
{
|
||||
*draw_width = (float)width;
|
||||
*draw_height = (float)thumbnail->height * (*draw_width / (float)thumbnail->width);
|
||||
*draw_height = *draw_height * (thumbnail_aspect / core_aspect);
|
||||
|
||||
if (*draw_height > height)
|
||||
{
|
||||
*draw_height = (float)height;
|
||||
*draw_width = (float)thumbnail->width * (*draw_height / (float)thumbnail->height);
|
||||
*draw_width = *draw_width / (thumbnail_aspect / core_aspect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*draw_height = (float)height;
|
||||
*draw_width = (float)thumbnail->width * (*draw_height / (float)thumbnail->height);
|
||||
*draw_width = *draw_width / (thumbnail_aspect / core_aspect);
|
||||
}
|
||||
|
||||
/* Account for scale factor
|
||||
|
@ -74,6 +74,7 @@ typedef struct
|
||||
float delay_timer;
|
||||
enum gfx_thumbnail_status status;
|
||||
bool fade_active;
|
||||
bool core_aspect;
|
||||
} gfx_thumbnail_t;
|
||||
|
||||
/* Holds all configuration parameters associated
|
||||
|
@ -3397,6 +3397,8 @@ static void ozone_update_savestate_thumbnail_image(void *data)
|
||||
if (!((ozone->is_quick_menu || ozone->is_state_slot) && ozone->libretro_running))
|
||||
return;
|
||||
|
||||
ozone->thumbnails.savestate.core_aspect = true;
|
||||
|
||||
/* If path is empty, just reset thumbnail */
|
||||
if (string_is_empty(ozone->savestate_thumbnail_file_path))
|
||||
gfx_thumbnail_reset(&ozone->thumbnails.savestate);
|
||||
|
@ -1432,6 +1432,8 @@ static void xmb_update_savestate_thumbnail_image(void *data)
|
||||
if (!((xmb->is_quick_menu || xmb->is_state_slot) && xmb->libretro_running))
|
||||
return;
|
||||
|
||||
xmb->thumbnails.savestate.core_aspect = true;
|
||||
|
||||
/* If path is empty, just reset thumbnail */
|
||||
if (string_is_empty(xmb->savestate_thumbnail_file_path))
|
||||
gfx_thumbnail_reset(&xmb->thumbnails.savestate);
|
||||
|
Loading…
x
Reference in New Issue
Block a user