Skip to content

Commit

Permalink
Merge pull request #1002 from chungy/unrestricted_aspect
Browse files Browse the repository at this point in the history
video: Don't enforce an 8:5 ratio when correction is not enabled.
  • Loading branch information
fragglet authored Mar 25, 2018
2 parents 98d59e6 + 76ca4ec commit bdb1411
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
loaded. (thanks Zodomaniac, chungy)
* Fixed an exception thrown by the Windows kernel when debugging with
GDB. (thanks AXDOOMER)
* With aspect ratio correction disabled, the game can scale to any
arbitrary size and remove all black borders in full screen mode.
(thanks chungy)

### Build systems
* Microsoft Visual Studio files have been removed due to technical
Expand Down
28 changes: 17 additions & 11 deletions src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,18 @@ void I_StartFrame (void)
// ratio consistent with the aspect_ratio_correct variable.
static void AdjustWindowSize(void)
{
if (window_width * actualheight <= window_height * SCREENWIDTH)
if (aspect_ratio_correct || integer_scaling)
{
// We round up window_height if the ratio is not exact; this leaves
// the result stable.
window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
}
else
{
window_width = window_height * SCREENWIDTH / actualheight;
if (window_width * actualheight <= window_height * SCREENWIDTH)
{
// We round up window_height if the ratio is not exact; this leaves
// the result stable.
window_height = (window_width * actualheight + SCREENWIDTH - 1) / SCREENWIDTH;
}
else
{
window_width = window_height * SCREENWIDTH / actualheight;
}
}
}

Expand Down Expand Up @@ -1240,9 +1243,12 @@ static void SetVideoMode(void)
// time this also defines the aspect ratio that is preserved while scaling
// and stretching the texture into the window.

SDL_RenderSetLogicalSize(renderer,
SCREENWIDTH,
actualheight);
if (aspect_ratio_correct || integer_scaling)
{
SDL_RenderSetLogicalSize(renderer,
SCREENWIDTH,
actualheight);
}

// Force integer scales for resolution-independent rendering.

Expand Down
2 changes: 1 addition & 1 deletion src/setup/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static void AdvancedDisplayConfig(TXT_UNCAST_ARG(widget),
TXT_SetColumnWidths(window, 40);

TXT_AddWidgets(window,
ar_checkbox = TXT_NewCheckBox("Fix aspect ratio",
ar_checkbox = TXT_NewCheckBox("Force correct aspect ratio",
&aspect_ratio_correct),
TXT_If(gamemission == heretic || gamemission == hexen
|| gamemission == strife,
Expand Down

0 comments on commit bdb1411

Please sign in to comment.