animate: timer code & locking cleanup
Dimitrie O. Paun
dpaun at rogers.com
Sun Mar 20 14:14:24 CST 2005
ChangeLog
Pull the WM_TIMER handling into its own function.
ANIMATE_DrawFrame shouldn't worry about locking,
the lock should be held by the caller.
Index: dlls/comctl32/animate.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/animate.c,v
retrieving revision 1.64
diff -u -r1.64 animate.c
--- dlls/comctl32/animate.c 18 Mar 2005 10:30:13 -0000 1.64
+++ dlls/comctl32/animate.c 20 Mar 2005 16:44:21 -0000
@@ -349,15 +349,12 @@
TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
- EnterCriticalSection(&infoPtr->cs);
-
mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
if (infoPtr->hic &&
fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
- LeaveCriticalSection(&infoPtr->cs);
WARN("Decompression error\n");
return FALSE;
}
@@ -375,11 +372,24 @@
}
}
}
- LeaveCriticalSection(&infoPtr->cs);
return TRUE;
}
+static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr)
+{
+ /* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */
+ if (infoPtr->dwStyle & ACS_TRANSPARENT)
+ infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
+ WM_CTLCOLORSTATIC,
+ 0, (LPARAM)infoPtr->hwndSelf);
+ EnterCriticalSection(&infoPtr->cs);
+ ANIMATE_DrawFrame(infoPtr);
+ LeaveCriticalSection(&infoPtr->cs);
+
+ return 0;
+}
+
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
{
ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_;
@@ -890,11 +902,7 @@
return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam);
case WM_TIMER:
- if (infoPtr->dwStyle & ACS_TRANSPARENT)
- infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify,
- WM_CTLCOLORSTATIC,
- wParam, (LPARAM)infoPtr->hwndSelf);
- return ANIMATE_DrawFrame(infoPtr);
+ return ANIMATE_Timer(infoPtr);
case WM_PAINT:
{
--
Dimi.
More information about the wine-patches
mailing list