Commit 1ca8064c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Use NtGdiGradientFill for GdiGradientFill implementation.

parent 6762f6ac
......@@ -1117,6 +1117,16 @@ no_bounds:
BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode )
{
/* FIXME: update bounding rect */
return TRUE;
}
/**********************************************************************
* EMFDC_GradientFill
*/
BOOL EMFDC_GradientFill( DC_ATTR *dc_attr, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode )
{
EMRGRADIENTFILL *emr;
ULONG i, pt, size, num_pts = ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2);
const ULONG *pts = (const ULONG *)grad_array;
......@@ -1159,8 +1169,8 @@ BOOL CDECL EMFDRV_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
memcpy( emr->Ver, vert_array, nvert * sizeof(vert_array[0]) );
memcpy( emr->Ver + nvert, pts, num_pts * sizeof(pts[0]) );
EMFDRV_UpdateBBox( dev, &emr->rclBounds );
ret = EMFDRV_WriteRecord( dev, &emr->emr );
EMFDRV_UpdateBBox( dc_attr->emf, &emr->rclBounds );
ret = EMFDRV_WriteRecord( dc_attr->emf, &emr->emr );
HeapFree( GetProcessHeap(), 0, emr );
return ret;
}
......
......@@ -87,6 +87,8 @@ extern BOOL EMFDC_ExtTextOut( DC_ATTR *dc_attr, INT x, INT y, UINT flags, const
extern BOOL EMFDC_FillRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_FrameRgn( DC_ATTR *dc_attr, HRGN hrgn, HBRUSH hbrush, INT width,
INT height ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_GradientFill( DC_ATTR *dc_attr, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_InvertRgn( DC_ATTR *dc_attr, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_LineTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL EMFDC_MoveTo( DC_ATTR *dc_attr, INT x, INT y ) DECLSPEC_HIDDEN;
......
......@@ -466,6 +466,28 @@ BOOL WINAPI FloodFill( HDC hdc, INT x, INT y, COLORREF color )
return ExtFloodFill( hdc, x, y, color, FLOODFILLBORDER );
}
/******************************************************************************
* GdiGradientFill (GDI32.@)
*/
BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode )
{
DC_ATTR *dc_attr;
TRACE( "%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc, vert_array,
nvert, grad_array, ngrad );
if (!(dc_attr = get_dc_attr( hdc )))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (dc_attr->emf &&
!EMFDC_GradientFill( dc_attr, vert_array, nvert, grad_array, ngrad, mode ))
return FALSE;
return NtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode );
}
/***********************************************************************
* ExtTextOutW (GDI32.@)
*/
......
......@@ -918,9 +918,9 @@ POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut )
}
/******************************************************************************
* GdiGradientFill (GDI32.@)
* NtGdiGdiGradientFill (win32u.@)
*/
BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode )
{
DC *dc;
......@@ -928,8 +928,6 @@ BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
BOOL ret;
ULONG i;
TRACE("%p vert_array:%p nvert:%d grad_array:%p ngrad:%d\n", hdc, vert_array, nvert, grad_array, ngrad);
if (!vert_array || !nvert || !grad_array || !ngrad || mode > GRADIENT_FILL_TRIANGLE)
{
SetLastError( ERROR_INVALID_PARAMETER );
......@@ -938,11 +936,7 @@ BOOL WINAPI GdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
for (i = 0; i < ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2); i++)
if (((ULONG *)grad_array)[i] >= nvert) return FALSE;
if (!(dc = get_dc_ptr( hdc )))
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
update_dc( dc );
physdev = GET_DC_PHYSDEV( dc, pGradientFill );
ret = physdev->funcs->pGradientFill( physdev, vert_array, nvert, grad_array, ngrad, mode );
......
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