DXGL r619 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r618‎ | r619 | r620 >
Date:13:44, 27 September 2015
Author:admin
Status:new
Tags:
Comment:
Cleanup texture DIB on delete.
Fix 8-bit surface format and resulting DIB structure heap corruption.
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glTexture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -270,8 +270,8 @@
271271 {
272272 GetClientRect(This->hWnd,&r);
273273 GetClientRect(This->RenderWnd->GetHWnd(),&r2);
274 - if(memcmp(&r2,&r,sizeof(RECT)))
275 - SetWindowPos(This->RenderWnd->GetHWnd(),NULL,0,0,r.right,r.bottom,SWP_SHOWWINDOW);
 274+ if(memcmp(&r2,&r,sizeof(RECT)) != 0)
 275+ SetWindowPos(This->RenderWnd->GetHWnd(),NULL,0,0,r.right,r.bottom,SWP_SHOWWINDOW);
276276 }
277277 This->inputs[0] = cmd;
278278 This->opcode = OP_BLT;
@@ -2983,7 +2983,7 @@
29842984
29852985 void glRenderer__SetMaterial(glRenderer *This, LPD3DMATERIAL7 lpMaterial)
29862986 {
2987 - memcpy(&This->material, lpMaterial, sizeof(D3DMATERIAL));
 2987+ memcpy(&This->material, lpMaterial, sizeof(D3DMATERIAL7));
29882988 SetEvent(This->busy);
29892989 }
29902990
Index: ddraw/glTexture.cpp
@@ -104,7 +104,7 @@
105105 switch (screenbpp)
106106 {
107107 case 8:
108 - (*texture)->ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB & DDPF_PALETTEINDEXED8;
 108+ (*texture)->ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
109109 (*texture)->ddsd.ddpfPixelFormat.dwRBitMask = 0;
110110 (*texture)->ddsd.ddpfPixelFormat.dwGBitMask = 0;
111111 (*texture)->ddsd.ddpfPixelFormat.dwBBitMask = 0;
@@ -572,7 +572,7 @@
573573 if (texture->mipmaps[i].buffer && !texture->clientmem && !i) free(texture->mipmaps[i].buffer);
574574 if (texture->mipmaps[i].bigbuffer) free(texture->mipmaps[i].bigbuffer);
575575 if (texture->mipmaps[i].gdibuffer) {}
576 - if (texture->mipmaps[i].dib.hdc) {}
 576+ if (texture->mipmaps[i].dib.hdc) glTexture__DeleteDIB(texture, i);
577577 if (texture->mipmaps[i].fbo.fbo) glUtil_DeleteFBO(texture->util,&texture->mipmaps[i].fbo);
578578 }
579579 if (texture->bigid) glDeleteTextures(1, &texture->bigid);