DXGL r714 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r713‎ | r714 | r715 >
Date:23:27, 11 June 2017
Author:admin
Status:new
Tags:
Comment:
Support super/subsampling in "Adjust primary resolution" and "Change desktop resolution"
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -486,7 +486,8 @@
487487 if (!_isnan(dxglcfg.firstscalex) && !_isnan(dxglcfg.firstscaley) &&
488488 (dxglcfg.firstscalex > 0.25f) && (dxglcfg.firstscaley > 0.25f) &&
489489 (dxglcfg.firstscalex != 1.0f) && (dxglcfg.firstscaley != 1.0f) &&
490 - ((dxglcfg.scaler == 0) || ((dxglcfg.scaler >= 4) && (dxglcfg.scaler <= 6))))
 490+ ((dxglcfg.scaler == 0) || ((dxglcfg.scaler >= 4) && (dxglcfg.scaler <= 6))) &&
 491+ (!dxglcfg.primaryscale))
491492 scalemodes = TRUE;
492493 else scalemodes = FALSE;
493494 while(EnumDisplaySettings(NULL,modenum++,&mode))
@@ -1809,8 +1810,17 @@
18101811 default:
18111812 newmode.dmSize = sizeof(DEVMODE);
18121813 newmode.dmDriverExtra = 0;
1813 - newmode.dmPelsWidth = dwWidth * xscale;
1814 - newmode.dmPelsHeight = dwHeight * yscale;
 1814+ if (!dxglcfg.primaryscale || (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
 1815+ (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f)))
 1816+ {
 1817+ newmode.dmPelsWidth = dwWidth * xscale;
 1818+ newmode.dmPelsHeight = dwHeight * yscale;
 1819+ }
 1820+ else
 1821+ {
 1822+ newmode.dmPelsWidth = dwWidth;
 1823+ newmode.dmPelsHeight = dwHeight;
 1824+ }
18151825 if (dxglcfg.colormode)
18161826 newmode.dmBitsPerPel = dwBPP;
18171827 else newmode.dmBitsPerPel = currmode.dmBitsPerPel;
@@ -1824,9 +1834,17 @@
18251835 {
18261836 case DISP_CHANGE_SUCCESSFUL:
18271837 if (fullscreen) this->currmode = newmode;
1828 - primaryx = newmode.dmPelsWidth / xscale;
 1838+ if (dxglcfg.primaryscale)
 1839+ {
 1840+ primaryx = newmode.dmPelsWidth;
 1841+ primaryy = newmode.dmPelsHeight;
 1842+ }
 1843+ else
 1844+ {
 1845+ primaryx = newmode.dmPelsWidth / xscale;
 1846+ primaryy = newmode.dmPelsHeight / yscale;
 1847+ }
18291848 screenx = newmode.dmPelsWidth;
1830 - primaryy = newmode.dmPelsHeight / yscale;
18311849 screeny = newmode.dmPelsHeight;
18321850 internalx = newmode.dmPelsWidth;
18331851 internaly = newmode.dmPelsHeight;