BitBlt and StretchBlt generate META_DIBSTRETCHBLT records.
This commit is contained in:
parent
b1f2325930
commit
e161c12e5b
|
@ -43,41 +43,8 @@ BOOL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, DWORD
|
||||||
BOOL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height,
|
BOOL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height,
|
||||||
PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop )
|
PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop )
|
||||||
{
|
{
|
||||||
BOOL ret;
|
return MFDRV_StretchBlt(devDst, xDst, yDst, width, height, devSrc,
|
||||||
DWORD len;
|
xSrc, ySrc, width, height, rop);
|
||||||
METARECORD *mr;
|
|
||||||
BITMAP BM;
|
|
||||||
METAFILEDRV_PDEVICE *physDevSrc = (METAFILEDRV_PDEVICE *)devSrc;
|
|
||||||
DC *dcSrc = physDevSrc->dc;
|
|
||||||
|
|
||||||
GetObjectA(dcSrc->hBitmap, sizeof(BITMAP), &BM);
|
|
||||||
len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight;
|
|
||||||
if (!(mr = HeapAlloc(GetProcessHeap(), 0, len)))
|
|
||||||
return FALSE;
|
|
||||||
mr->rdFunction = META_BITBLT;
|
|
||||||
*(mr->rdParm + 7) = BM.bmWidth;
|
|
||||||
*(mr->rdParm + 8) = BM.bmHeight;
|
|
||||||
*(mr->rdParm + 9) = BM.bmWidthBytes;
|
|
||||||
*(mr->rdParm +10) = BM.bmPlanes;
|
|
||||||
*(mr->rdParm +11) = BM.bmBitsPixel;
|
|
||||||
TRACE("len = %ld rop=%lx \n",len,rop);
|
|
||||||
if (GetBitmapBits(dcSrc->hBitmap,BM.bmWidthBytes * BM.bmHeight,
|
|
||||||
mr->rdParm +12))
|
|
||||||
{
|
|
||||||
mr->rdSize = len / sizeof(INT16);
|
|
||||||
*(mr->rdParm) = HIWORD(rop);
|
|
||||||
*(mr->rdParm + 1) = ySrc;
|
|
||||||
*(mr->rdParm + 2) = xSrc;
|
|
||||||
*(mr->rdParm + 3) = height;
|
|
||||||
*(mr->rdParm + 4) = width;
|
|
||||||
*(mr->rdParm + 5) = yDst;
|
|
||||||
*(mr->rdParm + 6) = xDst;
|
|
||||||
ret = MFDRV_WriteRecord( devDst, mr, mr->rdSize * 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ret = FALSE;
|
|
||||||
HeapFree( GetProcessHeap(), 0, mr);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +56,6 @@ BOOL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height,
|
||||||
* via #define STRETCH_VIA_DIB
|
* via #define STRETCH_VIA_DIB
|
||||||
*/
|
*/
|
||||||
#define STRETCH_VIA_DIB
|
#define STRETCH_VIA_DIB
|
||||||
#undef STRETCH_VIA_DIB
|
|
||||||
|
|
||||||
BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
|
BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
|
||||||
INT heightDst, PHYSDEV devSrc, INT xSrc, INT ySrc,
|
INT heightDst, PHYSDEV devSrc, INT xSrc, INT ySrc,
|
||||||
|
@ -108,9 +74,10 @@ BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
|
||||||
GetObjectA(dcSrc->hBitmap, sizeof(BITMAP), &BM);
|
GetObjectA(dcSrc->hBitmap, sizeof(BITMAP), &BM);
|
||||||
#ifdef STRETCH_VIA_DIB
|
#ifdef STRETCH_VIA_DIB
|
||||||
nBPP = BM.bmPlanes * BM.bmBitsPixel;
|
nBPP = BM.bmPlanes * BM.bmBitsPixel;
|
||||||
|
if(nBPP > 8) nBPP = 24; /* FIXME Can't get 16bpp to work for some reason */
|
||||||
len = sizeof(METARECORD) + 10 * sizeof(INT16)
|
len = sizeof(METARECORD) + 10 * sizeof(INT16)
|
||||||
+ sizeof(BITMAPINFOHEADER) + (nBPP != 24 ? 1 << nBPP: 0) * sizeof(RGBQUAD)
|
+ sizeof(BITMAPINFOHEADER) + (nBPP <= 8 ? 1 << nBPP: 0) * sizeof(RGBQUAD)
|
||||||
+ ((BM.bmWidth * nBPP + 31) / 32) * 4 * BM.bmHeight;
|
+ DIB_GetDIBWidthBytes(BM.bmWidth, nBPP) * BM.bmHeight;
|
||||||
if (!(mr = HeapAlloc( GetProcessHeap(), 0, len)))
|
if (!(mr = HeapAlloc( GetProcessHeap(), 0, len)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
mr->rdFunction = META_DIBSTRETCHBLT;
|
mr->rdFunction = META_DIBSTRETCHBLT;
|
||||||
|
@ -119,17 +86,18 @@ BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
|
||||||
lpBMI->biWidth = BM.bmWidth;
|
lpBMI->biWidth = BM.bmWidth;
|
||||||
lpBMI->biHeight = BM.bmHeight;
|
lpBMI->biHeight = BM.bmHeight;
|
||||||
lpBMI->biPlanes = 1;
|
lpBMI->biPlanes = 1;
|
||||||
lpBMI->biBitCount = nBPP; /* 1,4,8 or 24 */
|
lpBMI->biBitCount = nBPP;
|
||||||
lpBMI->biClrUsed = nBPP != 24 ? 1 << nBPP : 0;
|
lpBMI->biSizeImage = DIB_GetDIBWidthBytes(BM.bmWidth, nBPP) * lpBMI->biHeight;
|
||||||
lpBMI->biSizeImage = ((lpBMI->biWidth * nBPP + 31) / 32) * 4 * lpBMI->biHeight;
|
lpBMI->biClrUsed = nBPP <= 8 ? 1 << nBPP : 0;
|
||||||
lpBMI->biCompression = BI_RGB;
|
lpBMI->biCompression = BI_RGB;
|
||||||
lpBMI->biXPelsPerMeter = MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSX),3937,100);
|
lpBMI->biXPelsPerMeter = MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSX),3937,100);
|
||||||
lpBMI->biYPelsPerMeter = MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSY),3937,100);
|
lpBMI->biYPelsPerMeter = MulDiv(GetDeviceCaps(dcSrc->hSelf,LOGPIXELSY),3937,100);
|
||||||
lpBMI->biClrImportant = 0; /* 1 meter = 39.37 inch */
|
lpBMI->biClrImportant = 0; /* 1 meter = 39.37 inch */
|
||||||
|
|
||||||
TRACE("MF_StretchBltViaDIB->len = %ld rop=%lx PixYPM=%ld Caps=%d\n",
|
TRACE("MF_StretchBltViaDIB->len = %ld rop=%lx PixYPM=%ld Caps=%d\n",
|
||||||
len,rop,lpBMI->biYPelsPerMeter,GetDeviceCaps(hdcSrc,LOGPIXELSY));
|
len,rop,lpBMI->biYPelsPerMeter,GetDeviceCaps(dcSrc->hSelf,
|
||||||
if (GetDIBits(hdcSrc,dcSrc->w.hBitmap,0,(UINT)lpBMI->biHeight,
|
LOGPIXELSY));
|
||||||
|
if (GetDIBits(dcSrc->hSelf,dcSrc->hBitmap,0,(UINT)lpBMI->biHeight,
|
||||||
(LPSTR)lpBMI + DIB_BitmapInfoSize( (BITMAPINFO *)lpBMI,
|
(LPSTR)lpBMI + DIB_BitmapInfoSize( (BITMAPINFO *)lpBMI,
|
||||||
DIB_RGB_COLORS ),
|
DIB_RGB_COLORS ),
|
||||||
(LPBITMAPINFO)lpBMI, DIB_RGB_COLORS))
|
(LPBITMAPINFO)lpBMI, DIB_RGB_COLORS))
|
||||||
|
|
Loading…
Reference in New Issue