DXGL r780 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r779‎ | r780 | r781 >
Date:02:43, 17 December 2017
Author:admin
Status:new
Tags:
Comment:
Add fixed and custom primary scaling.
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+ int i;
7677 float xscale, yscale;
7778 ddInterface->GetSizes(sizes);
7879 if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
@@ -105,8 +106,72 @@
106107 xscale = dxglcfg.postsizex;
107108 yscale = dxglcfg.postsizey;
108109 }
109 - fakex = (DWORD)((float)sizes[0] / xscale);
110 - fakey = (DWORD)((float)sizes[1] / yscale);
 110+ switch (dxglcfg.primaryscale)
 111+ {
 112+ case 1: // Scale to window size
 113+ default:
 114+ fakex = (DWORD)((float)sizes[0] / xscale);
 115+ fakey = (DWORD)((float)sizes[1] / yscale);
 116+ break;
 117+ case 2: // Scale to integer auto
 118+ for (i = 1; i < 100; i++)
 119+ {
 120+ if ((ddsd.dwWidth * i) >(DWORD)((float)sizes[0] / xscale))
 121+ {
 122+ fakex = ddsd.dwWidth * i;
 123+ break;
 124+ }
 125+ }
 126+ for (i = 1; i < 100; i++)
 127+ {
 128+ if ((ddsd.dwHeight * i) >(DWORD)((float)sizes[1] / yscale))
 129+ {
 130+ fakey = ddsd.dwHeight * i;
 131+ break;
 132+ }
 133+ }
 134+ break;
 135+ case 3: // 1.5x scale
 136+ fakex = (DWORD)((float)ddsd.dwWidth * 1.5f);
 137+ fakey = (DWORD)((float)ddsd.dwHeight * 1.5f);
 138+ break;
 139+ case 4: // 2x scale
 140+ fakex = ddsd.dwWidth * 2;
 141+ fakey = ddsd.dwHeight * 2;
 142+ break;
 143+ case 5: // 2.5x scale
 144+ fakex = (DWORD)((float)ddsd.dwWidth * 2.5f);
 145+ fakey = (DWORD)((float)ddsd.dwHeight * 2.5f);
 146+ break;
 147+ case 6: // 3x scale
 148+ fakex = ddsd.dwWidth * 3;
 149+ fakey = ddsd.dwHeight * 3;
 150+ break;
 151+ case 7: // 4x scale
 152+ fakex = ddsd.dwWidth * 4;
 153+ fakey = ddsd.dwHeight * 4;
 154+ break;
 155+ case 8: // 5x scale
 156+ fakex = ddsd.dwWidth * 5;
 157+ fakey = ddsd.dwHeight * 5;
 158+ break;
 159+ case 9: // 6x scale
 160+ fakex = ddsd.dwWidth * 6;
 161+ fakey = ddsd.dwHeight * 6;
 162+ break;
 163+ case 10: // 7x scale
 164+ fakex = ddsd.dwWidth * 7;
 165+ fakey = ddsd.dwHeight * 7;
 166+ break;
 167+ case 11: // 8x scale
 168+ fakex = ddsd.dwWidth * 8;
 169+ fakey = ddsd.dwHeight * 8;
 170+ break;
 171+ case 12: // Custom scale
 172+ fakex = (DWORD)((float)ddsd.dwWidth * dxglcfg.primaryscalex);
 173+ fakey = (DWORD)((float)ddsd.dwHeight * dxglcfg.primaryscaley);
 174+ break;
 175+ }
111176 }
112177 else
113178 {
@@ -1245,7 +1310,7 @@
12461311 void glDirectDrawSurface7::Restore2()
12471312 {
12481313 TRACE_ENTER(1,14,this);
1249 - /*LONG sizes[6];
 1314+# /*LONG sizes[6];
12501315 float xscale, yscale;
12511316 if(hRC != ddInterface->renderer->hRC)
12521317 {