gdi32: Add null driver entry points for the path functions.

This commit is contained in:
Alexandre Julliard 2011-03-11 20:43:15 +01:00
parent 0d27e3c0ed
commit 9c7b528b6f
3 changed files with 231 additions and 183 deletions

View File

@ -681,16 +681,16 @@ static BOOL CDECL nulldrv_wglUseFontBitmapsW( PHYSDEV dev, DWORD start, DWORD co
const DC_FUNCTIONS null_driver = const DC_FUNCTIONS null_driver =
{ {
nulldrv_AbortDoc, /* pAbortDoc */ nulldrv_AbortDoc, /* pAbortDoc */
NULL, /* pAbortPath */ nulldrv_AbortPath, /* pAbortPath */
NULL, /* pAlphaBlend */ NULL, /* pAlphaBlend */
nulldrv_AngleArc, /* pAngleArc */ nulldrv_AngleArc, /* pAngleArc */
nulldrv_Arc, /* pArc */ nulldrv_Arc, /* pArc */
nulldrv_ArcTo, /* pArcTo */ nulldrv_ArcTo, /* pArcTo */
NULL, /* pBeginPath */ nulldrv_BeginPath, /* pBeginPath */
NULL, /* pBitBlt */ NULL, /* pBitBlt */
nulldrv_ChoosePixelFormat, /* pChoosePixelFormat */ nulldrv_ChoosePixelFormat, /* pChoosePixelFormat */
nulldrv_Chord, /* pChord */ nulldrv_Chord, /* pChord */
NULL, /* pCloseFigure */ nulldrv_CloseFigure, /* pCloseFigure */
NULL, /* pCreateBitmap */ NULL, /* pCreateBitmap */
NULL, /* pCreateDC */ NULL, /* pCreateDC */
NULL, /* pCreateDIBSection */ NULL, /* pCreateDIBSection */
@ -702,7 +702,7 @@ const DC_FUNCTIONS null_driver =
nulldrv_Ellipse, /* pEllipse */ nulldrv_Ellipse, /* pEllipse */
nulldrv_EndDoc, /* pEndDoc */ nulldrv_EndDoc, /* pEndDoc */
nulldrv_EndPage, /* pEndPage */ nulldrv_EndPage, /* pEndPage */
NULL, /* pEndPath */ nulldrv_EndPath, /* pEndPath */
nulldrv_EnumICMProfiles, /* pEnumICMProfiles */ nulldrv_EnumICMProfiles, /* pEnumICMProfiles */
NULL, /* pEnumDeviceFonts */ NULL, /* pEnumDeviceFonts */
nulldrv_ExcludeClipRect, /* pExcludeClipRect */ nulldrv_ExcludeClipRect, /* pExcludeClipRect */
@ -711,9 +711,9 @@ const DC_FUNCTIONS null_driver =
nulldrv_ExtFloodFill, /* pExtFloodFill */ nulldrv_ExtFloodFill, /* pExtFloodFill */
nulldrv_ExtSelectClipRgn, /* pExtSelectClipRgn */ nulldrv_ExtSelectClipRgn, /* pExtSelectClipRgn */
NULL, /* pExtTextOut */ NULL, /* pExtTextOut */
NULL, /* pFillPath */ nulldrv_FillPath, /* pFillPath */
nulldrv_FillRgn, /* pFillRgn */ nulldrv_FillRgn, /* pFillRgn */
NULL, /* pFlattenPath */ nulldrv_FlattenPath, /* pFlattenPath */
nulldrv_FrameRgn, /* pFrameRgn */ nulldrv_FrameRgn, /* pFrameRgn */
nulldrv_GdiComment, /* pGdiComment */ nulldrv_GdiComment, /* pGdiComment */
NULL, /* pGetBitmapBits */ NULL, /* pGetBitmapBits */
@ -758,7 +758,7 @@ const DC_FUNCTIONS null_driver =
nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */ nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */
nulldrv_SelectBitmap, /* pSelectBitmap */ nulldrv_SelectBitmap, /* pSelectBitmap */
nulldrv_SelectBrush, /* pSelectBrush */ nulldrv_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */ nulldrv_SelectClipPath, /* pSelectClipPath */
nulldrv_SelectFont, /* pSelectFont */ nulldrv_SelectFont, /* pSelectFont */
nulldrv_SelectPalette, /* pSelectPalette */ nulldrv_SelectPalette, /* pSelectPalette */
nulldrv_SelectPen, /* pSelectPen */ nulldrv_SelectPen, /* pSelectPen */
@ -795,11 +795,11 @@ const DC_FUNCTIONS null_driver =
nulldrv_StartPage, /* pStartPage */ nulldrv_StartPage, /* pStartPage */
NULL, /* pStretchBlt */ NULL, /* pStretchBlt */
NULL, /* pStretchDIBits */ NULL, /* pStretchDIBits */
NULL, /* pStrokeAndFillPath */ nulldrv_StrokeAndFillPath, /* pStrokeAndFillPath */
NULL, /* pStrokePath */ nulldrv_StrokePath, /* pStrokePath */
nulldrv_SwapBuffers, /* pSwapBuffers */ nulldrv_SwapBuffers, /* pSwapBuffers */
NULL, /* pUnrealizePalette */ NULL, /* pUnrealizePalette */
NULL, /* pWidenPath */ nulldrv_WidenPath, /* pWidenPath */
nulldrv_wglCopyContext, /* pwglCopyContext */ nulldrv_wglCopyContext, /* pwglCopyContext */
nulldrv_wglCreateContext, /* pwglCreateContext */ nulldrv_wglCreateContext, /* pwglCreateContext */
nulldrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ nulldrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */

View File

@ -514,11 +514,17 @@ extern INT mirror_region( HRGN dst, HRGN src, INT width ) DECLSPEC_HIDDEN;
extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN; extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN;
/* null driver entry points */ /* null driver entry points */
extern BOOL CDECL nulldrv_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_AngleArc( PHYSDEV dev, INT x, INT y, DWORD radius, FLOAT start, FLOAT sweep ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_ArcTo( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_CloseFigure( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_EndPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern INT CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern INT CDECL nulldrv_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) DECLSPEC_HIDDEN; extern INT CDECL nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_FillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_FillRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_FillRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_FlattenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT height ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT height ) DECLSPEC_HIDDEN;
extern COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern INT CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN; extern INT CDECL nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
@ -532,11 +538,15 @@ extern BOOL CDECL nulldrv_PolyDraw( PHYSDEV dev, const POINT *points, const BYTE
extern BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_PolylineTo( PHYSDEV dev, const POINT *points, INT count ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_ScaleViewportExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_ScaleWindowExtEx( PHYSDEV dev, INT x_num, INT x_denom, INT y_num, INT y_denom, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SelectClipPath( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN; extern INT CDECL nulldrv_SetMapMode( PHYSDEV dev, INT mode ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_SetViewportExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_SetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_SetWindowExtEx( PHYSDEV dev, INT cx, INT cy, SIZE *size ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN; extern BOOL CDECL nulldrv_SetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_StrokeAndFillPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_StrokePath( PHYSDEV dev ) DECLSPEC_HIDDEN;
extern BOOL CDECL nulldrv_WidenPath( PHYSDEV dev ) DECLSPEC_HIDDEN;
static inline DC *get_nulldrv_dc( PHYSDEV dev ) static inline DC *get_nulldrv_dc( PHYSDEV dev )
{ {

View File

@ -129,27 +129,15 @@ static inline void INTERNAL_LPTODP_FLOAT(DC *dc, FLOAT_POINT *point)
*/ */
BOOL WINAPI BeginPath(HDC hdc) BOOL WINAPI BeginPath(HDC hdc)
{ {
BOOL ret = TRUE; BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
if(dc->funcs->pBeginPath)
ret = dc->funcs->pBeginPath(dc->physDev);
else
{ {
/* If path is already open, do nothing */ PHYSDEV physdev = GET_DC_PHYSDEV( dc, pBeginPath );
if(dc->path.state != PATH_Open) ret = physdev->funcs->pBeginPath( physdev );
{ release_dc_ptr( dc );
/* Make sure that path is empty */
PATH_EmptyPath(&dc->path);
/* Initialize variables for new path */
dc->path.newStroke=TRUE;
dc->path.state=PATH_Open;
}
} }
release_dc_ptr( dc );
return ret; return ret;
} }
@ -159,25 +147,15 @@ BOOL WINAPI BeginPath(HDC hdc)
*/ */
BOOL WINAPI EndPath(HDC hdc) BOOL WINAPI EndPath(HDC hdc)
{ {
BOOL ret = TRUE; BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
if(dc->funcs->pEndPath)
ret = dc->funcs->pEndPath(dc->physDev);
else
{ {
/* Check that path is currently being constructed */ PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEndPath );
if(dc->path.state!=PATH_Open) ret = physdev->funcs->pEndPath( physdev );
{ release_dc_ptr( dc );
SetLastError(ERROR_CAN_NOT_COMPLETE);
ret = FALSE;
}
/* Set flag to indicate that path is finished */
else dc->path.state=PATH_Closed;
} }
release_dc_ptr( dc );
return ret; return ret;
} }
@ -198,16 +176,15 @@ BOOL WINAPI EndPath(HDC hdc)
*/ */
BOOL WINAPI AbortPath( HDC hdc ) BOOL WINAPI AbortPath( HDC hdc )
{ {
BOOL ret = TRUE; BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
{
if(dc->funcs->pAbortPath) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pAbortPath );
ret = dc->funcs->pAbortPath(dc->physDev); ret = physdev->funcs->pAbortPath( physdev );
else /* Remove all entries from the path */ release_dc_ptr( dc );
PATH_EmptyPath( &dc->path ); }
release_dc_ptr( dc );
return ret; return ret;
} }
@ -219,33 +196,15 @@ BOOL WINAPI AbortPath( HDC hdc )
*/ */
BOOL WINAPI CloseFigure(HDC hdc) BOOL WINAPI CloseFigure(HDC hdc)
{ {
BOOL ret = TRUE; BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
if(dc->funcs->pCloseFigure)
ret = dc->funcs->pCloseFigure(dc->physDev);
else
{ {
/* Check that path is open */ PHYSDEV physdev = GET_DC_PHYSDEV( dc, pCloseFigure );
if(dc->path.state!=PATH_Open) ret = physdev->funcs->pCloseFigure( physdev );
{ release_dc_ptr( dc );
SetLastError(ERROR_CAN_NOT_COMPLETE);
ret = FALSE;
}
else
{
/* Set PT_CLOSEFIGURE on the last entry and start a new stroke */
/* It is not necessary to draw a line, PT_CLOSEFIGURE is a virtual closing line itself */
if(dc->path.numEntriesUsed)
{
dc->path.pFlags[dc->path.numEntriesUsed-1]|=PT_CLOSEFIGURE;
dc->path.newStroke=TRUE;
}
}
} }
release_dc_ptr( dc );
return ret; return ret;
} }
@ -340,16 +299,6 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
XFORM xform; XFORM xform;
HRGN hrgn; HRGN hrgn;
if(dc->funcs->pFillPath)
return dc->funcs->pFillPath(dc->physDev);
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
/* Construct a region from the path and fill it */ /* Construct a region from the path and fill it */
if(PATH_PathToRegion(pPath, dc->polyFillMode, &hrgn)) if(PATH_PathToRegion(pPath, dc->polyFillMode, &hrgn))
{ {
@ -414,25 +363,16 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
*/ */
BOOL WINAPI FillPath(HDC hdc) BOOL WINAPI FillPath(HDC hdc)
{ {
BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
BOOL bRet = FALSE;
if(!dc) return FALSE; if (dc)
if(dc->funcs->pFillPath)
bRet = dc->funcs->pFillPath(dc->physDev);
else
{ {
bRet = PATH_FillPath(dc, &dc->path); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pFillPath );
if(bRet) ret = physdev->funcs->pFillPath( physdev );
{ release_dc_ptr( dc );
/* FIXME: Should the path be emptied even if conversion
failed? */
PATH_EmptyPath(&dc->path);
}
} }
release_dc_ptr( dc ); return ret;
return bRet;
} }
@ -443,36 +383,16 @@ BOOL WINAPI FillPath(HDC hdc)
*/ */
BOOL WINAPI SelectClipPath(HDC hdc, INT iMode) BOOL WINAPI SelectClipPath(HDC hdc, INT iMode)
{ {
GdiPath *pPath; BOOL ret = FALSE;
HRGN hrgnPath; DC *dc = get_dc_ptr( hdc );
BOOL success = FALSE;
DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
{
if(dc->funcs->pSelectClipPath) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectClipPath );
success = dc->funcs->pSelectClipPath(dc->physDev, iMode); ret = physdev->funcs->pSelectClipPath( physdev, iMode );
else release_dc_ptr( dc );
{ }
pPath = &dc->path; return ret;
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
SetLastError(ERROR_CAN_NOT_COMPLETE);
/* Construct a region from the path */
else if(PATH_PathToRegion(pPath, GetPolyFillMode(hdc), &hrgnPath))
{
success = ExtSelectClipRgn( hdc, hrgnPath, iMode ) != ERROR;
DeleteObject(hrgnPath);
/* Empty the path */
if(success)
PATH_EmptyPath(pPath);
/* FIXME: Should this function delete the path even if it failed? */
}
}
release_dc_ptr( dc );
return success;
} }
@ -1688,16 +1608,12 @@ BOOL WINAPI FlattenPath(HDC hdc)
BOOL ret = FALSE; BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
if(dc->funcs->pFlattenPath) ret = dc->funcs->pFlattenPath(dc->physDev);
else
{ {
GdiPath *pPath = &dc->path; PHYSDEV physdev = GET_DC_PHYSDEV( dc, pFlattenPath );
if(pPath->state != PATH_Closed) ret = physdev->funcs->pFlattenPath( physdev );
ret = PATH_FlattenPath(pPath); release_dc_ptr( dc );
} }
release_dc_ptr( dc );
return ret; return ret;
} }
@ -1712,12 +1628,6 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
XFORM xform; XFORM xform;
BOOL ret = TRUE; BOOL ret = TRUE;
if(dc->funcs->pStrokePath)
return dc->funcs->pStrokePath(dc->physDev);
if(pPath->state != PATH_Closed)
return FALSE;
/* Save the mapping mode info */ /* Save the mapping mode info */
mapMode=GetMapMode(dc->hSelf); mapMode=GetMapMode(dc->hSelf);
GetViewportExtEx(dc->hSelf, &szViewportExt); GetViewportExtEx(dc->hSelf, &szViewportExt);
@ -1848,11 +1758,6 @@ static BOOL PATH_WidenPath(DC *dc)
pPath = &dc->path; pPath = &dc->path;
if(pPath->state == PATH_Open) {
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
PATH_FlattenPath(pPath); PATH_FlattenPath(pPath);
size = GetObjectW( dc->hPen, 0, NULL ); size = GetObjectW( dc->hPen, 0, NULL );
@ -2156,21 +2061,16 @@ static BOOL PATH_WidenPath(DC *dc)
*/ */
BOOL WINAPI StrokeAndFillPath(HDC hdc) BOOL WINAPI StrokeAndFillPath(HDC hdc)
{ {
DC *dc = get_dc_ptr( hdc ); BOOL ret = FALSE;
BOOL bRet = FALSE; DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
{
if(dc->funcs->pStrokeAndFillPath) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pStrokeAndFillPath );
bRet = dc->funcs->pStrokeAndFillPath(dc->physDev); ret = physdev->funcs->pStrokeAndFillPath( physdev );
else release_dc_ptr( dc );
{ }
bRet = PATH_FillPath(dc, &dc->path); return ret;
if(bRet) bRet = PATH_StrokePath(dc, &dc->path);
if(bRet) PATH_EmptyPath(&dc->path);
}
release_dc_ptr( dc );
return bRet;
} }
@ -2181,23 +2081,16 @@ BOOL WINAPI StrokeAndFillPath(HDC hdc)
*/ */
BOOL WINAPI StrokePath(HDC hdc) BOOL WINAPI StrokePath(HDC hdc)
{ {
BOOL ret = FALSE;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
GdiPath *pPath;
BOOL bRet = FALSE;
TRACE("(%p)\n", hdc); if (dc)
if(!dc) return FALSE;
if(dc->funcs->pStrokePath)
bRet = dc->funcs->pStrokePath(dc->physDev);
else
{ {
pPath = &dc->path; PHYSDEV physdev = GET_DC_PHYSDEV( dc, pStrokePath );
bRet = PATH_StrokePath(dc, pPath); ret = physdev->funcs->pStrokePath( physdev );
PATH_EmptyPath(pPath); release_dc_ptr( dc );
} }
release_dc_ptr( dc ); return ret;
return bRet;
} }
@ -2208,15 +2101,160 @@ BOOL WINAPI StrokePath(HDC hdc)
*/ */
BOOL WINAPI WidenPath(HDC hdc) BOOL WINAPI WidenPath(HDC hdc)
{ {
DC *dc = get_dc_ptr( hdc ); BOOL ret = FALSE;
BOOL ret = FALSE; DC *dc = get_dc_ptr( hdc );
if(!dc) return FALSE; if (dc)
{
if(dc->funcs->pWidenPath) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pWidenPath );
ret = dc->funcs->pWidenPath(dc->physDev); ret = physdev->funcs->pWidenPath( physdev );
else release_dc_ptr( dc );
ret = PATH_WidenPath(dc); }
release_dc_ptr( dc ); return ret;
return ret; }
/***********************************************************************
* null driver fallback implementations
*/
BOOL CDECL nulldrv_BeginPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
/* If path is already open, do nothing */
if (dc->path.state != PATH_Open)
{
PATH_EmptyPath(&dc->path);
dc->path.newStroke = TRUE;
dc->path.state = PATH_Open;
}
return TRUE;
}
BOOL CDECL nulldrv_EndPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Open)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
dc->path.state = PATH_Closed;
return TRUE;
}
BOOL CDECL nulldrv_AbortPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
PATH_EmptyPath( &dc->path );
return TRUE;
}
BOOL CDECL nulldrv_CloseFigure( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Open)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
/* Set PT_CLOSEFIGURE on the last entry and start a new stroke */
/* It is not necessary to draw a line, PT_CLOSEFIGURE is a virtual closing line itself */
if (dc->path.numEntriesUsed)
{
dc->path.pFlags[dc->path.numEntriesUsed - 1] |= PT_CLOSEFIGURE;
dc->path.newStroke = TRUE;
}
return TRUE;
}
BOOL CDECL nulldrv_SelectClipPath( PHYSDEV dev, INT mode )
{
BOOL ret;
HRGN hrgn;
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Closed)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
if (!PATH_PathToRegion( &dc->path, GetPolyFillMode(dev->hdc), &hrgn )) return FALSE;
ret = ExtSelectClipRgn( dev->hdc, hrgn, mode ) != ERROR;
if (ret) PATH_EmptyPath( &dc->path );
/* FIXME: Should this function delete the path even if it failed? */
DeleteObject( hrgn );
return ret;
}
BOOL CDECL nulldrv_FillPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Closed)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
if (!PATH_FillPath( dc, &dc->path )) return FALSE;
/* FIXME: Should the path be emptied even if conversion failed? */
PATH_EmptyPath( &dc->path );
return TRUE;
}
BOOL CDECL nulldrv_StrokeAndFillPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Closed)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
if (!PATH_FillPath( dc, &dc->path )) return FALSE;
if (!PATH_StrokePath( dc, &dc->path )) return FALSE;
PATH_EmptyPath( &dc->path );
return TRUE;
}
BOOL CDECL nulldrv_StrokePath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state != PATH_Closed)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
if (!PATH_StrokePath( dc, &dc->path )) return FALSE;
PATH_EmptyPath( &dc->path );
return TRUE;
}
BOOL CDECL nulldrv_FlattenPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state == PATH_Closed)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
return PATH_FlattenPath( &dc->path );
}
BOOL CDECL nulldrv_WidenPath( PHYSDEV dev )
{
DC *dc = get_nulldrv_dc( dev );
if (dc->path.state == PATH_Open)
{
SetLastError( ERROR_CAN_NOT_COMPLETE );
return FALSE;
}
return PATH_WidenPath( dc );
} }