Skip to content

Commit

Permalink
RGUI integer scale fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sonninnos committed Oct 15, 2024
1 parent de38db7 commit 3ad024e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2372,6 +2372,14 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
}
#endif

if (content_width < 2 || content_height < 2)
return;

content_width = (content_width == 4) ? video_st->av_info.geometry.base_width : content_width;
content_height = (content_height == 4) ? video_st->av_info.geometry.base_height : content_height;
content_width = (content_width > width) ? width : content_width;
content_height = (content_height > height) ? height : content_height;

if (!ydown)
viewport_bias_y = 1.0 - viewport_bias_y;

Expand All @@ -2386,12 +2394,6 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
* system->av_info.base_height. */
content_width = (unsigned)roundf(content_height * aspect_ratio);

if (content_width < 2 || content_height < 2)
return;

content_width = (content_width > width) ? width : content_width;
content_height = (content_height > height) ? height : content_height;

if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
struct video_viewport *custom_vp = &settings->video_viewport_custom;
Expand Down Expand Up @@ -2481,7 +2483,10 @@ void video_viewport_get_scaled_integer(struct video_viewport *vp,
uint8_t i = 0;

/* Reset width to exact width */
content_width = (rotation % 2) ? video_st->frame_cache_height : video_st->frame_cache_width;
content_width = (rotation % 2)
? ((video_st->frame_cache_height == 4) ? video_st->av_info.geometry.base_height : video_st->frame_cache_height)
: ((video_st->frame_cache_width == 4) ? video_st->av_info.geometry.base_width : video_st->frame_cache_width);

overscale_w = (width / content_width) + !!(width % content_width);

/* Populate the ratios */
Expand Down

0 comments on commit 3ad024e

Please sign in to comment.