DXGL r464 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r463‎ | r464 | r465 >
Date:23:58, 13 July 2014
Author:admin
Status:new
Tags:
Comment:
Fix Blt ROP test.
Add dwSize validation to IDirectDrawSurface::GetCaps.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /dxgltest/Tests2D.cpp (modified) (history)
  • /dxgltest/surfacegen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -948,6 +948,7 @@
949949 else if(lpDDHELCaps) ddCaps.dwSize = lpDDHELCaps->dwSize;
950950 else TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
951951 if(ddCaps.dwSize > sizeof(DDCAPS_DX7)) ddCaps.dwSize = sizeof(DDCAPS_DX7);
 952+ if (ddCaps.dwSize < sizeof(DDCAPS_DX3)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
952953 ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
953954 DDCAPS_COLORKEY | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM |
954955 DDCAPS_3D;
Index: dxgltest/Tests2D.cpp
@@ -661,6 +661,7 @@
662662 ddinterface->CreateSurface(&sprites[4].ddsd, &sprites[4].surface, NULL);
663663 ddinterface->CreateSurface(&sprites[5].ddsd, &sprites[5].surface, NULL);
664664 DDCAPS ddcaps;
 665+ ddcaps.dwSize = sizeof(DDCAPS);
665666 ddinterface->GetCaps(&ddcaps, NULL);
666667 DrawROPPatterns(ddsrender, sprites, backbuffers, ddver, bpp, ddcaps.dwRops,hWnd,palette);
667668 }
Index: dxgltest/surfacegen.cpp
@@ -1013,6 +1013,7 @@
10141014 {
10151015 if (rop_texture_usage[i] & 4) bltfx.lpDDSPattern = (LPDIRECTDRAWSURFACE)sprites[5].surface->GetSurface();
10161016 else bltfx.lpDDSPattern = NULL;
 1017+ bltfx.dwROP = rop_codes[i];
10171018 sprites[0].surface->Blt(&bltrect, sprites[2].surface, NULL, DDBLT_ROP | DDBLT_WAIT, &bltfx);
10181019 }
10191020 else
@@ -1115,4 +1116,5 @@
11161117 back->BltFast(0, 16, sprites[1].surface, NULL, DDBLTFAST_WAIT);
11171118 back->Release();
11181119 }
 1120+ free(bmi);
11191121 }
\ No newline at end of file