mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 03:20:30 +00:00
gdi32: Always call the PatBlt entry point for blits that don't use a source.
This commit is contained in:
parent
ae2057cbb8
commit
5eb105f6e1
|
@ -35,6 +35,10 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(bitblt);
|
||||
|
||||
static inline BOOL rop_uses_src( DWORD rop )
|
||||
{
|
||||
return ((rop >> 2) & 0x330000) != (rop & 0x330000);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* PatBlt (GDI32.@)
|
||||
|
@ -42,10 +46,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(bitblt);
|
|||
BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
|
||||
INT width, INT height, DWORD rop)
|
||||
{
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
DC * dc;
|
||||
BOOL bRet = FALSE;
|
||||
|
||||
if (!dc) return FALSE;
|
||||
if (rop_uses_src( rop )) return FALSE;
|
||||
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
|
||||
|
||||
TRACE("%p %d,%d %dx%d %06x\n", hdc, left, top, width, height, rop );
|
||||
|
||||
|
@ -77,10 +82,15 @@ BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
|
|||
hdcSrc, xSrc, ySrc, hdcDst, xDst, yDst, width, height, rop);
|
||||
|
||||
if (!(dcDst = get_dc_ptr( hdcDst ))) return FALSE;
|
||||
update_dc( dcDst );
|
||||
|
||||
if (dcDst->funcs->pBitBlt || dcDst->funcs->pStretchBlt)
|
||||
if (!rop_uses_src( rop ) && dcDst->funcs->pPatBlt)
|
||||
{
|
||||
ret = dcDst->funcs->pPatBlt( dcDst->physDev, xDst, yDst, width, height, rop );
|
||||
release_dc_ptr( dcDst );
|
||||
}
|
||||
else if (dcDst->funcs->pBitBlt || dcDst->funcs->pStretchBlt)
|
||||
{
|
||||
update_dc( dcDst );
|
||||
dcSrc = get_dc_ptr( hdcSrc );
|
||||
if (dcSrc) update_dc( dcSrc );
|
||||
|
||||
|
@ -163,20 +173,25 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
|
|||
|
||||
|
||||
if (!(dcDst = get_dc_ptr( hdcDst ))) return FALSE;
|
||||
update_dc( dcDst );
|
||||
|
||||
if (dcDst->funcs->pStretchBlt)
|
||||
if (!rop_uses_src( rop ) && dcDst->funcs->pPatBlt)
|
||||
{
|
||||
ret = dcDst->funcs->pPatBlt( dcDst->physDev, xDst, yDst, widthDst, heightDst, rop );
|
||||
release_dc_ptr( dcDst );
|
||||
}
|
||||
else if (dcDst->funcs->pStretchBlt)
|
||||
{
|
||||
if ((dcSrc = get_dc_ptr( hdcSrc )))
|
||||
{
|
||||
update_dc( dcDst );
|
||||
update_dc( dcSrc );
|
||||
|
||||
ret = dcDst->funcs->pStretchBlt( dcDst->physDev, xDst, yDst, widthDst, heightDst,
|
||||
dcSrc->physDev, xSrc, ySrc, widthSrc, heightSrc,
|
||||
rop );
|
||||
release_dc_ptr( dcDst );
|
||||
release_dc_ptr( dcSrc );
|
||||
}
|
||||
release_dc_ptr( dcDst );
|
||||
}
|
||||
else if (dcDst->funcs->pStretchDIBits)
|
||||
{
|
||||
|
|
|
@ -81,13 +81,9 @@ static BOOL EMFDRV_BitBlockTransfer(
|
|||
BITMAP BM;
|
||||
WORD nBPP = 0;
|
||||
LPBITMAPINFOHEADER lpBmiH;
|
||||
BOOL useSrc;
|
||||
EMFDRV_PDEVICE* physDevSrc = (EMFDRV_PDEVICE*)devSrc;
|
||||
HBITMAP hBitmap = NULL;
|
||||
|
||||
useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000));
|
||||
if (!physDevSrc && useSrc) return FALSE;
|
||||
|
||||
if (emrType == EMR_BITBLT)
|
||||
emrSize = sizeof(EMRBITBLT);
|
||||
else if (emrType == EMR_STRETCHBLT)
|
||||
|
@ -95,23 +91,16 @@ static BOOL EMFDRV_BitBlockTransfer(
|
|||
else
|
||||
return FALSE;
|
||||
|
||||
if(useSrc)
|
||||
{
|
||||
hBitmap = GetCurrentObject(physDevSrc->hdc, OBJ_BITMAP);
|
||||
hBitmap = GetCurrentObject(physDevSrc->hdc, OBJ_BITMAP);
|
||||
|
||||
if(sizeof(BITMAP) != GetObjectW(hBitmap, sizeof(BITMAP), &BM))
|
||||
return FALSE;
|
||||
if(sizeof(BITMAP) != GetObjectW(hBitmap, sizeof(BITMAP), &BM))
|
||||
return FALSE;
|
||||
|
||||
nBPP = BM.bmPlanes * BM.bmBitsPixel;
|
||||
if(nBPP > 8) nBPP = 24; /* FIXME Can't get 16bpp to work for some reason */
|
||||
bitsSize = DIB_GetDIBWidthBytes(BM.bmWidth, nBPP) * BM.bmHeight;
|
||||
bmiSize = sizeof(BITMAPINFOHEADER) +
|
||||
(nBPP <= 8 ? 1 << nBPP : 0) * sizeof(RGBQUAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitsSize = bmiSize = 0;
|
||||
}
|
||||
nBPP = BM.bmPlanes * BM.bmBitsPixel;
|
||||
if(nBPP > 8) nBPP = 24; /* FIXME Can't get 16bpp to work for some reason */
|
||||
bitsSize = DIB_GetDIBWidthBytes(BM.bmWidth, nBPP) * BM.bmHeight;
|
||||
bmiSize = sizeof(BITMAPINFOHEADER) +
|
||||
(nBPP <= 8 ? 1 << nBPP : 0) * sizeof(RGBQUAD);
|
||||
|
||||
size = emrSize + bmiSize + bitsSize;
|
||||
|
||||
|
@ -132,27 +121,11 @@ static BOOL EMFDRV_BitBlockTransfer(
|
|||
pEMR->dwRop = rop;
|
||||
pEMR->xSrc = xSrc;
|
||||
pEMR->ySrc = ySrc;
|
||||
if (useSrc)
|
||||
{
|
||||
GetWorldTransform(physDevSrc->hdc, &pEMR->xformSrc);
|
||||
pEMR->crBkColorSrc = GetBkColor(physDevSrc->hdc);
|
||||
pEMR->iUsageSrc = DIB_RGB_COLORS;
|
||||
pEMR->offBmiSrc = emrSize;
|
||||
pEMR->offBitsSrc = emrSize + bmiSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
pEMR->xformSrc.eM11 = 1.0; /** FIXME: */
|
||||
pEMR->xformSrc.eM12 = 0.0; /** Setting default */
|
||||
pEMR->xformSrc.eM21 = 0.0; /** value. */
|
||||
pEMR->xformSrc.eM22 = 1.0; /** Where should we */
|
||||
pEMR->xformSrc.eDx = 0.0; /** get that info */
|
||||
pEMR->xformSrc.eDy = 0.0; /** ???? */
|
||||
pEMR->crBkColorSrc = 0;
|
||||
pEMR->iUsageSrc = 0;
|
||||
pEMR->offBmiSrc = 0;
|
||||
pEMR->offBitsSrc = 0;
|
||||
}
|
||||
GetWorldTransform(physDevSrc->hdc, &pEMR->xformSrc);
|
||||
pEMR->crBkColorSrc = GetBkColor(physDevSrc->hdc);
|
||||
pEMR->iUsageSrc = DIB_RGB_COLORS;
|
||||
pEMR->offBmiSrc = emrSize;
|
||||
pEMR->offBitsSrc = emrSize + bmiSize;
|
||||
pEMR->cbBmiSrc = bmiSize;
|
||||
pEMR->cbBitsSrc = bitsSize;
|
||||
if (emrType == EMR_STRETCHBLT)
|
||||
|
@ -162,42 +135,34 @@ static BOOL EMFDRV_BitBlockTransfer(
|
|||
pEMRStretch->cySrc = heightSrc;
|
||||
}
|
||||
|
||||
if (useSrc)
|
||||
{
|
||||
/* Initialize BITMAPINFO structure */
|
||||
lpBmiH = (LPBITMAPINFOHEADER)((BYTE*)pEMR + pEMR->offBmiSrc);
|
||||
/* Initialize BITMAPINFO structure */
|
||||
lpBmiH = (LPBITMAPINFOHEADER)((BYTE*)pEMR + pEMR->offBmiSrc);
|
||||
|
||||
lpBmiH->biSize = sizeof(BITMAPINFOHEADER);
|
||||
lpBmiH->biWidth = BM.bmWidth;
|
||||
lpBmiH->biHeight = BM.bmHeight;
|
||||
lpBmiH->biPlanes = BM.bmPlanes;
|
||||
lpBmiH->biBitCount = nBPP;
|
||||
/* Assume the bitmap isn't compressed and set the BI_RGB flag. */
|
||||
lpBmiH->biCompression = BI_RGB;
|
||||
lpBmiH->biSizeImage = bitsSize;
|
||||
lpBmiH->biYPelsPerMeter = 0;
|
||||
lpBmiH->biXPelsPerMeter = 0;
|
||||
lpBmiH->biClrUsed = nBPP <= 8 ? 1 << nBPP : 0;
|
||||
/* Set biClrImportant to 0, indicating that all of the
|
||||
device colors are important. */
|
||||
lpBmiH->biClrImportant = 0;
|
||||
lpBmiH->biSize = sizeof(BITMAPINFOHEADER);
|
||||
lpBmiH->biWidth = BM.bmWidth;
|
||||
lpBmiH->biHeight = BM.bmHeight;
|
||||
lpBmiH->biPlanes = BM.bmPlanes;
|
||||
lpBmiH->biBitCount = nBPP;
|
||||
/* Assume the bitmap isn't compressed and set the BI_RGB flag. */
|
||||
lpBmiH->biCompression = BI_RGB;
|
||||
lpBmiH->biSizeImage = bitsSize;
|
||||
lpBmiH->biYPelsPerMeter = 0;
|
||||
lpBmiH->biXPelsPerMeter = 0;
|
||||
lpBmiH->biClrUsed = nBPP <= 8 ? 1 << nBPP : 0;
|
||||
/* Set biClrImportant to 0, indicating that all of the
|
||||
device colors are important. */
|
||||
lpBmiH->biClrImportant = 0;
|
||||
|
||||
/* Initialize bitmap bits */
|
||||
if (GetDIBits(physDevSrc->hdc, hBitmap, 0, (UINT)lpBmiH->biHeight,
|
||||
(BYTE*)pEMR + pEMR->offBitsSrc,
|
||||
(LPBITMAPINFO)lpBmiH, DIB_RGB_COLORS))
|
||||
{
|
||||
ret = EMFDRV_WriteRecord(devDst, (EMR*)pEMR);
|
||||
if (ret) EMFDRV_UpdateBBox(devDst, &(pEMR->rclBounds));
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
/* Initialize bitmap bits */
|
||||
if (GetDIBits(physDevSrc->hdc, hBitmap, 0, (UINT)lpBmiH->biHeight,
|
||||
(BYTE*)pEMR + pEMR->offBitsSrc,
|
||||
(LPBITMAPINFO)lpBmiH, DIB_RGB_COLORS))
|
||||
{
|
||||
ret = EMFDRV_WriteRecord(devDst, (EMR*)pEMR);
|
||||
if (ret) EMFDRV_UpdateBBox(devDst, &(pEMR->rclBounds));
|
||||
}
|
||||
else
|
||||
ret = FALSE;
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, pEMR);
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue