DXGL r822 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r821‎ | r822 | r823 >
Date:01:54, 24 June 2018
Author:admin
Status:new
Tags:
Comment:
Modified paths:
  • /Help/html/config/display/videomode.htmlbody (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)

Diff [purge]

Index: Help/html/config/display/videomode.htmlbody
@@ -20,4 +20,9 @@
2121 <h1>Custom display mode</h1>
2222 <p>Switches the display to the mode specified under &#8220;Custom resolution&#8221; and stretches the image to fit to that mode.</p>
2323 <h1>Custom size, centered</h1>
24 -<p>Stretches the primary surface to the size specified under &#8220;Custom resolution&#8221; and centers it on the display.</p>
\ No newline at end of file
 24+<p>Stretches the primary surface to the size specified under &#8220;Custom resolution&#8221; and centers it on the display.</p>
 25+<p>
 26+ <span style="font-size: 8pt;">
 27+ <em>Custom size multiplier, Custom display mode, and Custom size, centered are implemented in DXGL 0.5.14 and later.</em>
 28+ </span>
 29+</p>
\ No newline at end of file
Index: ddraw/glDirectDraw.cpp
@@ -2398,6 +2398,73 @@
23992399 TRACE_EXIT(23, DD_OK);
24002400 return DD_OK;
24012401 break;
 2402+ case 8: // Custom size multiplier
 2403+ primaryx = dwWidth;
 2404+ internalx = dwWidth * xscale;
 2405+ if (dxglcfg.DisplayMultiplierX) internalx *= dxglcfg.DisplayMultiplierX;
 2406+ screenx = currmode.dmPelsWidth;
 2407+ primaryy = dwHeight;
 2408+ internaly = dwHeight * yscale;
 2409+ if (dxglcfg.DisplayMultiplierY) internaly *= dxglcfg.DisplayMultiplierY;
 2410+ screeny = currmode.dmPelsHeight;
 2411+ primarybpp = dwBPP;
 2412+ if (dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
 2413+ else internalbpp = screenbpp = currmode.dmBitsPerPel;
 2414+ if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
 2415+ else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
 2416+ InitGL(screenx, screeny, screenbpp, true, internalrefresh, hWnd, this, devwnd);
 2417+ //glRenderer_SetBPP(this->renderer, primarybpp);
 2418+ TRACE_EXIT(23, DD_OK);
 2419+ return DD_OK;
 2420+ break;
 2421+ case 9: // Custom display mode
 2422+ newmode.dmSize = sizeof(DEVMODE);
 2423+ newmode.dmDriverExtra = 0;
 2424+ newmode.dmPelsWidth = dxglcfg.CustomResolutionX;
 2425+ newmode.dmPelsHeight = dxglcfg.CustomResolutionY;
 2426+ if (dxglcfg.colormode)
 2427+ newmode.dmBitsPerPel = dwBPP;
 2428+ else newmode.dmBitsPerPel = currmode.dmBitsPerPel;
 2429+ newmode.dmDisplayFrequency = dxglcfg.CustomRefresh;
 2430+ if (dxglcfg.CustomRefresh) newmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
 2431+ else newmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
 2432+ flags = 0;
 2433+ if (fullscreen) flags |= CDS_FULLSCREEN;
 2434+ error = ChangeDisplaySettingsEx(NULL, &newmode, NULL, flags, NULL);
 2435+ if (error == DISP_CHANGE_SUCCESSFUL) currmode = newmode;
 2436+ primaryx = dwWidth;
 2437+ internalx = screenx = currmode.dmPelsWidth;
 2438+ primaryy = dwHeight;
 2439+ internaly = screeny = currmode.dmPelsHeight;
 2440+ if (crop400) internaly *= 1.2f;
 2441+ if (dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
 2442+ else internalbpp = screenbpp = currmode.dmBitsPerPel;
 2443+ if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
 2444+ else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
 2445+ primarybpp = dwBPP;
 2446+ InitGL(screenx, screeny, screenbpp, true, internalrefresh, hWnd, this, devwnd);
 2447+ //glRenderer_SetBPP(this->renderer, primarybpp);
 2448+ primarylost = true;
 2449+ TRACE_EXIT(23, DD_OK);
 2450+ return DD_OK;
 2451+ break;
 2452+ case 10: // Custom size, centered
 2453+ primaryx = dwWidth;
 2454+ internalx = dxglcfg.CustomResolutionX;
 2455+ screenx = currmode.dmPelsWidth;
 2456+ primaryy = dwHeight;
 2457+ internaly = dxglcfg.CustomResolutionY;
 2458+ screeny = currmode.dmPelsHeight;
 2459+ primarybpp = dwBPP;
 2460+ if (dxglcfg.colormode) internalbpp = screenbpp = dwBPP;
 2461+ else internalbpp = screenbpp = currmode.dmBitsPerPel;
 2462+ if (dwRefreshRate) internalrefresh = primaryrefresh = screenrefresh = dwRefreshRate;
 2463+ else internalrefresh = primaryrefresh = screenrefresh = currmode.dmDisplayFrequency;
 2464+ InitGL(screenx, screeny, screenbpp, true, internalrefresh, hWnd, this, devwnd);
 2465+ //glRenderer_SetBPP(this->renderer, primarybpp);
 2466+ TRACE_EXIT(23, DD_OK);
 2467+ return DD_OK;
 2468+ break;
24022469 }
24032470 break;
24042471 case 2: