示例#1
0
/************************************************************************
 *		DrawDibBegin		[MSVIDEO.104]
 */
BOOL16 VFWAPI DrawDibBegin16(HDRAWDIB16 hdd, HDC16 hdc, INT16 dxDst,
			     INT16 dyDst, LPBITMAPINFOHEADER lpbi, INT16 dxSrc,
			     INT16 dySrc, UINT16 wFlags)
{
    return DrawDibBegin(HDRAWDIB_32(hdd), HDC_32(hdc), dxDst, dyDst, lpbi,
			dxSrc, dySrc, wFlags);
}
示例#2
0
// Here, we grab DC's and stuff from vfw and stash it into our own
// instance info.  We also get our movieinfo, which is the structure
// that has the actual hotspots in it.  It's in a global variable, even
// though I don't like global variables...
static LONG NEAR PASCAL AVIDrawBegin(PINSTINFO pi, ICDRAWBEGIN FAR *lpicd,
	LONG cbicd)
{
	LONG    l;
	l = AVIDrawQuery(pi, lpicd->lpbi);
	if ((l != 0) || (lpicd->dwFlags & ICDRAW_QUERY))
	{
		return l;
	}
	pi->hdc = lpicd->hdc;
	pi->xDst = lpicd->xDst;
	pi->yDst = lpicd->yDst;
	pi->dxDst = lpicd->dxDst;
	pi->dyDst = lpicd->dyDst;
	pi->xSrc = lpicd->xSrc;
	pi->ySrc = lpicd->ySrc;
	pi->dxSrc = lpicd->dxSrc;
	pi->dySrc = lpicd->dySrc;
	SetStretchBltMode(pi->hdc, COLORONCOLOR);
	if (!DrawDibBegin(pi->hdd, pi->hdc,
				pi->dxDst, pi->dyDst,
			lpicd->lpbi,
			pi->dxSrc, pi->dySrc,
			0))
	{
		return ICERR_UNSUPPORTED;
	}
	if (pi->hddb)
	{
		DisintegrateMemoryDC(pi);
	}
	CreateMemoryDC(pi);
	pi->lpMovie = pMovieInfo;
	return ICERR_OK;
}
示例#3
0
// Here, we grab DC's and stuff from vfw and stash it into our own
// instance info.  We also get our movieinfo, which is the structure
// that has the actual hotspots in it.  A handle to it has been stuck
// on the window with SetProp, so we get the window handle and snag it
// with GetProp.
static LONG NEAR PASCAL AVIDrawBegin(PINSTINFO pi, ICDRAWBEGIN FAR *lpicd, LONG cbicd)
{
	LONG    l;

	l = AVIDrawQuery(pi, lpicd->lpbi);
	if ((l != 0) || (lpicd->dwFlags & ICDRAW_QUERY))
	{
		return l;
	}
	pi->hdc = lpicd->hdc;
	pi->xDst = lpicd->xDst;
	pi->yDst = lpicd->yDst;
	pi->dxDst = lpicd->dxDst;
	pi->dyDst = lpicd->dyDst;
	pi->xSrc = lpicd->xSrc;
	pi->ySrc = lpicd->ySrc;
	pi->dxSrc = lpicd->dxSrc;
	pi->dySrc = lpicd->dySrc;
	SetStretchBltMode(pi->hdc, COLORONCOLOR);
	if (!DrawDibBegin(pi->hdd, pi->hdc,
			pi->dxDst, pi->dyDst,
			lpicd->lpbi,
			pi->dxSrc, pi->dySrc,
			0))
	{
		return ICERR_UNSUPPORTED;
	}
	if (pi->hddb)
	{
		DisintegrateMemoryDC(pi);
	}
	CreateMemoryDC(pi);
	{
		HANDLE	hglb;
		hglb = GetProp(lpicd->hwnd,szDrawPropName);
		if (hglb)
		{
			pi->lpMovie = (PMOVIEINFO) GlobalLock(hglb);
			pi->hMovie = hglb;
		}
		else
		{
			pi->lpMovie = NULL;
			pi->hMovie = NULL;
		}
	}
	return ICERR_OK;
}
示例#4
0
// Here, we grab DC's and stuff from vfw and stash it into our own structure
//***************************************************************************
static long AVIDrawBegin(PINSTINFO pi, ICDRAWBEGIN FAR *lpicd, LONG cbicd)
//***************************************************************************
{
	if (lpicd->dwFlags & ICDRAW_QUERY)
		return ICERR_BADFORMAT;
	pi->hdc = lpicd->hdc;
	pi->xDst = lpicd->xDst;
	pi->yDst = lpicd->yDst;
	pi->dxDst = lpicd->dxDst;
	pi->dyDst = lpicd->dyDst;
	pi->xSrc = lpicd->xSrc;
	pi->ySrc = lpicd->ySrc;
	pi->dxSrc = lpicd->dxSrc;
	pi->dySrc = lpicd->dySrc;
	SetStretchBltMode(pi->hdc, COLORONCOLOR);
	if (!DrawDibBegin(pi->hdd, pi->hdc, pi->dxDst, pi->dyDst, lpicd->lpbi, pi->dxSrc, pi->dySrc, 0))
		return ICERR_UNSUPPORTED;
	return ICERR_OK;
}
示例#5
0
文件: drawdib.c 项目: GYGit/reactos
/**********************************************************************
 *		DrawDibDraw		[MSVFW32.@]
 */
BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
                        INT xDst, INT yDst, INT dxDst, INT dyDst,
                        LPBITMAPINFOHEADER lpbi,
                        LPVOID lpBits,
                        INT xSrc, INT ySrc, INT dxSrc, INT dySrc,
                        UINT wFlags)
{
    WINE_HDD *whdd;
    BOOL ret;
    int reopen = 0;

    TRACE("(%p,%p,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08x)\n",
          hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags);

    whdd = MSVIDEO_GetHddPtr(hdd);
    if (!whdd) return FALSE;

    TRACE("whdd=%p\n", whdd);

    if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME | DDF_UPDATE | DDF_DONTDRAW | DDF_BACKGROUNDPAL))
        FIXME("wFlags == 0x%08x not handled\n", wFlags);

    if (!lpBits) 
    {
        /* Undocumented? */
        lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(num_colours(lpbi)*sizeof(RGBQUAD));
    }


#define CHANGED(x) (whdd->x != x)

    /* Check if anything changed from the parameters passed and our struct.
     * If anything changed we need to run DrawDibBegin again to ensure we
     * can support the changes.
     */
    if (!whdd->begun)
        reopen = 1;
    else if (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc))
        reopen = 2;
    else if (!(wFlags & DDF_SAME_DRAW))
    {
        if (CHANGED(lpbi) && memcmp(lpbi, whdd->lpbi, sizeof(*lpbi))) reopen = 3;
        else if (CHANGED(dxSrc)) reopen = 4;
        else if (CHANGED(dySrc)) reopen = 5;
        else if (CHANGED(dxDst)) reopen = 6;
        else if (CHANGED(dyDst)) reopen = 7;
    }
    if (reopen)
    {
        TRACE("Something changed (reason %d)!\n", reopen);
        ret = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, 0);
        if (!ret)
            return ret;
    }

#undef CHANGED

    /* If source dimensions are not specified derive them from bitmap header */
    if (dxSrc == -1 && dySrc == -1)
    {
        dxSrc = lpbi->biWidth;
        dySrc = lpbi->biHeight;
    }
    /* If destination dimensions are not specified derive them from source */
    if (dxDst == -1 && dyDst == -1)
    {
        dxDst = dxSrc;
        dyDst = dySrc;
    }

    if (!(wFlags & DDF_UPDATE)) 
    {
        if (lpbi->biCompression) 
        {
            DWORD flags = 0;

            TRACE("Compression == 0x%08x\n", lpbi->biCompression);

            if (wFlags & DDF_NOTKEYFRAME)
                flags |= ICDECOMPRESS_NOTKEYFRAME;

            ICDecompress(whdd->hic, flags, lpbi, lpBits, whdd->lpbiOut, whdd->lpvbits);
        }
        else
        {
            /* BI_RGB: lpbi->biSizeImage isn't reliable */
            DWORD biSizeImage = ((lpbi->biWidth * lpbi->biBitCount + 31) / 32) * 4 * lpbi->biHeight;
            memcpy(whdd->lpvbits, lpBits, biSizeImage);
        }
    }
    if (!(wFlags & DDF_DONTDRAW) && whdd->hpal)
    {
        if ((wFlags & DDF_BACKGROUNDPAL) && ! (wFlags & DDF_SAME_HDC))
         SelectPalette(hdc, whdd->hpal, TRUE);
        else
         SelectPalette(hdc, whdd->hpal, FALSE);
    }

    ret = StretchBlt(whdd->hdc, xDst, yDst, dxDst, dyDst, whdd->hMemDC, xSrc, ySrc, dxSrc, dySrc, SRCCOPY);
    TRACE("Painting %dx%d at %d,%d from %dx%d at %d,%d -> %d\n",
          dxDst, dyDst, xDst, yDst, dxSrc, dySrc, xSrc, ySrc, ret);

    return ret;
}
示例#6
0
/**********************************************************************
 *		DrawDibDraw		[MSVFW32.@]
 */
BOOL VFWAPI DrawDibDraw(HDRAWDIB hdd, HDC hdc,
                        INT xDst, INT yDst, INT dxDst, INT dyDst,
                        LPBITMAPINFOHEADER lpbi,
                        LPVOID lpBits,
                        INT xSrc, INT ySrc, INT dxSrc, INT dySrc,
                        UINT wFlags)
{
    WINE_HDD *whdd;
    BOOL ret = TRUE;

    TRACE("(%p,%p,%d,%d,%d,%d,%p,%p,%d,%d,%d,%d,0x%08x)\n",
          hdd, hdc, xDst, yDst, dxDst, dyDst, lpbi, lpBits, xSrc, ySrc, dxSrc, dySrc, wFlags);

    whdd = MSVIDEO_GetHddPtr(hdd);
    if (!whdd) return FALSE;

    TRACE("whdd=%p\n", whdd);

    if (wFlags & ~(DDF_SAME_HDC | DDF_SAME_DRAW | DDF_NOTKEYFRAME | DDF_UPDATE | DDF_DONTDRAW | DDF_BACKGROUNDPAL))
        FIXME("wFlags == 0x%08x not handled\n", wFlags);

    if (!lpBits) 
    {
        /* Undocumented? */
        lpBits = (LPSTR)lpbi + (WORD)(lpbi->biSize) + (WORD)(num_colours(lpbi)*sizeof(RGBQUAD));
    }


#define CHANGED(x) (whdd->x != x)

    if ((!whdd->begun) || 
        (!(wFlags & DDF_SAME_HDC) && CHANGED(hdc)) || 
        (!(wFlags & DDF_SAME_DRAW) && (CHANGED(lpbi) || CHANGED(dxSrc) || CHANGED(dySrc) || CHANGED(dxDst) || CHANGED(dyDst)))) 
    {
        TRACE("Something changed!\n");
        ret = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, 0);
        if (!ret)
            return ret;
    }

#undef CHANGED

    if ((dxDst == -1) && (dyDst == -1)) 
    {
        dxDst = dxSrc;
        dyDst = dySrc;
    }

    if (!(wFlags & DDF_UPDATE)) 
    {
        if (lpbi->biCompression) 
        {
            DWORD flags = 0;

            TRACE("Compression == 0x%08x\n", lpbi->biCompression);

            if (wFlags & DDF_NOTKEYFRAME)
                flags |= ICDECOMPRESS_NOTKEYFRAME;

            ICDecompress(whdd->hic, flags, lpbi, lpBits, whdd->lpbiOut, whdd->lpvbits);
        }
        else
        {
            /* BI_RGB: lpbi->biSizeImage isn't reliable */
            DWORD biSizeImage = ((lpbi->biWidth * lpbi->biBitCount + 31) / 32) * 4 * lpbi->biHeight;
            memcpy(whdd->lpvbits, lpBits, biSizeImage);
        }
    }
    if (!(wFlags & DDF_DONTDRAW) && whdd->hpal)
    {
        if ((wFlags & DDF_BACKGROUNDPAL) && ! (wFlags & DDF_SAME_HDC))
         SelectPalette(hdc, whdd->hpal, TRUE);
        else
         SelectPalette(hdc, whdd->hpal, FALSE);
    }

    if (!(StretchBlt(whdd->hdc, xDst, yDst, dxDst, dyDst, whdd->hMemDC, xSrc, ySrc, dxSrc, dySrc, SRCCOPY)))
        ret = FALSE;
    
    return ret;
}