ReactOS 0.4.16-dev-306-g647d351
animate.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "vfw.h"
#include "mmsystem.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for animate.c:

Go to the source code of this file.

Classes

struct  ANIMATE_INFO
 

Macros

#define ANIMATE_COLOR_NONE   0xffffffff
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (animate)
 
static void ANIMATE_Notify (const ANIMATE_INFO *infoPtr, UINT notif)
 
static BOOL ANIMATE_LoadResW (ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPCWSTR lpName)
 
static BOOL ANIMATE_LoadFileW (ANIMATE_INFO *infoPtr, LPWSTR lpName)
 
static BOOL ANIMATE_DoStop (ANIMATE_INFO *infoPtr)
 
static void ANIMATE_Free (ANIMATE_INFO *infoPtr)
 
static void ANIMATE_TransparentBlt (ANIMATE_INFO const *infoPtr, HDC hdcDest, HDC hdcSource)
 
static BOOL ANIMATE_PaintFrame (ANIMATE_INFO *infoPtr, HDC hDC)
 
static BOOL ANIMATE_DrawFrame (ANIMATE_INFO *infoPtr, HDC hDC)
 
static LRESULT ANIMATE_Timer (ANIMATE_INFO *infoPtr)
 
static DWORD CALLBACK ANIMATE_AnimationThread (LPVOID ptr_)
 
static LRESULT ANIMATE_Play (ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
 
static BOOL ANIMATE_GetAviInfo (ANIMATE_INFO *infoPtr)
 
static BOOL ANIMATE_GetAviCodec (ANIMATE_INFO *infoPtr)
 
static BOOL ANIMATE_OpenW (ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
 
static BOOL ANIMATE_OpenA (ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName)
 
static BOOL ANIMATE_Stop (ANIMATE_INFO *infoPtr)
 
static BOOL ANIMATE_Create (HWND hWnd, const CREATESTRUCTW *lpcs)
 
static LRESULT ANIMATE_Destroy (ANIMATE_INFO *infoPtr)
 
static BOOL ANIMATE_EraseBackground (ANIMATE_INFO const *infoPtr, HDC hdc)
 
static LRESULT ANIMATE_StyleChanged (ANIMATE_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 
static LRESULT WINAPI ANIMATE_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void ANIMATE_Register (void)
 
void ANIMATE_Unregister (void)
 

Variables

struct {
   HMODULE   hModule
 
      DWORD
 
      UINT
 
      DWORD_PTR
 
      LPBITMAPINFOHEADER
 
      LPVOID
 
fnIC
 

Macro Definition Documentation

◆ ANIMATE_COLOR_NONE

#define ANIMATE_COLOR_NONE   0xffffffff

Definition at line 86 of file animate.c.

Function Documentation

◆ ANIMATE_AnimationThread()

static DWORD CALLBACK ANIMATE_AnimationThread ( LPVOID  ptr_)
static

Definition at line 384 of file animate.c.

385{
386 ANIMATE_INFO *infoPtr = ptr_;
389
390 while(1)
391 {
392 HDC hDC = GetDC(infoPtr->hwndSelf);
393
394 EnterCriticalSection(&infoPtr->cs);
395 ANIMATE_DrawFrame(infoPtr, hDC);
396 timeout = infoPtr->mah.dwMicroSecPerFrame;
397 event = infoPtr->hStopEvent;
398 LeaveCriticalSection(&infoPtr->cs);
399
400 ReleaseDC(infoPtr->hwndSelf, hDC);
401
402 /* time is in microseconds, we should convert it to milliseconds */
403 if ((event == 0) || WaitForSingleObject( event, (timeout+500)/1000) == WAIT_OBJECT_0)
404 break;
405 }
406 return TRUE;
407}
static HDC hDC
Definition: 3dtext.c:33
#define TRUE
Definition: types.h:120
static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr, HDC hDC)
Definition: animate.c:340
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _cl_event * event
Definition: glext.h:7739
static HDC
Definition: imagelist.c:88
MainAVIHeader mah
Definition: animate.c:60
HANDLE hStopEvent
Definition: animate.c:71
CRITICAL_SECTION cs
Definition: animate.c:70
HWND hwndSelf
Definition: animate.c:56
DWORD dwMicroSecPerFrame
Definition: vfw.h:941
Definition: dhcpd.h:245
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define WAIT_OBJECT_0
Definition: winbase.h:432
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by ANIMATE_Play().

◆ ANIMATE_Create()

static BOOL ANIMATE_Create ( HWND  hWnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 795 of file animate.c.

796{
797 static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 };
798 ANIMATE_INFO *infoPtr;
799
800 if (!fnIC.hModule)
801 {
802 fnIC.hModule = LoadLibraryW(msvfw32W);
803 if (!fnIC.hModule) return FALSE;
804
805 fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen");
806 fnIC.fnICClose = (void*)GetProcAddress(fnIC.hModule, "ICClose");
807 fnIC.fnICSendMessage = (void*)GetProcAddress(fnIC.hModule, "ICSendMessage");
808 fnIC.fnICDecompress = (void*)GetProcAddress(fnIC.hModule, "ICDecompress");
809 }
810
811 /* allocate memory for info structure */
812 infoPtr = heap_alloc_zero(sizeof(*infoPtr));
813 if (!infoPtr) return FALSE;
814
815 /* store crossref hWnd <-> info structure */
816 SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr);
817 infoPtr->hwndSelf = hWnd;
818 infoPtr->hwndNotify = lpcs->hwndParent;
820 infoPtr->hbmPrevFrame = 0;
821 infoPtr->dwStyle = lpcs->style;
822
823 TRACE("Animate style=0x%08x, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify);
824
825 InitializeCriticalSection(&infoPtr->cs);
826 infoPtr->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ANIMATE_INFO*->cs");
827
828 return TRUE;
829}
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
DWORD_PTR
Definition: animate.c:47
#define ANIMATE_COLOR_NONE
Definition: animate.c:86
static struct @332 fnIC
#define GetProcAddress(x, y)
Definition: compat.h:753
#define LoadLibraryW(x)
Definition: compat.h:747
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwStyle
Definition: animate.c:58
HWND hwndNotify
Definition: animate.c:57
COLORREF transparentColor
Definition: animate.c:81
HBITMAP hbmPrevFrame
Definition: animate.c:83
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:912
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:919
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define SetWindowLongPtrW
Definition: winuser.h:5358
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_Destroy()

static LRESULT ANIMATE_Destroy ( ANIMATE_INFO infoPtr)
static

Definition at line 832 of file animate.c.

833{
834 /* free avi data */
835 ANIMATE_Free(infoPtr);
836
837 /* free animate info data */
838 SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
839
840 infoPtr->cs.DebugInfo->Spare[0] = 0;
841 DeleteCriticalSection(&infoPtr->cs);
842 heap_free(infoPtr);
843
844 return 0;
845}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
Definition: animate.c:181
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_DoStop()

static BOOL ANIMATE_DoStop ( ANIMATE_INFO infoPtr)
static

Definition at line 138 of file animate.c.

139{
140 BOOL stopped = FALSE;
141
142 EnterCriticalSection(&infoPtr->cs);
143
144 /* should stop playing */
145 if (infoPtr->hThread)
146 {
147 HANDLE handle = infoPtr->hThread;
148
149 TRACE("stopping animation thread\n");
150 infoPtr->hThread = 0;
151 SetEvent( infoPtr->hStopEvent );
152
153 if (infoPtr->threadId != GetCurrentThreadId())
154 {
155 LeaveCriticalSection(&infoPtr->cs); /* leave it a chance to run */
157 TRACE("animation thread stopped\n");
158 EnterCriticalSection(&infoPtr->cs);
159 }
160
162 CloseHandle( infoPtr->hStopEvent );
163 infoPtr->hStopEvent = 0;
164 stopped = TRUE;
165 }
166 if (infoPtr->uTimer) {
167 KillTimer(infoPtr->hwndSelf, infoPtr->uTimer);
168 infoPtr->uTimer = 0;
169 stopped = TRUE;
170 }
171
172 LeaveCriticalSection(&infoPtr->cs);
173
174 if (stopped)
175 ANIMATE_Notify(infoPtr, ACN_STOP);
176
177 return TRUE;
178}
static void ANIMATE_Notify(const ANIMATE_INFO *infoPtr, UINT notif)
Definition: animate.c:88
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ACN_STOP
Definition: commctrl.h:4165
DWORD threadId
Definition: animate.c:73
UINT uTimer
Definition: animate.c:74
HANDLE hThread
Definition: animate.c:72
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by ANIMATE_DrawFrame(), ANIMATE_Free(), and ANIMATE_Stop().

◆ ANIMATE_DrawFrame()

static BOOL ANIMATE_DrawFrame ( ANIMATE_INFO infoPtr,
HDC  hDC 
)
static

Definition at line 340 of file animate.c.

341{
342 TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop);
343
344 mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET);
345 mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize);
346
347 if (infoPtr->hic &&
348 fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
349 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
350 WARN("Decompression error\n");
351 return FALSE;
352 }
353
354 ANIMATE_PaintFrame(infoPtr, hDC);
355
356 if (infoPtr->currFrame++ >= infoPtr->nToFrame) {
357 infoPtr->currFrame = infoPtr->nFromFrame;
358 if (infoPtr->nLoop != -1) {
359 if (--infoPtr->nLoop == 0) {
360 ANIMATE_DoStop(infoPtr);
361 }
362 }
363 }
364
365 return TRUE;
366}
#define WARN(fmt,...)
Definition: precomp.h:61
static BOOL ANIMATE_PaintFrame(ANIMATE_INFO *infoPtr, HDC hDC)
Definition: animate.c:252
static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
Definition: animate.c:138
LONG WINAPI mmioSeek(HMMIO hmmio, LONG lOffset, INT iOrigin)
Definition: mmio.c:836
LONG WINAPI mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
Definition: mmio.c:733
#define SEEK_SET
Definition: jmemansi.c:26
LPBITMAPINFOHEADER outbih
Definition: animate.c:66
LPDWORD lpIndex
Definition: animate.c:63
LPVOID indata
Definition: animate.c:67
int nLoop
Definition: animate.c:78
LPVOID outdata
Definition: animate.c:68
HMMIO hMMio
Definition: animate.c:55
LPBITMAPINFOHEADER inbih
Definition: animate.c:62
int nToFrame
Definition: animate.c:77
int currFrame
Definition: animate.c:79
AVIStreamHeader ash
Definition: animate.c:61
int nFromFrame
Definition: animate.c:76
DWORD dwSuggestedBufferSize
Definition: vfw.h:969
#define ICERR_OK
Definition: vfw.h:50

Referenced by ANIMATE_AnimationThread(), ANIMATE_Play(), and ANIMATE_Timer().

◆ ANIMATE_EraseBackground()

static BOOL ANIMATE_EraseBackground ( ANIMATE_INFO const infoPtr,
HDC  hdc 
)
static

Definition at line 848 of file animate.c.

849{
850 RECT rect;
851 HBRUSH hBrush;
852
853 hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
854 (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
855 GetClientRect(infoPtr->hwndSelf, &rect);
856 FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH));
857
858 return TRUE;
859}
HDC hdc
Definition: main.c:9
#define OBJ_BRUSH
Definition: objidl.idl:1410
& rect
Definition: startmenu.cpp:1413
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_Free()

static void ANIMATE_Free ( ANIMATE_INFO infoPtr)
static

Definition at line 181 of file animate.c.

182{
183 if (infoPtr->hMMio)
184 {
185 ANIMATE_DoStop(infoPtr);
186 mmioClose(infoPtr->hMMio, 0);
187 if (infoPtr->hRes)
188 {
189 FreeResource(infoPtr->hRes);
190 infoPtr->hRes = 0;
191 }
192 heap_free (infoPtr->lpIndex);
193 infoPtr->lpIndex = NULL;
194 if (infoPtr->hic)
195 {
196 fnIC.fnICClose(infoPtr->hic);
197 infoPtr->hic = 0;
198 }
199 heap_free (infoPtr->inbih);
200 infoPtr->inbih = NULL;
201 heap_free (infoPtr->outbih);
202 infoPtr->outbih = NULL;
203 heap_free (infoPtr->indata);
204 infoPtr->indata = NULL;
205 heap_free (infoPtr->outdata);
206 infoPtr->outdata = NULL;
207 if (infoPtr->hbmPrevFrame)
208 {
209 DeleteObject(infoPtr->hbmPrevFrame);
210 infoPtr->hbmPrevFrame = 0;
211 }
212
213 memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
214 memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
215 infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
216 }
218}
#define NULL
Definition: types.h:112
BOOL WINAPI FreeResource(HGLOBAL handle)
Definition: res.c:559
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
Definition: mmio.c:702
pKey DeleteObject()
#define memset(x, y, z)
Definition: compat.h:39
HGLOBAL hRes
Definition: animate.c:54

Referenced by ANIMATE_Destroy(), ANIMATE_OpenW(), and ANIMATE_WindowProc().

◆ ANIMATE_GetAviCodec()

static BOOL ANIMATE_GetAviCodec ( ANIMATE_INFO infoPtr)
static

Definition at line 646 of file animate.c.

647{
648 DWORD outSize;
649
650 /* check uncompressed AVI */
651 if ((infoPtr->ash.fccHandler == mmioFOURCC('D', 'I', 'B', ' ')) ||
652 (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')) ||
653 (infoPtr->ash.fccHandler == mmioFOURCC(0, 0, 0, 0)))
654 {
655 infoPtr->hic = 0;
656 return TRUE;
657 }
658
659 /* try to get a decompressor for that type */
660 infoPtr->hic = fnIC.fnICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
661 if (!infoPtr->hic) {
662 WARN("Can't load codec for the file\n");
663 return FALSE;
664 }
665
666 outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
667 (DWORD_PTR)infoPtr->inbih, 0L);
668
669 infoPtr->outbih = heap_alloc_zero(outSize);
670 if (!infoPtr->outbih)
671 return FALSE;
672
673 if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
674 (DWORD_PTR)infoPtr->inbih, (DWORD_PTR)infoPtr->outbih) != ICERR_OK)
675 {
676 WARN("Can't get output BIH\n");
677 return FALSE;
678 }
679
680 infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage);
681 if (!infoPtr->outdata)
682 return FALSE;
683
684 if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
685 (DWORD_PTR)infoPtr->inbih, (DWORD_PTR)infoPtr->outbih) != ICERR_OK) {
686 WARN("Can't begin decompression\n");
687 return FALSE;
688 }
689
690 return TRUE;
691}
#define ICTYPE_VIDEO
Definition: mmreg.h:531
#define mmioFOURCC(c0, c1, c2, c3)
Definition: mmsystem.h:38
#define L(x)
Definition: ntvdm.h:50
FOURCC fccHandler
Definition: vfw.h:960
DWORD biSizeImage
Definition: amvideo.idl:36
#define ICMODE_DECOMPRESS
Definition: vfw.h:269
#define ICM_DECOMPRESS_GET_FORMAT
Definition: vfw.h:106
#define ICM_DECOMPRESS_BEGIN
Definition: vfw.h:108

Referenced by ANIMATE_OpenW().

◆ ANIMATE_GetAviInfo()

static BOOL ANIMATE_GetAviInfo ( ANIMATE_INFO infoPtr)
static

Definition at line 478 of file animate.c.

479{
480 MMCKINFO ckMainRIFF;
481 MMCKINFO mmckHead;
482 MMCKINFO mmckList;
483 MMCKINFO mmckInfo;
484 DWORD numFrame;
486
487 if (mmioDescend(infoPtr->hMMio, &ckMainRIFF, NULL, 0) != 0) {
488 WARN("Can't find 'RIFF' chunk\n");
489 return FALSE;
490 }
491
492 if ((ckMainRIFF.ckid != FOURCC_RIFF) ||
493 (ckMainRIFF.fccType != mmioFOURCC('A', 'V', 'I', ' '))) {
494 WARN("Can't find 'AVI ' chunk\n");
495 return FALSE;
496 }
497
498 mmckHead.fccType = mmioFOURCC('h', 'd', 'r', 'l');
499 if (mmioDescend(infoPtr->hMMio, &mmckHead, &ckMainRIFF, MMIO_FINDLIST) != 0) {
500 WARN("Can't find 'hdrl' list\n");
501 return FALSE;
502 }
503
504 mmckInfo.ckid = mmioFOURCC('a', 'v', 'i', 'h');
505 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckHead, MMIO_FINDCHUNK) != 0) {
506 WARN("Can't find 'avih' chunk\n");
507 return FALSE;
508 }
509
510 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->mah, sizeof(infoPtr->mah));
511
512 TRACE("mah.dwMicroSecPerFrame=%d\n", infoPtr->mah.dwMicroSecPerFrame);
513 TRACE("mah.dwMaxBytesPerSec=%d\n", infoPtr->mah.dwMaxBytesPerSec);
514 TRACE("mah.dwPaddingGranularity=%d\n", infoPtr->mah.dwPaddingGranularity);
515 TRACE("mah.dwFlags=%d\n", infoPtr->mah.dwFlags);
516 TRACE("mah.dwTotalFrames=%d\n", infoPtr->mah.dwTotalFrames);
517 TRACE("mah.dwInitialFrames=%d\n", infoPtr->mah.dwInitialFrames);
518 TRACE("mah.dwStreams=%d\n", infoPtr->mah.dwStreams);
519 TRACE("mah.dwSuggestedBufferSize=%d\n", infoPtr->mah.dwSuggestedBufferSize);
520 TRACE("mah.dwWidth=%d\n", infoPtr->mah.dwWidth);
521 TRACE("mah.dwHeight=%d\n", infoPtr->mah.dwHeight);
522
523 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
524
525 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
526 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) != 0) {
527 WARN("Can't find 'strl' list\n");
528 return FALSE;
529 }
530
531 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'h');
532 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
533 WARN("Can't find 'strh' chunk\n");
534 return FALSE;
535 }
536
537 mmioRead(infoPtr->hMMio, (LPSTR)&infoPtr->ash, sizeof(infoPtr->ash));
538
539 TRACE("ash.fccType='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccType)),
540 HIBYTE(LOWORD(infoPtr->ash.fccType)),
541 LOBYTE(HIWORD(infoPtr->ash.fccType)),
542 HIBYTE(HIWORD(infoPtr->ash.fccType)));
543 TRACE("ash.fccHandler='%c%c%c%c'\n", LOBYTE(LOWORD(infoPtr->ash.fccHandler)),
544 HIBYTE(LOWORD(infoPtr->ash.fccHandler)),
545 LOBYTE(HIWORD(infoPtr->ash.fccHandler)),
546 HIBYTE(HIWORD(infoPtr->ash.fccHandler)));
547 TRACE("ash.dwFlags=%d\n", infoPtr->ash.dwFlags);
548 TRACE("ash.wPriority=%d\n", infoPtr->ash.wPriority);
549 TRACE("ash.wLanguage=%d\n", infoPtr->ash.wLanguage);
550 TRACE("ash.dwInitialFrames=%d\n", infoPtr->ash.dwInitialFrames);
551 TRACE("ash.dwScale=%d\n", infoPtr->ash.dwScale);
552 TRACE("ash.dwRate=%d\n", infoPtr->ash.dwRate);
553 TRACE("ash.dwStart=%d\n", infoPtr->ash.dwStart);
554 TRACE("ash.dwLength=%d\n", infoPtr->ash.dwLength);
555 TRACE("ash.dwSuggestedBufferSize=%d\n", infoPtr->ash.dwSuggestedBufferSize);
556 TRACE("ash.dwQuality=%d\n", infoPtr->ash.dwQuality);
557 TRACE("ash.dwSampleSize=%d\n", infoPtr->ash.dwSampleSize);
558 TRACE("ash.rcFrame=(%d,%d,%d,%d)\n", infoPtr->ash.rcFrame.top, infoPtr->ash.rcFrame.left,
559 infoPtr->ash.rcFrame.bottom, infoPtr->ash.rcFrame.right);
560
561 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
562
563 mmckInfo.ckid = mmioFOURCC('s', 't', 'r', 'f');
564 if (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, MMIO_FINDCHUNK) != 0) {
565 WARN("Can't find 'strh' chunk\n");
566 return FALSE;
567 }
568
569 infoPtr->inbih = heap_alloc_zero(mmckInfo.cksize);
570 if (!infoPtr->inbih) {
571 WARN("Can't alloc input BIH\n");
572 return FALSE;
573 }
574
575 mmioRead(infoPtr->hMMio, (LPSTR)infoPtr->inbih, mmckInfo.cksize);
576
577 TRACE("bih.biSize=%d\n", infoPtr->inbih->biSize);
578 TRACE("bih.biWidth=%d\n", infoPtr->inbih->biWidth);
579 TRACE("bih.biHeight=%d\n", infoPtr->inbih->biHeight);
580 TRACE("bih.biPlanes=%d\n", infoPtr->inbih->biPlanes);
581 TRACE("bih.biBitCount=%d\n", infoPtr->inbih->biBitCount);
582 TRACE("bih.biCompression=%d\n", infoPtr->inbih->biCompression);
583 TRACE("bih.biSizeImage=%d\n", infoPtr->inbih->biSizeImage);
584 TRACE("bih.biXPelsPerMeter=%d\n", infoPtr->inbih->biXPelsPerMeter);
585 TRACE("bih.biYPelsPerMeter=%d\n", infoPtr->inbih->biYPelsPerMeter);
586 TRACE("bih.biClrUsed=%d\n", infoPtr->inbih->biClrUsed);
587 TRACE("bih.biClrImportant=%d\n", infoPtr->inbih->biClrImportant);
588
589 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
590
591 mmioAscend(infoPtr->hMMio, &mmckList, 0);
592
593#if 0
594 /* an AVI has 0 or 1 video stream, and to be animated should not contain
595 * an audio stream, so only one strl is allowed
596 */
597 mmckList.fccType = mmioFOURCC('s', 't', 'r', 'l');
598 if (mmioDescend(infoPtr->hMMio, &mmckList, &mmckHead, MMIO_FINDLIST) == 0) {
599 WARN("There should be a single 'strl' list\n");
600 return FALSE;
601 }
602#endif
603
604 mmioAscend(infoPtr->hMMio, &mmckHead, 0);
605
606 /* no need to read optional JUNK chunk */
607
608 mmckList.fccType = mmioFOURCC('m', 'o', 'v', 'i');
609 if (mmioDescend(infoPtr->hMMio, &mmckList, &ckMainRIFF, MMIO_FINDLIST) != 0) {
610 WARN("Can't find 'movi' list\n");
611 return FALSE;
612 }
613
614 /* FIXME: should handle the 'rec ' LIST when present */
615
616 infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
617 if (!infoPtr->lpIndex)
618 return FALSE;
619
620 numFrame = insize = 0;
621 while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 &&
622 numFrame < infoPtr->mah.dwTotalFrames) {
623 infoPtr->lpIndex[numFrame] = mmckInfo.dwDataOffset;
624 if (insize < mmckInfo.cksize)
625 insize = mmckInfo.cksize;
626 numFrame++;
627 mmioAscend(infoPtr->hMMio, &mmckInfo, 0);
628 }
629 if (numFrame != infoPtr->mah.dwTotalFrames) {
630 WARN("Found %d frames (/%d)\n", numFrame, infoPtr->mah.dwTotalFrames);
631 return FALSE;
632 }
633 if (insize > infoPtr->ash.dwSuggestedBufferSize) {
634 WARN("insize=%d suggestedSize=%d\n", insize, infoPtr->ash.dwSuggestedBufferSize);
636 }
637
638 infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize);
639 if (!infoPtr->indata)
640 return FALSE;
641
642 return TRUE;
643}
MMRESULT WINAPI mmioAscend(HMMIO hmmio, LPMMCKINFO lpck, UINT uFlags)
Definition: mmio.c:1205
MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, const MMCKINFO *lpckParent, UINT uFlags)
Definition: mmio.c:1107
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
const unsigned char size_t insize
Definition: jpeglib.h:984
#define FOURCC_RIFF
Definition: mmsystem.h:564
#define MMIO_FINDCHUNK
Definition: mmsystem.h:551
#define MMIO_FINDLIST
Definition: mmsystem.h:553
#define LOWORD(l)
Definition: pedump.c:82
DWORD dwInitialFrames
Definition: vfw.h:964
DWORD dwStart
Definition: vfw.h:967
DWORD dwQuality
Definition: vfw.h:970
WORD wLanguage
Definition: vfw.h:963
DWORD dwSampleSize
Definition: vfw.h:971
DWORD dwScale
Definition: vfw.h:965
struct AVIStreamHeader::@3269 rcFrame
FOURCC fccType
Definition: vfw.h:959
DWORD dwFlags
Definition: vfw.h:961
DWORD dwLength
Definition: vfw.h:968
DWORD dwRate
Definition: vfw.h:966
WORD wPriority
Definition: vfw.h:962
LONG biYPelsPerMeter
Definition: amvideo.idl:38
DWORD biCompression
Definition: amvideo.idl:35
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
FOURCC ckid
Definition: mmsystem.h:1507
DWORD cksize
Definition: mmsystem.h:1508
DWORD dwDataOffset
Definition: mmsystem.h:1510
FOURCC fccType
Definition: mmsystem.h:1509
DWORD dwWidth
Definition: vfw.h:949
DWORD dwSuggestedBufferSize
Definition: vfw.h:948
DWORD dwHeight
Definition: vfw.h:950
DWORD dwPaddingGranularity
Definition: vfw.h:943
DWORD dwStreams
Definition: vfw.h:947
DWORD dwMaxBytesPerSec
Definition: vfw.h:942
DWORD dwInitialFrames
Definition: vfw.h:946
DWORD dwFlags
Definition: vfw.h:944
DWORD dwTotalFrames
Definition: vfw.h:945
#define HIWORD(l)
Definition: typedefs.h:247
char * LPSTR
Definition: xmlstorage.h:182

Referenced by ANIMATE_OpenW().

◆ ANIMATE_LoadFileW()

static BOOL ANIMATE_LoadFileW ( ANIMATE_INFO infoPtr,
LPWSTR  lpName 
)
static

Definition at line 129 of file animate.c.

130{
132
133 if(!infoPtr->hMMio) return FALSE;
134 return TRUE;
135}
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
Definition: mmio.c:670
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
#define MMIO_DENYWRITE
Definition: mmsystem.h:540
#define MMIO_READ
Definition: mmsystem.h:535
_In_ LPCSTR lpName
Definition: winbase.h:2814

Referenced by ANIMATE_OpenW().

◆ ANIMATE_LoadResW()

static BOOL ANIMATE_LoadResW ( ANIMATE_INFO infoPtr,
HINSTANCE  hInst,
LPCWSTR  lpName 
)
static

Definition at line 95 of file animate.c.

96{
97 static const WCHAR aviW[] = { 'A', 'V', 'I', 0 };
98 HRSRC hrsrc;
99 MMIOINFO mminfo;
100 LPVOID lpAvi;
101
102 hrsrc = FindResourceW(hInst, lpName, aviW);
103 if (!hrsrc)
104 return FALSE;
105
106 infoPtr->hRes = LoadResource(hInst, hrsrc);
107 if (!infoPtr->hRes)
108 return FALSE;
109
110 lpAvi = LockResource(infoPtr->hRes);
111 if (!lpAvi)
112 return FALSE;
113
114 memset(&mminfo, 0, sizeof(mminfo));
115 mminfo.fccIOProc = FOURCC_MEM;
116 mminfo.pchBuffer = lpAvi;
117 mminfo.cchBuffer = SizeofResource(hInst, hrsrc);
118 infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ);
119 if (!infoPtr->hMMio)
120 {
121 FreeResource(infoPtr->hRes);
122 return FALSE;
123 }
124
125 return TRUE;
126}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
HINSTANCE hInst
Definition: dxdiag.c:13
#define FOURCC_MEM
Definition: mmsystem.h:567
LONG cchBuffer
Definition: mmsystem.h:1491
HPSTR pchBuffer
Definition: mmsystem.h:1492
FOURCC fccIOProc
Definition: mmsystem.h:1487

Referenced by ANIMATE_OpenW().

◆ ANIMATE_Notify()

static void ANIMATE_Notify ( const ANIMATE_INFO infoPtr,
UINT  notif 
)
static

Definition at line 88 of file animate.c.

89{
92 (LPARAM)infoPtr->hwndSelf);
93}
static IMMNotificationClient notif
Definition: mmdevenum.c:189
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_COMMAND
Definition: winuser.h:1743
int WINAPI GetDlgCtrlID(_In_ HWND)

Referenced by ANIMATE_DoStop(), and ANIMATE_Play().

◆ ANIMATE_OpenA()

static BOOL ANIMATE_OpenA ( ANIMATE_INFO infoPtr,
HINSTANCE  hInstance,
LPSTR  lpszName 
)
static

Definition at line 764 of file animate.c.

765{
766 LPWSTR lpwszName;
768 INT len;
769
770 if (IS_INTRESOURCE(lpszName))
771 return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
772
773 len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
774 lpwszName = heap_alloc(len * sizeof(WCHAR));
775 if (!lpwszName) return FALSE;
776 MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
777
778 result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
779 heap_free (lpwszName);
780 return result;
781}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
HINSTANCE hInstance
Definition: charmap.c:19
static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName)
Definition: animate.c:694
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
GLuint64EXT * result
Definition: glext.h:11304
int32_t INT
Definition: typedefs.h:58
LONG_PTR LRESULT
Definition: windef.h:209
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_OpenW()

static BOOL ANIMATE_OpenW ( ANIMATE_INFO infoPtr,
HINSTANCE  hInstance,
LPWSTR  lpszName 
)
static

Definition at line 694 of file animate.c.

695{
696 HDC hdc;
697
698 ANIMATE_Free(infoPtr);
699
700 if (!lpszName)
701 {
702 TRACE("Closing avi.\n");
703 /* installer of thebat! v1.62 requires FALSE here */
704 return (infoPtr->hMMio != 0);
705 }
706
707 if (!hInstance)
709
710 TRACE("(%s)\n", debugstr_w(lpszName));
711
712 if (!IS_INTRESOURCE(lpszName))
713 {
714 if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
715 {
716 TRACE("No AVI resource found.\n");
717 if (!ANIMATE_LoadFileW(infoPtr, lpszName))
718 {
719 WARN("No AVI file found.\n");
720 return FALSE;
721 }
722 }
723 }
724 else
725 {
726 if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName))
727 {
728 WARN("No AVI resource found.\n");
729 return FALSE;
730 }
731 }
732
733 if (!ANIMATE_GetAviInfo(infoPtr))
734 {
735 WARN("Can't get AVI information\n");
736 ANIMATE_Free(infoPtr);
737 return FALSE;
738 }
739
740 if (!ANIMATE_GetAviCodec(infoPtr))
741 {
742 WARN("Can't get AVI Codec\n");
743 ANIMATE_Free(infoPtr);
744 return FALSE;
745 }
746
747 hdc = GetDC(infoPtr->hwndSelf);
748 /* native looks at the top left pixel of the first frame here too. */
749 infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC,
750 (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf);
751 ReleaseDC(infoPtr->hwndSelf, hdc);
752
753 if (!(infoPtr->dwStyle & ACS_CENTER))
754 SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight,
756
757 if (infoPtr->dwStyle & ACS_AUTOPLAY)
758 return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1);
759
760 return TRUE;
761}
static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
Definition: animate.c:478
static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
Definition: animate.c:646
static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo)
Definition: animate.c:409
static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPCWSTR lpName)
Definition: animate.c:95
static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName)
Definition: animate.c:129
#define debugstr_w
Definition: kernel32.h:32
#define ACS_AUTOPLAY
Definition: commctrl.h:4153
#define ACS_CENTER
Definition: commctrl.h:4151
HBRUSH hbrushBG
Definition: animate.c:82
HANDLE HINSTANCE
Definition: typedefs.h:77
#define SWP_NOACTIVATE
Definition: winuser.h:1245
#define GetWindowLongPtrW
Definition: winuser.h:4832
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define GWLP_HINSTANCE
Definition: winuser.h:859
#define SWP_NOZORDER
Definition: winuser.h:1250

Referenced by ANIMATE_OpenA(), and ANIMATE_WindowProc().

◆ ANIMATE_PaintFrame()

static BOOL ANIMATE_PaintFrame ( ANIMATE_INFO infoPtr,
HDC  hDC 
)
static

Definition at line 252 of file animate.c.

253{
254 void const *pBitmapData;
255 BITMAPINFO const *pBitmapInfo;
256 HDC hdcMem;
257 HBITMAP hbmOld;
258 int nOffsetX = 0;
259 int nOffsetY = 0;
260 int nWidth;
261 int nHeight;
262
263 if (!hDC || !infoPtr->inbih)
264 return TRUE;
265
266 if (infoPtr->hic )
267 {
268 pBitmapData = infoPtr->outdata;
269 pBitmapInfo = (LPBITMAPINFO)infoPtr->outbih;
270
271 nWidth = infoPtr->outbih->biWidth;
272 nHeight = infoPtr->outbih->biHeight;
273 }
274 else
275 {
276 pBitmapData = infoPtr->indata;
277 pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih;
278
279 nWidth = infoPtr->inbih->biWidth;
280 nHeight = infoPtr->inbih->biHeight;
281 }
282
283 if(!infoPtr->hbmPrevFrame)
284 {
285 infoPtr->hbmPrevFrame=CreateCompatibleBitmap(hDC, nWidth,nHeight );
286 }
287
289 hbmOld = SelectObject(hdcMem, infoPtr->hbmPrevFrame);
290
291 SetDIBits(hdcMem, infoPtr->hbmPrevFrame, 0, nHeight, pBitmapData, pBitmapInfo, DIB_RGB_COLORS);
292
293 /*
294 * we need to get the transparent color even without ACS_TRANSPARENT,
295 * because the style can be changed later on and the color should always
296 * be obtained in the first frame
297 */
299 {
300 infoPtr->transparentColor = GetPixel(hdcMem,0,0);
301 }
302
303 if(infoPtr->dwStyle & ACS_TRANSPARENT)
304 {
305 HDC hdcFinal = CreateCompatibleDC(hDC);
306 HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight);
307 HBITMAP hbmOld2 = SelectObject(hdcFinal, hbmFinal);
308 RECT rect;
309
310 SetRect(&rect, 0, 0, nWidth, nHeight);
311
312 if(!infoPtr->hbrushBG)
314
315 FillRect(hdcFinal, &rect, infoPtr->hbrushBG);
316 ANIMATE_TransparentBlt(infoPtr, hdcFinal, hdcMem);
317
318 SelectObject(hdcFinal, hbmOld2);
319 SelectObject(hdcMem, hbmFinal);
320 DeleteDC(hdcFinal);
321 DeleteObject(infoPtr->hbmPrevFrame);
322 infoPtr->hbmPrevFrame = hbmFinal;
323 }
324
325 if (infoPtr->dwStyle & ACS_CENTER)
326 {
327 RECT rect;
328
329 GetWindowRect(infoPtr->hwndSelf, &rect);
330 nOffsetX = ((rect.right - rect.left) - nWidth)/2;
331 nOffsetY = ((rect.bottom - rect.top) - nHeight)/2;
332 }
333 BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY);
334
335 SelectObject(hdcMem, hbmOld);
337 return TRUE;
338}
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
static void ANIMATE_TransparentBlt(ANIMATE_INFO const *infoPtr, HDC hdcDest, HDC hdcSource)
Definition: animate.c:220
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
static HBITMAP
Definition: button.c:44
#define ACS_TRANSPARENT
Definition: commctrl.h:4152
HDC hdcMem
Definition: welcome.c:104
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI SetDIBits(_In_opt_ HDC, _In_ HBITMAP, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
struct tagBITMAPINFO * LPBITMAPINFO
#define SRCCOPY
Definition: wingdi.h:333
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by ANIMATE_DrawFrame(), and ANIMATE_WindowProc().

◆ ANIMATE_Play()

static LRESULT ANIMATE_Play ( ANIMATE_INFO infoPtr,
UINT  cRepeat,
WORD  wFrom,
WORD  wTo 
)
static

Definition at line 409 of file animate.c.

410{
411 /* nothing opened */
412 if (!infoPtr->hMMio)
413 return FALSE;
414
415 if (infoPtr->hThread || infoPtr->uTimer) {
416 TRACE("Already playing\n");
417 return TRUE;
418 }
419
420 infoPtr->nFromFrame = wFrom;
421 infoPtr->nToFrame = wTo;
422 infoPtr->nLoop = cRepeat;
423
424 if (infoPtr->nToFrame == 0xFFFF)
425 infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1;
426
427 TRACE("(repeat=%d from=%d to=%d);\n",
428 infoPtr->nLoop, infoPtr->nFromFrame, infoPtr->nToFrame);
429
430 if (infoPtr->nFromFrame >= infoPtr->mah.dwTotalFrames &&
431 (SHORT)infoPtr->nFromFrame < 0)
432 infoPtr->nFromFrame = 0;
433
434 if (infoPtr->nFromFrame > infoPtr->nToFrame ||
435 infoPtr->nToFrame >= infoPtr->mah.dwTotalFrames)
436 return FALSE;
437
438 infoPtr->currFrame = infoPtr->nFromFrame;
439
440 /* seek - doesn't need to start a thread or set a timer and neither
441 * does it send a notification */
442 if (infoPtr->nFromFrame == infoPtr->nToFrame)
443 {
444 HDC hDC;
445
446 if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
447 {
448 ANIMATE_DrawFrame(infoPtr, hDC);
449
450 ReleaseDC(infoPtr->hwndSelf, hDC);
451 }
452 return TRUE;
453 }
454
455 if (infoPtr->dwStyle & ACS_TIMER)
456 {
457 TRACE("Using a timer\n");
458 /* create a timer to display AVI */
459 infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1,
460 infoPtr->mah.dwMicroSecPerFrame / 1000, NULL);
461 }
462 else
463 {
464 TRACE("Using an animation thread\n");
465 infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL );
467 infoPtr, 0, &infoPtr->threadId);
468 if(!infoPtr->hThread) return FALSE;
469
470 }
471
472 ANIMATE_Notify(infoPtr, ACN_START);
473
474 return TRUE;
475}
static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_)
Definition: animate.c:384
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
short SHORT
Definition: pedump.c:59
#define ACN_START
Definition: commctrl.h:4164
#define ACS_TIMER
Definition: commctrl.h:4154
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)

Referenced by ANIMATE_OpenW(), and ANIMATE_WindowProc().

◆ ANIMATE_Register()

void ANIMATE_Register ( void  )

Definition at line 965 of file animate.c.

966{
967 WNDCLASSW wndClass;
968
969 ZeroMemory(&wndClass, sizeof(WNDCLASSW));
970 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
972 wndClass.cbClsExtra = 0;
973 wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
974 wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW);
975 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
976 wndClass.lpszClassName = ANIMATE_CLASSW;
977
978 RegisterClassW(&wndClass);
979}
static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: animate.c:876
#define ANIMATE_CLASSW
Definition: commctrl.h:4146
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define ZeroMemory
Definition: winbase.h:1737
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define COLOR_BTNFACE
Definition: winuser.h:931
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DllMain().

◆ ANIMATE_Stop()

static BOOL ANIMATE_Stop ( ANIMATE_INFO infoPtr)
static

Definition at line 784 of file animate.c.

785{
786 /* nothing opened */
787 if (!infoPtr->hMMio)
788 return FALSE;
789
790 ANIMATE_DoStop(infoPtr);
791 return TRUE;
792}

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_StyleChanged()

static LRESULT ANIMATE_StyleChanged ( ANIMATE_INFO infoPtr,
WPARAM  wStyleType,
const STYLESTRUCT lpss 
)
static

Definition at line 862 of file animate.c.

863{
864 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
865 wStyleType, lpss->styleOld, lpss->styleNew);
866
867 if (wStyleType != GWL_STYLE) return 0;
868
869 infoPtr->dwStyle = lpss->styleNew;
870
871 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
872 return 0;
873}
DWORD styleNew
Definition: winuser.h:3696
DWORD styleOld
Definition: winuser.h:3695
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define GWL_STYLE
Definition: winuser.h:855

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_Timer()

static LRESULT ANIMATE_Timer ( ANIMATE_INFO infoPtr)
static

Definition at line 368 of file animate.c.

369{
370 HDC hDC;
371
372 if ((hDC = GetDC(infoPtr->hwndSelf)) != 0)
373 {
374 EnterCriticalSection(&infoPtr->cs);
375 ANIMATE_DrawFrame(infoPtr, hDC);
376 LeaveCriticalSection(&infoPtr->cs);
377
378 ReleaseDC(infoPtr->hwndSelf, hDC);
379 }
380
381 return 0;
382}

Referenced by ANIMATE_WindowProc().

◆ ANIMATE_TransparentBlt()

static void ANIMATE_TransparentBlt ( ANIMATE_INFO const infoPtr,
HDC  hdcDest,
HDC  hdcSource 
)
static

Definition at line 220 of file animate.c.

221{
222 HDC hdcMask;
223 HBITMAP hbmMask;
224 HBITMAP hbmOld;
225
226 /* create a transparency mask */
227 hdcMask = CreateCompatibleDC(hdcDest);
228 hbmMask = CreateBitmap(infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, 1,1,NULL);
229 hbmOld = SelectObject(hdcMask, hbmMask);
230
231 SetBkColor(hdcSource,infoPtr->transparentColor);
232 BitBlt(hdcMask,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCCOPY);
233
234 /* mask the source bitmap */
235 SetBkColor(hdcSource, RGB(0,0,0));
236 SetTextColor(hdcSource, RGB(255,255,255));
237 BitBlt(hdcSource, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
238
239 /* mask the destination bitmap */
240 SetBkColor(hdcDest, RGB(255,255,255));
241 SetTextColor(hdcDest, RGB(0,0,0));
242 BitBlt(hdcDest, 0, 0, infoPtr->inbih->biWidth, infoPtr->inbih->biHeight, hdcMask, 0, 0, SRCAND);
243
244 /* combine source and destination */
245 BitBlt(hdcDest,0,0,infoPtr->inbih->biWidth, infoPtr->inbih->biHeight,hdcSource,0,0,SRCPAINT);
246
247 SelectObject(hdcMask, hbmOld);
248 DeleteObject(hbmMask);
249 DeleteDC(hdcMask);
250}
#define RGB(r, g, b)
Definition: precomp.h:71
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define SRCPAINT
Definition: wingdi.h:334
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
#define SRCAND
Definition: wingdi.h:330

Referenced by ANIMATE_PaintFrame().

◆ ANIMATE_Unregister()

void ANIMATE_Unregister ( void  )

Definition at line 982 of file animate.c.

983{
985}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ ANIMATE_WindowProc()

static LRESULT WINAPI ANIMATE_WindowProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 876 of file animate.c.

877{
879
880 TRACE("hwnd=%p msg=%x wparam=%lx lparam=%lx\n", hWnd, uMsg, wParam, lParam);
881 if (!infoPtr && (uMsg != WM_NCCREATE))
882 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
883 switch (uMsg)
884 {
885 case ACM_OPENA:
886 return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam);
887
888 case ACM_OPENW:
889 return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam);
890
891 case ACM_PLAY:
892 return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam));
893
894 case ACM_STOP:
895 return ANIMATE_Stop(infoPtr);
896
897 case WM_CLOSE:
898 ANIMATE_Free(infoPtr);
899 return 0;
900
901 case WM_NCCREATE:
903
904 case WM_NCHITTEST:
905 return HTTRANSPARENT;
906
907 case WM_DESTROY:
908 return ANIMATE_Destroy(infoPtr);
909
910 case WM_ERASEBKGND:
911 return ANIMATE_EraseBackground(infoPtr, (HDC)wParam);
912
913 case WM_STYLECHANGED:
915
916 case WM_TIMER:
917 return ANIMATE_Timer(infoPtr);
918
919 case WM_PRINTCLIENT:
920 case WM_PAINT:
921 {
922 /* the animation has not decompressed
923 * (and displayed) the first frame yet, don't paint
924 */
925 if (!infoPtr->hbmPrevFrame)
926 {
927 /* default paint handling */
928 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
929 }
930
931 if (wParam)
932 {
933 EnterCriticalSection(&infoPtr->cs);
934 ANIMATE_PaintFrame(infoPtr, (HDC)wParam);
935 LeaveCriticalSection(&infoPtr->cs);
936 }
937 else
938 {
939 PAINTSTRUCT ps;
940 HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps);
941
942 EnterCriticalSection(&infoPtr->cs);
943 ANIMATE_PaintFrame(infoPtr, hDC);
944 LeaveCriticalSection(&infoPtr->cs);
945
946 EndPaint(infoPtr->hwndSelf, &ps);
947 }
948 }
949 break;
950
951 case WM_SIZE:
952 if (infoPtr->dwStyle & ACS_CENTER)
953 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
954 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
955
956 default:
957 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
958 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
959
960 return DefWindowProcW(hWnd, uMsg, wParam, lParam);
961 }
962 return 0;
963}
#define ERR(fmt,...)
Definition: precomp.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: animate.c:862
static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
Definition: animate.c:832
static BOOL ANIMATE_EraseBackground(ANIMATE_INFO const *infoPtr, HDC hdc)
Definition: animate.c:848
static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
Definition: animate.c:795
static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr)
Definition: animate.c:368
static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName)
Definition: animate.c:764
static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr)
Definition: animate.c:784
#define WM_APP
Definition: eventvwr.h:73
#define ACM_OPENA
Definition: commctrl.h:4156
#define ACM_STOP
Definition: commctrl.h:4162
#define ACM_OPENW
Definition: commctrl.h:4157
#define ACM_PLAY
Definition: commctrl.h:4161
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define WM_CLOSE
Definition: winuser.h:1624
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SIZE
Definition: winuser.h:1614
#define WM_NCHITTEST
Definition: winuser.h:1689
#define WM_NCCREATE
Definition: winuser.h:1686
#define WM_TIMER
Definition: winuser.h:1745
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define HTTRANSPARENT
Definition: winuser.h:2476
#define WM_USER
Definition: winuser.h:1898
#define WM_DESTROY
Definition: winuser.h:1612
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by ANIMATE_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( animate  )

Variable Documentation

◆ DWORD

Definition at line 45 of file animate.c.

◆ DWORD_PTR

Definition at line 47 of file animate.c.

Referenced by ANIMATE_Create().

◆ 

struct { ... } fnIC

◆ hModule

HMODULE hModule

Definition at line 44 of file animate.c.

Referenced by __wine_msi_call_dll_function(), _getdllprocaddr(), _Success_(), AddScreenSaver(), APIHook_GetProcAddress(), AVrfpGetProcAddress(), BasepGetModuleHandleExW(), BasepLoadLibraryAsDatafile(), BasepMapModuleHandle(), CallNotificationDll(), ClearUserApiHook(), co_IntCallLoadMenu(), Control_FillCache_RunDLLA(), Control_FillCache_RunDLLW(), CClassNode::ConvertResourceDescriptorToString(), CryptInstallOIDFunctionAddress(), CURSORICON_CopyImage(), DllMain(), DRIVER_GetNumberOfModuleRefs(), DRIVER_TryOpenDriver32(), EndUserApiHook(), EngFindImageProcAddress(), EngUnloadImage(), EngUnmapFile(), EnumPickIconResourceProc(), EnumResNameProc(), find_resourceA(), find_resourceW(), FindModule(), FindResourceA(), FindResourceExA(), FindResourceExW(), FindResourceW(), FreeLibrary(), get_manifest_in_module(), GetDriverModuleHandle(), GetDriverVersion(), GetFileVersionInfoExW(), GetFileVersionInfoSizeExW(), GetFunctionPointer(), GetModuleBaseNameA(), GetModuleBaseNameW(), GetModuleFileNameA(), GetModuleFileNameExA(), GetModuleFileNameExW(), GetModuleFileNameW(), GetModuleHandleW(), GetModuleInformation(), GetMonitorUI(), GetProcAddress(), GetSeconds(), GetServiceDllFunction(), GPNotificationThreadProc(), init_functions(), InstallSoftwareBusPnpEnumerator(), is_module_registered(), load_string(), LoadDialog(), LoadDialogResource(), LoadLibraryList(), LoadResource(), LookupThreadProc(), MLFreeLibrary(), MSACM_GetNumberOfModuleRefs(), MSACM_RegisterLocalDriver(), NotifyLogon(), printm(), RegLoadMUIStringW(), CDeviceView::RunAddHardwareWizard(), search_res_tlb(), SeiGetModuleFromAddress(), SetupDiGetClassDevPropertySheetsW(), SRSetRestorePointA(), SRSetRestorePointW(), START_TEST(), StubGetProcAddress(), test_pack_ACTCTXA(), test_pack_ACTCTXW(), testLayout(), testLoadLibraryA(), testLoadLibraryA_Wrong(), UnloadAppInitDlls(), WinMain(), and wWinMain().

◆ LPBITMAPINFOHEADER

Definition at line 48 of file animate.c.

◆ LPVOID

Definition at line 48 of file animate.c.

◆ UINT

Definition at line 45 of file animate.c.