Commit 56166a6f authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Implemented recording of StretchDIBits and SetDIBitsToDevice and

playback of SetDIBitsToDevice. Cleaned up PlayMetaFileRecord a bit.
parent 94bb5bb1
......@@ -8,6 +8,7 @@
#include "metafiledrv.h"
#include "heap.h"
#include "debug.h"
#include "bitmap.h"
DEFAULT_DEBUG_CHANNEL(metafile)
......@@ -150,3 +151,84 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
}
/***********************************************************************
* MFDRV_StretchDIBits
*/
INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc, INT widthSrc,
INT heightSrc, const void *bits,
const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
{
DWORD len, infosize, imagesize;
METARECORD *mr;
infosize = DIB_BitmapInfoSize(info, wUsage);
imagesize = DIB_GetDIBImageBytes( info->bmiHeader.biWidth,
info->bmiHeader.biHeight,
info->bmiHeader.biBitCount );
len = sizeof(METARECORD) + 10 * sizeof(WORD) + infosize + imagesize;
mr = (METARECORD *)HeapAlloc( SystemHeap, 0, len );
if(!mr) return 0;
mr->rdSize = len / 2;
mr->rdFunction = META_STRETCHDIB;
mr->rdParm[0] = LOWORD(dwRop);
mr->rdParm[1] = HIWORD(dwRop);
mr->rdParm[2] = wUsage;
mr->rdParm[3] = (INT16)heightSrc;
mr->rdParm[4] = (INT16)widthSrc;
mr->rdParm[5] = (INT16)ySrc;
mr->rdParm[6] = (INT16)xSrc;
mr->rdParm[7] = (INT16)heightDst;
mr->rdParm[8] = (INT16)widthDst;
mr->rdParm[9] = (INT16)yDst;
mr->rdParm[10] = (INT16)xDst;
memcpy(mr->rdParm + 11, info, infosize);
memcpy(mr->rdParm + 11 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 );
HeapFree( SystemHeap, 0, mr );
return heightSrc;
}
/***********************************************************************
* MFDRV_SetDIBitsToDeivce
*/
INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse )
{
DWORD len, infosize, imagesize;
METARECORD *mr;
infosize = DIB_BitmapInfoSize(info, coloruse);
imagesize = DIB_GetDIBImageBytes( info->bmiHeader.biWidth,
info->bmiHeader.biHeight,
info->bmiHeader.biBitCount );
len = sizeof(METARECORD) + 8 * sizeof(WORD) + infosize + imagesize;
mr = (METARECORD *)HeapAlloc( SystemHeap, 0, len );
if(!mr) return 0;
mr->rdSize = len / 2;
mr->rdFunction = META_SETDIBTODEV;
mr->rdParm[0] = coloruse;
mr->rdParm[1] = lines;
mr->rdParm[2] = startscan;
mr->rdParm[3] = (INT16)ySrc;
mr->rdParm[4] = (INT16)xSrc;
mr->rdParm[5] = (INT16)cy;
mr->rdParm[6] = (INT16)cx;
mr->rdParm[7] = (INT16)yDst;
mr->rdParm[8] = (INT16)xDst;
memcpy(mr->rdParm + 9, info, infosize);
memcpy(mr->rdParm + 9 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 );
HeapFree( SystemHeap, 0, mr );
return lines;
}
......@@ -69,7 +69,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetDeviceClipping */
NULL, /* pSetDIBitsToDevice */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
MFDRV_SetMapMode, /* pSetMapMode */
NULL, /* pSetMapperFlags */
MFDRV_SetPixel, /* pSetPixel */
......@@ -86,7 +86,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SetWindowExt, /* pSetWindowExt */
MFDRV_SetWindowOrg, /* pSetWindowOrg */
MFDRV_StretchBlt, /* pStretchBlt */
NULL /* pStretchDIBits */
MFDRV_StretchDIBits /* pStretchDIBits */
};
......
......@@ -56,7 +56,7 @@ extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap );
/* objects/dib.c */
extern int DIB_GetDIBWidthBytes( int width, int depth );
extern int DIB_GetDIBImageBytes( int width, int height, int depth );
extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
extern int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
int *height, WORD *bpp, WORD *compr );
extern void DIB_UpdateDIBSection( DC *dc, BOOL toDIB );
......
......@@ -86,5 +86,14 @@ extern BOOL MFDRV_ExtTextOut( struct tagDC *dc, INT x, INT y,
UINT flags, const RECT *lprect, LPCSTR str,
UINT count, const INT *lpDx );
extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn );
extern INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc,
UINT startscan, UINT lines, LPCVOID bits,
const BITMAPINFO *info, UINT coloruse );
extern INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, const void *bits,
const BITMAPINFO *info, UINT wUsage,
DWORD dwRop );
#endif /* __WINE_METAFILEDRV_H */
......@@ -58,7 +58,7 @@ int DIB_GetDIBImageBytes( int width, int height, int depth )
*
* Return the size of the bitmap info structure including color table.
*/
int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse )
int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
{
int colors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment