From ad23586ce1bbf981102ebd1bc4da8e5ba806c4a9 Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Mon, 21 Mar 2005 11:27:49 +0000 Subject: [PATCH] Pull the WM_TIMER handling into its own function. ANIMATE_DrawFrame shouldn't worry about locking, the lock should be held by the caller. --- dlls/comctl32/animate.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index 3e5b9abcc3d..355ff0cca5f 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -349,15 +349,12 @@ static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr) 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 @@ static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr) } } } - 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_; @@ -892,11 +902,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP 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: {