Commit 225004e1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiStretchDIBitsInternal for StretchDIBits.

parent aa230489
......@@ -604,12 +604,12 @@ done:
}
/***********************************************************************
* StretchDIBits (GDI32.@)
* NtGdiStretchDIBitsInternal (win32u.@)
*/
INT WINAPI DECLSPEC_HOTPATCH StretchDIBits( HDC hdc, INT xDst, INT yDst, INT widthDst, INT heightDst,
INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT xDst, INT yDst, INT widthDst, INT heightDst,
INT xSrc, INT ySrc, INT widthSrc, INT heightSrc,
const void *bits, const BITMAPINFO *bmi, UINT coloruse,
DWORD rop )
DWORD rop, UINT max_info, UINT max_bits, HANDLE xform )
{
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer;
......
......@@ -244,12 +244,20 @@ INT CDECL EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, I
INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, const void *bits,
BITMAPINFO *info, UINT wUsage, DWORD dwRop )
{
/* FIXME: Update bound rect */
return heightSrc;
}
BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
INT x_src, INT y_src, INT width_src, INT height_src, const void *bits,
const BITMAPINFO *info, UINT usage, DWORD rop )
{
EMRSTRETCHDIBITS *emr;
BOOL ret;
UINT bmi_size, emr_size;
/* calculate the size of the colour table */
bmi_size = get_dib_info_size(info, wUsage);
bmi_size = get_dib_info_size( info, usage );
emr_size = sizeof (EMRSTRETCHDIBITS) + bmi_size + info->bmiHeader.biSizeImage;
emr = HeapAlloc(GetProcessHeap(), 0, emr_size );
......@@ -265,36 +273,36 @@ INT CDECL EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, I
emr->emr.iType = EMR_STRETCHDIBITS;
emr->emr.nSize = emr_size;
emr->xDest = xDst;
emr->yDest = yDst;
emr->cxDest = widthDst;
emr->cyDest = heightDst;
emr->dwRop = dwRop;
emr->xSrc = xSrc; /* FIXME: only save the piece of the bitmap needed */
emr->ySrc = ySrc;
emr->xDest = x_dst;
emr->yDest = y_dst;
emr->cxDest = width_dst;
emr->cyDest = height_dst;
emr->dwRop = rop;
emr->xSrc = x_src; /* FIXME: only save the piece of the bitmap needed */
emr->ySrc = y_src;
emr->iUsageSrc = wUsage;
emr->iUsageSrc = usage;
emr->offBmiSrc = sizeof (EMRSTRETCHDIBITS);
emr->cbBmiSrc = bmi_size;
emr->offBitsSrc = emr->offBmiSrc + bmi_size;
emr->cbBitsSrc = info->bmiHeader.biSizeImage;
emr->cxSrc = widthSrc;
emr->cySrc = heightSrc;
emr->cxSrc = width_src;
emr->cySrc = height_src;
emr->rclBounds.left = xDst;
emr->rclBounds.top = yDst;
emr->rclBounds.right = xDst + widthDst;
emr->rclBounds.bottom = yDst + heightDst;
emr->rclBounds.left = x_dst;
emr->rclBounds.top = y_dst;
emr->rclBounds.right = x_dst + width_dst;
emr->rclBounds.bottom = y_dst + height_dst;
/* save the record we just created */
ret = EMFDRV_WriteRecord( dev, &emr->emr );
ret = EMFDRV_WriteRecord( dc_attr->emf, &emr->emr );
if(ret)
EMFDRV_UpdateBBox( dev, &emr->rclBounds );
EMFDRV_UpdateBBox( dc_attr->emf, &emr->rclBounds );
HeapFree(GetProcessHeap(), 0, emr);
return ret ? heightSrc : GDI_ERROR;
return ret;
}
INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD width, DWORD height,
......
......@@ -113,7 +113,10 @@ extern BOOL METADC_SetWindowOrgEx( HDC, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_StretchBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop );
extern INT METADC_StretchDIBits( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
INT x_src, INT y_src, INT width_src, INT height_src,
const void *bits, const BITMAPINFO *info, UINT coloruse,
DWORD rop ) DECLSPEC_HIDDEN;
/* enhanced metafiles */
extern BOOL EMFDC_AbortPath( DC_ATTR *dc_attr ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_AlphaBlend( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
......@@ -198,5 +201,9 @@ extern BOOL EMFDC_SetWorldTransform( DC_ATTR *dc_attr, const XFORM *xform ) DECL
extern BOOL EMFDC_StretchBlt( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop );
extern BOOL EMFDC_StretchDIBits( DC_ATTR *dc_attr, INT x_dst, INT y_dst, INT width_dst,
INT height_dst, INT x_src, INT y_src, INT width_src,
INT height_src, const void *bits, const BITMAPINFO *info,
UINT coloruse, DWORD rop ) DECLSPEC_HIDDEN;
#endif /* __WINE_GDI_PRIVATE_H */
......@@ -1301,6 +1301,29 @@ INT WINAPI SetDIBitsToDevice( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
}
/***********************************************************************
* StretchDIBits (GDI32.@)
*/
INT WINAPI DECLSPEC_HOTPATCH StretchDIBits( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
INT height_dst, INT x_src, INT y_src, INT width_src,
INT height_src, const void *bits, const BITMAPINFO *bmi,
UINT coloruse, DWORD rop )
{
DC_ATTR *dc_attr;
if (is_meta_dc( hdc ))
return METADC_StretchDIBits( hdc, x_dst, y_dst, width_dst, height_dst, x_src, y_src,
width_src, height_src, bits, bmi, coloruse, rop );
if (!(dc_attr = get_dc_attr( hdc ))) return FALSE;
if (dc_attr->emf && !EMFDC_StretchDIBits( dc_attr, x_dst, y_dst, width_dst, height_dst,
x_src, y_src, width_src, height_src, bits,
bmi, coloruse, rop ))
return FALSE;
return NtGdiStretchDIBitsInternal( hdc, x_dst, y_dst, width_dst, height_dst, x_src, y_src,
width_src, height_src, bits, bmi, coloruse, rop,
0, 0, NULL );
}
/***********************************************************************
* BeginPath (GDI32.@)
*/
BOOL WINAPI BeginPath(HDC hdc)
......
......@@ -112,36 +112,36 @@ BOOL METADC_StretchBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width_dst, INT he
}
/***********************************************************************
* MFDRV_StretchDIBits
* METADC_StretchDIBits
*/
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 )
INT METADC_StretchDIBits( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
INT height_dst, INT x_src, INT y_src, INT width_src,
INT height_src, const void *bits,
const BITMAPINFO *info, UINT usage, DWORD rop )
{
DWORD infosize = get_dib_info_size(info, wUsage);
DWORD infosize = get_dib_info_size( info, usage );
DWORD len = sizeof(METARECORD) + 10 * sizeof(WORD) + infosize + info->bmiHeader.biSizeImage;
METARECORD *mr = HeapAlloc( GetProcessHeap(), 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;
mr->rdParm[0] = LOWORD(rop);
mr->rdParm[1] = HIWORD(rop);
mr->rdParm[2] = usage;
mr->rdParm[3] = height_src;
mr->rdParm[4] = width_src;
mr->rdParm[5] = y_src;
mr->rdParm[6] = x_src;
mr->rdParm[7] = height_dst;
mr->rdParm[8] = width_dst;
mr->rdParm[9] = y_dst;
mr->rdParm[10] = x_dst;
memcpy(mr->rdParm + 11, info, infosize);
memcpy(mr->rdParm + 11 + 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 heightSrc;
return height_src;
}
......
......@@ -193,7 +193,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pStartDoc */
NULL, /* pStartPage */
NULL, /* pStretchBlt */
MFDRV_StretchDIBits, /* pStretchDIBits */
NULL, /* pStretchDIBits */
MFDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
MFDRV_StrokePath, /* pStrokePath */
NULL, /* pUnrealizePalette */
......
......@@ -97,9 +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_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;
extern BOOL CDECL MFDRV_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL MFDRV_WidenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
......
......@@ -283,6 +283,11 @@ INT WINAPI NtGdiStartPage( HDC hdc );
BOOL WINAPI NtGdiStretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
DWORD rop, COLORREF bk_color );
INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
INT height_dst, INT x_src, INT y_src, INT width_src,
INT height_src, const void *bits, const BITMAPINFO *bmi,
UINT coloruse, DWORD rop, UINT max_info, UINT max_bits,
HANDLE xform );
BOOL WINAPI NtGdiStrokePath( HDC hdc );
BOOL WINAPI NtGdiStrokeAndFillPath( HDC hdc );
BOOL WINAPI NtGdiTransformPoints( HDC hdc, const POINT *points_in, POINT *points_out,
......
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