Commit c9c568dd authored by Alexandre Julliard's avatar Alexandre Julliard

wineps: Stroke and fill GDI paths using Postscript paths.

parent da3511fd
......@@ -525,3 +525,74 @@ BOOL PSDRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
HeapFree(GetProcessHeap(), 0, rgndata);
return TRUE;
}
static BOOL paint_path( PHYSDEV dev, BOOL stroke, BOOL fill )
{
POINT *points;
BYTE *types;
BOOL ret = FALSE;
int i, size = GetPath( dev->hdc, NULL, NULL, 0 );
if (size == -1) return FALSE;
if (!size) return TRUE;
points = HeapAlloc( GetProcessHeap(), 0, size * sizeof(*points) );
types = HeapAlloc( GetProcessHeap(), 0, size * sizeof(*types) );
if (!points || !types) goto done;
if (GetPath( dev->hdc, points, types, size ) == -1) goto done;
if (fill) PSDRV_SetPen(dev);
PSDRV_SetClip(dev);
for (i = 0; i < size; i++)
{
switch (types[i] & ~PT_CLOSEFIGURE)
{
case PT_MOVETO:
PSDRV_WriteMoveTo( dev, points[i].x, points[i].y );
break;
case PT_LINETO:
case PT_LINETO | PT_CLOSEFIGURE:
PSDRV_WriteLineTo( dev, points[i].x, points[i].y );
if (types[i] & PT_CLOSEFIGURE) PSDRV_WriteClosePath( dev );
break;
case PT_BEZIERTO:
case PT_BEZIERTO | PT_CLOSEFIGURE:
PSDRV_WriteCurveTo( dev, points + i );
if (types[i] & PT_CLOSEFIGURE) PSDRV_WriteClosePath( dev );
i += 2;
break;
}
}
if (fill) PSDRV_Brush( dev, GetPolyFillMode(dev->hdc) == ALTERNATE );
if (stroke) PSDRV_DrawLine(dev);
else PSDRV_WriteNewPath(dev);
PSDRV_ResetClip(dev);
done:
HeapFree( GetProcessHeap(), 0, points );
HeapFree( GetProcessHeap(), 0, types );
return ret;
}
/***********************************************************************
* PSDRV_FillPath
*/
BOOL PSDRV_FillPath( PHYSDEV dev )
{
return paint_path( dev, FALSE, TRUE );
}
/***********************************************************************
* PSDRV_StrokeAndFillPath
*/
BOOL PSDRV_StrokeAndFillPath( PHYSDEV dev )
{
return paint_path( dev, TRUE, TRUE );
}
/***********************************************************************
* PSDRV_StrokePath
*/
BOOL PSDRV_StrokePath( PHYSDEV dev )
{
return paint_path( dev, TRUE, FALSE );
}
......@@ -850,7 +850,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pExtFloodFill */
NULL, /* pExtSelectClipRgn */
PSDRV_ExtTextOut, /* pExtTextOut */
NULL, /* pFillPath */
PSDRV_FillPath, /* pFillPath */
NULL, /* pFillRgn */
NULL, /* pFlattenPath */
NULL, /* pFontIsLinked */
......@@ -945,8 +945,8 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_StartPage, /* pStartPage */
NULL, /* pStretchBlt */
NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */
NULL, /* pStrokePath */
PSDRV_StrokeAndFillPath, /* pStrokeAndFillPath */
PSDRV_StrokePath, /* pStrokePath */
NULL, /* pSwapBuffers */
NULL, /* pUnrealizePalette */
NULL, /* pWidenPath */
......
......@@ -433,6 +433,7 @@ extern INT PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_da
INT cbOutput, LPVOID out_data ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetCharWidth(PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer) DECLSPEC_HIDDEN;
extern BOOL PSDRV_GetTextExtentExPoint(PHYSDEV dev, LPCWSTR str, INT count,
INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size) DECLSPEC_HIDDEN;
......@@ -464,6 +465,8 @@ extern COLORREF PSDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDD
extern COLORREF PSDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF PSDRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern INT PSDRV_StartDoc( PHYSDEV dev, const DOCINFOW *doc ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL PSDRV_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2,
PRINTERINFO *pi) DECLSPEC_HIDDEN;
......
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