DXGL r653 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r652‎ | r653 | r654 >
Date:17:11, 14 February 2016
Author:admin
Status:new
Tags:
Comment:
Implement IsClipListChanged.
Ensure dwFlags is 0 on clipper funtions.
Verify lphWnd parameter of IDirectDrawClipper::GetHWnd
Modified paths:
  • /ddraw/glDirectDrawClipper.cpp (modified) (history)
  • /ddraw/glDirectDrawClipper.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawClipper.cpp
@@ -55,6 +55,7 @@
5656 glDirectDrawClipper *newclipper;
5757 TRACE_ENTER(3, 9, dwFlags, 14, parent, 14, lplpDDClipper);
5858 if (!lplpDDClipper) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
 59+ if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
5960 newclipper = (glDirectDrawClipper*)malloc(sizeof(glDirectDrawClipper));
6061 if (!newclipper) TRACE_RET(HRESULT, 23, DDERR_OUTOFMEMORY);
6162 ZeroMemory(newclipper, sizeof(glDirectDrawClipper));
@@ -325,6 +326,7 @@
326327 {
327328 TRACE_ENTER(2,14,This,14,lphWnd);
328329 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 330+ if (!lphWnd) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
329331 if(!This->hWnd) TRACE_RET(HRESULT,23,DDERR_NOHWND);
330332 *lphWnd = This->hWnd;
331333 TRACE_VAR("*lphWnd",13,*lphWnd);
@@ -335,6 +337,7 @@
336338 {
337339 TRACE_ENTER(3,14,This,14,lpDD,9,dwFlags);
338340 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 341+ if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
339342 if(This->initialized) TRACE_RET(HRESULT,23,DDERR_ALREADYINITIALIZED);
340343 This->glDD7 = (glDirectDraw7*)lpDD;
341344 if(This->glDD7) This->hasparent = true;
@@ -348,21 +351,33 @@
349352 This->refcount = 1;
350353 This->initialized = true;
351354 This->dirty = true;
 355+ This->cliplistchanged = TRUE;
352356 TRACE_EXIT(23,DD_OK);
353357 return DD_OK;
354358 }
355359 HRESULT WINAPI glDirectDrawClipper_IsClipListChanged(glDirectDrawClipper *This, BOOL FAR *lpbChanged)
356360 {
 361+ WINDOWPLACEMENT newpos;
357362 TRACE_ENTER(2,14,This,14,lpbChanged);
358363 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
359 - FIXME("IDirectDrawClipper::IsClipListChanged: stub");
360 - TRACE_EXIT(23,DDERR_GENERIC);
361 - ERR(DDERR_GENERIC);
 364+ if (!lpbChanged) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
 365+ newpos.length = sizeof(WINDOWPLACEMENT);
 366+ if (This->hWnd) GetWindowPlacement(This->hWnd, &newpos);
 367+ if (memcmp(&This->lastpos, &newpos, sizeof(WINDOWPLACEMENT)))
 368+ {
 369+ This->cliplistchanged = TRUE;
 370+ memcpy(&This->lastpos, &newpos, sizeof(WINDOWPLACEMENT));
 371+ }
 372+ *lpbChanged = This->cliplistchanged;
 373+ This->cliplistchanged = FALSE;
 374+ TRACE_EXIT(23, DD_OK);
 375+ return DD_OK;
362376 }
363377 HRESULT WINAPI glDirectDrawClipper_SetClipList(glDirectDrawClipper *This, LPRGNDATA lpClipList, DWORD dwFlags)
364378 {
365379 TRACE_ENTER(3,14,This,14,lpClipList,9,dwFlags);
366380 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 381+ if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
367382 if(This->hWnd) TRACE_RET(HRESULT,23,DDERR_CLIPPERISUSINGHWND);
368383 bool memfail;
369384 if(lpClipList)
@@ -437,6 +452,7 @@
438453 }
439454 else This->clipsize = 0;
440455 This->dirty = true;
 456+ This->cliplistchanged = TRUE;
441457 TRACE_EXIT(23,DD_OK);
442458 return DD_OK;
443459 }
@@ -444,7 +460,11 @@
445461 {
446462 TRACE_ENTER(3,14,This,9,dwFlags,13,hWnd);
447463 if(!This) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
 464+ if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
448465 This->hWnd = hWnd;
 466+ This->lastpos.length = sizeof(WINDOWPLACEMENT);
 467+ GetWindowPlacement(hWnd, &This->lastpos);
 468+ This->cliplistchanged = TRUE;
449469 TRACE_EXIT(23,DD_OK);
450470 return DD_OK;
451471 }
Index: ddraw/glDirectDrawClipper.h
@@ -38,6 +38,8 @@
3939 int maxsize;
4040 bool hascliplist;
4141 bool dirty;
 42+ BOOL cliplistchanged;
 43+ WINDOWPLACEMENT lastpos;
4244 } glDirectDrawClipper;
4345
4446 typedef struct glDirectDrawClipperVtbl