Skip to content

Commit

Permalink
Integer scaling improvements (#17606)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos authored Feb 20, 2025
1 parent fce67c1 commit 61de3a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2512,11 +2512,15 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
if (overscale_h_diff <= underscale_h_diff)
max_scale_h = overscale_h;

/* Limit width overscale */
if (max_scale_w * content_width >= width + ((int)content_width / 2))
max_scale_w = underscale_w;

/* Allow overscale when it is close enough */
if (scale_h_diff > 0 && scale_h_diff < 64)
max_scale_h = overscale_h;
/* Overscale will be too much even if it is closer */
else if ((scale_h_diff < -155 && scale_h_diff > (int)-content_height / 2)
else if ((scale_h_diff < -140 && scale_h_diff >= (int)-content_height / 2)
|| (scale_h_diff < -30 && scale_h_diff > -50)
|| (scale_h_diff > 20))
max_scale_h = underscale_h;
Expand Down Expand Up @@ -2617,7 +2621,7 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
|| axis == VIDEO_SCALE_INTEGER_AXIS_XHALF)
{
if ( max_scale_h == (height / content_height)
&& content_height / 300
&& content_height / ((rotation % 2) ? 288 : 300)
&& content_height * max_scale_h < height * 0.90f
)
{
Expand Down

0 comments on commit 61de3a3

Please sign in to comment.