Commit aa230489 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiSetDIBitsToDeviceInternal for SetDIBitsToDevice.

parent eeecc2a3
......@@ -878,12 +878,13 @@ done:
}
/***********************************************************************
* SetDIBitsToDevice (GDI32.@)
* NtGdiSetDIBitsToDeviceInternal (win32u.@)
*/
INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *bmi,
UINT coloruse )
INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *bmi,
UINT coloruse, UINT max_bits, UINT max_info,
BOOL xform_coords, HANDLE xform )
{
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer;
......
......@@ -301,38 +301,47 @@ INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD width
INT xSrc, INT ySrc, UINT startscan, UINT lines,
LPCVOID bits, BITMAPINFO *info, UINT wUsage )
{
/* FIXME: Update bound rect */
return lines;
}
BOOL EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dst, INT y_dst, DWORD width, DWORD height,
INT x_src, INT y_src, UINT startscan, UINT lines,
const void *bits, const BITMAPINFO *info, UINT usage )
{
EMRSETDIBITSTODEVICE* pEMR;
DWORD bmiSize = get_dib_info_size(info, wUsage);
DWORD bmiSize = get_dib_info_size( info, usage );
DWORD size = sizeof(EMRSETDIBITSTODEVICE) + bmiSize + info->bmiHeader.biSizeImage;
BOOL ret;
pEMR = HeapAlloc(GetProcessHeap(), 0, size);
if (!pEMR) return 0;
if (!pEMR) return FALSE;
pEMR->emr.iType = EMR_SETDIBITSTODEVICE;
pEMR->emr.nSize = size;
pEMR->rclBounds.left = xDst;
pEMR->rclBounds.top = yDst;
pEMR->rclBounds.right = xDst + width - 1;
pEMR->rclBounds.bottom = yDst + height - 1;
pEMR->xDest = xDst;
pEMR->yDest = yDst;
pEMR->xSrc = xSrc;
pEMR->ySrc = ySrc;
pEMR->rclBounds.left = x_dst;
pEMR->rclBounds.top = y_dst;
pEMR->rclBounds.right = x_dst + width - 1;
pEMR->rclBounds.bottom = y_dst + height - 1;
pEMR->xDest = x_dst;
pEMR->yDest = y_dst;
pEMR->xSrc = x_src;
pEMR->ySrc = y_src;
pEMR->cxSrc = width;
pEMR->cySrc = height;
pEMR->offBmiSrc = sizeof(EMRSETDIBITSTODEVICE);
pEMR->cbBmiSrc = bmiSize;
pEMR->offBitsSrc = sizeof(EMRSETDIBITSTODEVICE) + bmiSize;
pEMR->cbBitsSrc = info->bmiHeader.biSizeImage;
pEMR->iUsageSrc = wUsage;
pEMR->iUsageSrc = usage;
pEMR->iStartScan = startscan;
pEMR->cScans = lines;
memcpy((BYTE*)pEMR + pEMR->offBmiSrc, info, bmiSize);
memcpy((BYTE*)pEMR + pEMR->offBitsSrc, bits, info->bmiHeader.biSizeImage);
if (EMFDRV_WriteRecord(dev, (EMR*)pEMR))
EMFDRV_UpdateBBox(dev, &(pEMR->rclBounds));
if ((ret = EMFDRV_WriteRecord( dc_attr->emf, (EMR*)pEMR )))
EMFDRV_UpdateBBox( dc_attr->emf, &pEMR->rclBounds );
HeapFree( GetProcessHeap(), 0, pEMR);
return lines;
return ret;
}
......@@ -91,6 +91,10 @@ extern BOOL METADC_ScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom, INT y_num,
extern HGDIOBJ METADC_SelectObject( HDC hdc, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL METADC_SelectPalette( HDC hdc, HPALETTE palette ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetBkMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
extern INT METADC_SetDIBitsToDevice( HDC hdc, INT x_dest, INT y_dest, DWORD width, DWORD height,
INT x_src, INT y_src, UINT startscan, UINT lines,
const void *bits, const BITMAPINFO *info,
UINT coloruse ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetLayout( HDC hdc, DWORD layout ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetTextCharacterExtra( HDC hdc, INT extra ) DECLSPEC_HIDDEN;
extern BOOL METADC_SetMapMode( HDC hdc, INT mode ) DECLSPEC_HIDDEN;
......@@ -173,6 +177,10 @@ extern BOOL EMFDC_SelectObject( DC_ATTR *dc_attr, HGDIOBJ obj ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SelectPalette( DC_ATTR *dc_attr, HPALETTE palette ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern INT EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dest, INT y_dest, DWORD width,
DWORD height, INT x_src, INT y_src, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *info,
UINT coloruse ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetLayout( DC_ATTR *dc_attr, DWORD layout ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_SetMapperFlags( DC_ATTR *dc_attr, DWORD flags ) DECLSPEC_HIDDEN;
......
......@@ -1279,6 +1279,28 @@ BOOL WINAPI GdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int
}
/***********************************************************************
* SetDIBitsToDevice (GDI32.@)
*/
INT WINAPI SetDIBitsToDevice( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
DWORD cy, INT x_src, INT y_src, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *bmi,
UINT coloruse )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc ))
return METADC_SetDIBitsToDevice( hdc, x_dst, y_dst, cx, cy, x_src, y_src, startscan,
lines, bits, bmi, coloruse );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_SetDIBitsToDevice( dc_attr, x_dst, y_dst, cx, cy, x_src, y_src,
startscan, lines, bits, bmi, coloruse ))
return 0;
return NtGdiSetDIBitsToDeviceInternal( hdc, x_dst, y_dst, cx, cy, x_src, y_src,
startscan, lines, bits, bmi, coloruse,
0, 0, FALSE, NULL );
}
/***********************************************************************
* BeginPath (GDI32.@)
*/
BOOL WINAPI BeginPath(HDC hdc)
......
......@@ -146,11 +146,11 @@ INT CDECL MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
/***********************************************************************
* MFDRV_SetDIBitsToDevice
* METADC_SetDIBitsToDevice
*/
INT CDECL MFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, UINT startscan,
UINT lines, LPCVOID bits, BITMAPINFO *info, UINT coloruse )
INT METADC_SetDIBitsToDevice( HDC hdc, INT x_dst, INT y_dst, DWORD width, DWORD height,
INT x_src, INT y_src, UINT startscan, UINT lines,
const void *bits, const BITMAPINFO *info, UINT coloruse )
{
DWORD infosize = get_dib_info_size(info, coloruse);
......@@ -163,15 +163,15 @@ INT CDECL MFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD cx,
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;
mr->rdParm[3] = y_src;
mr->rdParm[4] = x_src;
mr->rdParm[5] = height;
mr->rdParm[6] = width;
mr->rdParm[7] = y_dst;
mr->rdParm[8] = x_dst;
memcpy(mr->rdParm + 9, info, infosize);
memcpy(mr->rdParm + 9 + infosize / 2, bits, info->bmiHeader.biSizeImage);
MFDRV_WriteRecord( dev, mr, mr->rdSize * 2 );
metadc_record( hdc, mr, mr->rdSize * 2 );
HeapFree( GetProcessHeap(), 0, mr );
return lines;
}
......@@ -185,7 +185,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SetBoundsRect, /* pSetBoundsRect */
MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
MFDRV_SetDCPenColor, /* pSetDCPenColor*/
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetPixel */
......
......@@ -97,10 +97,6 @@ extern COLORREF CDECL MFDRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_H
extern COLORREF CDECL MFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF CDECL MFDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc,
UINT startscan, UINT lines, LPCVOID bits,
BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN;
extern INT CDECL MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
const void *bits, BITMAPINFO *info, UINT wUsage, DWORD dwRop ) DECLSPEC_HIDDEN;
......
......@@ -263,6 +263,11 @@ LONG WINAPI NtGdiSetBitmapBits( HBITMAP hbitmap, LONG count, const void *bit
BOOL WINAPI NtGdiSetBitmapDimension( HBITMAP hbitmap, INT x, INT y, SIZE *prev_size );
BOOL WINAPI NtGdiSetBrushOrg( HDC hdc, INT x, INT y, POINT *prev_org );
UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags );
INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
DWORD cy, INT x_src, INT y_src, UINT startscan,
UINT lines, const void *bits, const BITMAPINFO *bmi,
UINT coloruse, UINT max_bits, UINT max_info,
BOOL xform_coords, HANDLE xform );
BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr );
DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout );
INT WINAPI NtGdiSetMetaRgn( HDC hdc );
......
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