DXGL r318 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r317‎ | r318 | r319 >
Date:00:09, 8 February 2013
Author:admin
Status:new
Tags:
Comment:
Add IDirect3DDevice object creation in QueryInterface of IDirect3DDevice7.
Accept DDraw1 Z-buffers in AddAttachedSurface.
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -418,7 +418,23 @@
419419 return D3D_OK;
420420 }
421421 }
422 - ERR(E_NOINTERFACE);
 422+ if(riid == IID_IDirect3DDevice)
 423+ {
 424+ if(glD3DDev1)
 425+ {
 426+ *ppvObj = glD3DDev1;
 427+ glD3DDev1->AddRef();
 428+ return D3D_OK;
 429+ }
 430+ else
 431+ {
 432+ this->AddRef();
 433+ *ppvObj = new glDirect3DDevice1(this);
 434+ glD3DDev1 = (glDirect3DDevice1*)*ppvObj;
 435+ return D3D_OK;
 436+ }
 437+ }
 438+ return E_NOINTERFACE;
423439 }
424440
425441 ULONG WINAPI glDirect3DDevice7::AddRef()
Index: ddraw/glDirectDrawSurface.cpp
@@ -499,7 +499,7 @@
500500 DDSURFACEDESC2 ddsd;
501501 ddsd.dwSize = sizeof(DDSURFACEDESC2);
502502 attached->GetSurfaceDesc(&ddsd);
503 - if(ddsd.ddpfPixelFormat.dwFlags & DDPF_ZBUFFER)
 503+ if((ddsd.ddpfPixelFormat.dwFlags & DDPF_ZBUFFER) || (ddsd.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
504504 {
505505 attached->AddRef();
506506 zbuffer = attached;