@@ -1149,11 +1149,13 @@ static void ResetResolution(int height, boolean reset_pitch)
1149
1149
1150
1150
video .unscaledw = (int )(unscaled_actualheight * aspect_ratio );
1151
1151
1152
- video .unscaledw &= ~1 ;
1152
+ // Unscaled widescreen 16:9 resolution truncates to 426x240, which is not
1153
+ // quite 16:9. To avoid visual instability, we calculate the scaled width
1154
+ // without the actual aspect ratio. For example, at 1280x720 we get
1155
+ // 1278x720.
1153
1156
1154
- video .width = (int )(actualheight * aspect_ratio );
1155
-
1156
- video .width &= ~1 ;
1157
+ double vertscale = (double )actualheight / (double )unscaled_actualheight ;
1158
+ video .width = (int )ceil (video .unscaledw * vertscale );
1157
1159
1158
1160
// [FG] For performance reasons, SDL2 insists that the screen pitch, i.e.
1159
1161
// the *number of bytes* that one horizontal row of pixels occupy in
@@ -1176,7 +1178,8 @@ static void ResetResolution(int height, boolean reset_pitch)
1176
1178
if (automapactive )
1177
1179
AM_ResetScreenSize ();
1178
1180
1179
- I_Printf (VB_DEBUG , "ResetResolution: %dx%d" , video .width , video .height );
1181
+ I_Printf (VB_DEBUG , "ResetResolution: %dx%d (%dx%d)" ,
1182
+ video .width , video .height , video .unscaledw , SCREENHEIGHT );
1180
1183
1181
1184
drs_skip_frame = true;
1182
1185
}
@@ -1699,11 +1702,11 @@ void I_InitGraphics(void)
1699
1702
static struct {
1700
1703
int w , h ;
1701
1704
} native_res [] = {
1702
- // { 320, 240 },
1705
+ { 320 , 240 },
1703
1706
{ 640 , 480 },
1704
1707
{ 800 , 600 },
1705
1708
{ 1024 , 768 },
1706
- // { 1280, 1024 },
1709
+ { 1280 , 1024 },
1707
1710
{ 1280 , 720 },
1708
1711
{ 1280 , 800 },
1709
1712
{ 1366 , 768 },
@@ -1717,6 +1720,7 @@ static struct {
1717
1720
{ 2304 , 1440 },
1718
1721
{ 2560 , 1600 },
1719
1722
{ 3200 , 2400 },
1723
+ { 3440 , 1440 },
1720
1724
{ 3840 , 2160 },
1721
1725
{ 5120 , 2160 }
1722
1726
};
@@ -1730,6 +1734,7 @@ boolean I_ChangeRes(void)
1730
1734
1731
1735
native_height_adjusted = (int )(native_height / 1.2 );
1732
1736
1737
+ printf ("I_ChangeRes: %dx%d\n" , native_width , native_height );
1733
1738
ResetResolution (native_height_adjusted , true);
1734
1739
CreateSurfaces (video .pitch , video .height );
1735
1740
ResetLogicalSize ();
@@ -1748,8 +1753,8 @@ void I_CheckHOM(void)
1748
1753
{
1749
1754
if (I_VideoBuffer [video .width - 1 ] == v_lightest_color )
1750
1755
{
1751
- printf ("HOM %dx%d \n" ,
1752
- native_res [ curr_test_res - 1 ]. w , native_res [ curr_test_res - 1 ]. h ) ;
1756
+ printf ("HOM\n" );
1757
+ //run_test = false ;
1753
1758
break ;
1754
1759
}
1755
1760
}
0 commit comments