DXGL r713 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r712‎ | r713 | r714 >
Date:00:12, 4 June 2017
Author:admin
Status:new
Tags:
Comment:
First pass scaling affects "Adjust Primary Resolution" now.
Use .5x for supersampled AA, over 1x for subsampling.
Modified paths:
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawSurface.cpp
@@ -72,6 +72,7 @@
7373 ddsd = *lpDDSurfaceDesc2;
7474 miptexture = NULL;
7575 LONG sizes[6];
 76+ float xscale, yscale;
7677 ddInterface->GetSizes(sizes);
7778 if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
7879 {
@@ -89,10 +90,23 @@
9091 {
9192 ddsd.dwWidth = sizes[2];
9293 ddsd.dwHeight = sizes[3];
93 - if(dxglcfg.primaryscale) // FIXME: Support new scaling modes
 94+ if(dxglcfg.primaryscale)
9495 {
95 - fakex = sizes[0];
96 - fakey = sizes[1];
 96+ if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
 97+ (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 98+ {
 99+ if (ddsd.dwWidth <= 400) xscale = 2.0f;
 100+ else xscale = 1.0f;
 101+ if (ddsd.dwHeight <= 300) yscale = 2.0f;
 102+ else yscale = 1.0f;
 103+ }
 104+ else
 105+ {
 106+ xscale = dxglcfg.firstscalex;
 107+ yscale = dxglcfg.firstscaley;
 108+ }
 109+ fakex = (DWORD)((float)sizes[0] / xscale);
 110+ fakey = (DWORD)((float)sizes[1] / yscale);
97111 }
98112 else
99113 {
@@ -1208,6 +1222,7 @@
12091223 {
12101224 TRACE_ENTER(1,14,this);
12111225 /*LONG sizes[6];
 1226+ float xscale, yscale;
12121227 if(hRC != ddInterface->renderer->hRC)
12131228 {
12141229 ddInterface->GetSizes(sizes);
@@ -1215,10 +1230,23 @@
12161231 {
12171232 ddsd.dwWidth = sizes[2];
12181233 ddsd.dwHeight = sizes[3];
1219 - if(dxglcfg.primaryscale) // FIXME: Support new scaling modes
 1234+ if(dxglcfg.primaryscale)
12201235 {
1221 - fakex = sizes[0];
1222 - fakey = sizes[1];
 1236+ if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
 1237+ (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 1238+ {
 1239+ if (ddsd.dwWidth <= 400) xscale = 2.0f;
 1240+ else xscale = 1.0f;
 1241+ if (ddsd.dwHeight <= 300) yscale = 2.0f;
 1242+ else yscale = 1.0f;
 1243+ }
 1244+ else
 1245+ {
 1246+ xscale = dxglcfg.firstscalex;
 1247+ yscale = dxglcfg.firstscaley;
 1248+ }
 1249+ fakex = (DWORD)((float)sizes[0] / xscale);
 1250+ fakey = (DWORD)((float)sizes[1] / yscale);
12231251 }
12241252 else
12251253 {
@@ -1245,6 +1273,7 @@
12461274 TRACE_ENTER(1,14,this);
12471275 if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
12481276 LONG sizes[6];
 1277+ //float xscale, yscale;
12491278 if(!ddInterface->renderer) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
12501279 /*if(hRC != ddInterface->renderer->hRC)
12511280 {
@@ -1255,10 +1284,23 @@
12561285 {
12571286 ddsd.dwWidth = sizes[2];
12581287 ddsd.dwHeight = sizes[3];
1259 - if(dxglcfg.primaryscale) // FIXME: Support new scaling modes
 1288+ if(dxglcfg.primaryscale)
12601289 {
1261 - fakex = sizes[0];
1262 - fakey = sizes[1];
 1290+ if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
 1291+ (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 1292+ {
 1293+ if (ddsd.dwWidth <= 400) xscale = 2.0f;
 1294+ else xscale = 1.0f;
 1295+ if (ddsd.dwHeight <= 300) yscale = 2.0f;
 1296+ else yscale = 1.0f;
 1297+ }
 1298+ else
 1299+ {
 1300+ xscale = dxglcfg.firstscalex;
 1301+ yscale = dxglcfg.firstscaley;
 1302+ }
 1303+ fakex = (DWORD)((float)sizes[0] / xscale);
 1304+ fakey = (DWORD)((float)sizes[1] / yscale);
12631305 }
12641306 else
12651307 {