DXGL r573 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r572‎ | r573 | r574 >
Date:20:18, 7 December 2014
Author:admin
Status:new
Tags:
Comment:
Separate D3DVIEWPORT and D3DVIEWPORT2 structures in viewport interface.
Modified paths:
  • /ddraw/glDirect3DViewport.cpp (modified) (history)
  • /ddraw/glDirect3DViewport.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DViewport.cpp
@@ -75,7 +75,8 @@
7676 newvp->background = 0;
7777 ZeroMemory(&newvp->viewport,sizeof(D3DVIEWPORT2));
7878 newvp->viewport.dwSize = sizeof(D3DVIEWPORT2);
79 - newvp->maxX = newvp->maxY = newvp->scaleX = newvp->scaleY = 0;
 79+ ZeroMemory(&newvp->viewport, sizeof(D3DVIEWPORT));
 80+ newvp->viewport.dwSize = sizeof(D3DVIEWPORT);
8081 newvp->device = NULL;
8182 newvp->backZ = NULL;
8283 for(int i = 0; i < 8; i++)
@@ -251,11 +252,7 @@
252253 TRACE_ENTER(2,14,This,14,lpData);
253254 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
254255 if(!lpData) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
255 - memcpy(lpData,&This->viewport,sizeof(D3DVIEWPORT2));
256 - lpData->dvScaleX = This->scaleX;
257 - lpData->dvScaleY = This->scaleY;
258 - lpData->dvMaxX = This->maxX;
259 - lpData->dvMaxY = This->maxY;
 256+ memcpy(lpData,&This->viewport1,sizeof(D3DVIEWPORT2));
260257 TRACE_EXIT(23,D3D_OK);
261258 return D3D_OK;
262259 }
@@ -342,10 +339,10 @@
343340 vp.dvClipY = This->viewport.dvClipY;
344341 if((vp.dvMinZ == 0) && (vp.dvMaxZ == 0)) vp.dvMaxZ = 1.0f;
345342 This->viewport = vp;
346 - This->maxX = lpData->dvMaxX;
347 - This->maxY = lpData->dvMaxY;
348 - This->scaleX = lpData->dvScaleX;
349 - This->scaleY = lpData->dvScaleY;
 343+ This->viewport1 = *lpData;
 344+ if ((This->viewport1.dvMinZ == 0) && (This->viewport1.dvMaxZ == 0))
 345+ This->viewport1.dvMaxZ = 1.0f;
 346+ This->viewportver = 1;
350347 if(This->current && This->device) glDirect3DViewport3_Sync(This);
351348 TRACE_EXIT(23,D3D_OK);
352349 return D3D_OK;
@@ -356,8 +353,18 @@
357354 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
358355 if(!This->device) TRACE_RET(HRESULT,23,D3DERR_VIEWPORTHASNODEVICE);
359356 if(!lpData) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
 357+ D3DVIEWPORT vp;
 358+ memcpy(&vp, lpData, sizeof(D3DVIEWPORT2));
 359+ vp.dvMaxX = This->viewport1.dvMaxX;
 360+ vp.dvMaxY = This->viewport1.dvMaxY;
 361+ vp.dvScaleX = This->viewport1.dvScaleX;
 362+ vp.dvScaleY = This->viewport1.dvScaleY;
 363+ if ((vp.dvMinZ == 0) && (vp.dvMaxZ == 0)) vp.dvMaxZ = 1.0f;
360364 This->viewport = *lpData;
361 - if(This->current && This->device) glDirect3DViewport3_Sync(This);
 365+ This->viewport1 = vp;
 366+ if ((This->viewport.dvMinZ == 0) && (This->viewport.dvMaxZ == 0))
 367+ This->viewport.dvMaxZ = 1.0f;
 368+ if (This->current && This->device) glDirect3DViewport3_Sync(This);
362369 TRACE_EXIT(23,D3D_OK);
363370 return D3D_OK;
364371 }
@@ -403,7 +410,7 @@
404411 vp7.dvMinZ = This->viewport.dvMinZ;
405412 vp7.dvMaxZ = This->viewport.dvMaxZ;
406413 This->device->SetViewport(&vp7);
407 - This->device->SetScale(This->scaleX,This->scaleY);
 414+ This->device->SetScale(This->viewport1.dvScaleX,This->viewport1.dvScaleY);
408415 TRACE_EXIT(0,0);
409416 }
410417
Index: ddraw/glDirect3DViewport.h
@@ -40,11 +40,9 @@
4141 glDirect3DDevice7 *device;
4242 glDirectDrawSurface7 *backZ;
4343 D3DMATERIALHANDLE background;
 44+ D3DVIEWPORT viewport1;
4445 D3DVIEWPORT2 viewport;
45 - D3DVALUE maxX;
46 - D3DVALUE maxY;
47 - D3DVALUE scaleX;
48 - D3DVALUE scaleY;
 46+ int viewportver;
4947 bool current;
5048 };
5149