DXGL r711 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r710‎ | r711 | r712 >
Date:07:42, 2 June 2017
Author:admin
Status:new
Tags:
Comment:
Support scaling centered modes.
Fix an if statement always returning true.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -264,7 +264,7 @@
265265 DEVMODE compmode = *array[0];
266266 DWORD newcount = 0;
267267 int i;
268 - if (ScanColorMode(*array, *count, 8));
 268+ if (ScanColorMode(*array, *count, 8))
269269 {
270270 compmode.dmBitsPerPel = 8;
271271 for (i = 0; i < numdoubledmodes; i++)
@@ -281,7 +281,7 @@
282282 }
283283 }
284284 }
285 - if (ScanColorMode(*array, *count, 15));
 285+ if (ScanColorMode(*array, *count, 15))
286286 {
287287 compmode.dmBitsPerPel = 15;
288288 for (i = 0; i < numdoubledmodes; i++)
@@ -298,7 +298,7 @@
299299 }
300300 }
301301 }
302 - if (ScanColorMode(*array, *count, 16));
 302+ if (ScanColorMode(*array, *count, 16))
303303 {
304304 compmode.dmBitsPerPel = 16;
305305 for (i = 0; i < numdoubledmodes; i++)
@@ -315,7 +315,7 @@
316316 }
317317 }
318318 }
319 - if (ScanColorMode(*array, *count, 24));
 319+ if (ScanColorMode(*array, *count, 24))
320320 {
321321 compmode.dmBitsPerPel = 24;
322322 for (i = 0; i < numdoubledmodes; i++)
@@ -332,7 +332,7 @@
333333 }
334334 }
335335 }
336 - if (ScanColorMode(*array, *count, 32));
 336+ if (ScanColorMode(*array, *count, 32))
337337 {
338338 compmode.dmBitsPerPel = 32;
339339 for (i = 0; i < numdoubledmodes; i++)
@@ -1787,10 +1787,10 @@
17881788 if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
17891789 (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
17901790 {
1791 - if (dwWidth <= 400) xscale = 2;
1792 - else xscale = 1;
1793 - if (dwHeight <= 300) yscale = 2;
1794 - else yscale = 1;
 1791+ if (dwWidth <= 400) xscale = 2.0f;
 1792+ else xscale = 1.0f;
 1793+ if (dwHeight <= 300) yscale = 2.0f;
 1794+ else yscale = 1.0f;
17951795 }
17961796 else
17971797 {
@@ -1948,9 +1948,11 @@
19491949 return DD_OK;
19501950 break;
19511951 case 3: // Center image
1952 - primaryx = internalx = dwWidth;
 1952+ primaryx = dwWidth;
 1953+ internalx = dwWidth * xscale;
19531954 screenx = currmode.dmPelsWidth;
1954 - primaryy = internaly = dwHeight;
 1955+ primaryy = dwHeight;
 1956+ internaly = dwHeight * yscale;
19551957 screeny = currmode.dmPelsHeight;
19561958 primarybpp = dwBPP;
19571959 if (dxglcfg.colormode) internalbpp = screenbpp = dwBPP;