gdi32: Add null driver entry points for a number of simple painting functions.

This commit is contained in:
Alexandre Julliard 2011-03-08 20:30:03 +01:00
parent c82cb23bc2
commit 1f6f82782c
2 changed files with 173 additions and 45 deletions

View File

@ -312,18 +312,104 @@ done:
} }
static BOOL CDECL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
return TRUE;
}
static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
return TRUE;
}
static BOOL CDECL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{
return TRUE;
}
static BOOL CDECL nulldrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
{
return TRUE;
}
static COLORREF CDECL nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
{
return 0;
}
static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
{
return TRUE;
}
static BOOL CDECL nulldrv_MoveTo( PHYSDEV dev, INT x, INT y )
{
return TRUE;
}
static BOOL CDECL nulldrv_PaintRgn( PHYSDEV dev, HRGN rgn )
{
return TRUE;
}
static BOOL CDECL nulldrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend )
{
return TRUE;
}
static BOOL CDECL nulldrv_PolyPolygon( PHYSDEV dev, const POINT *points, const INT *counts, UINT polygons )
{
/* FIXME: could be implemented with Polygon */
return TRUE;
}
static BOOL CDECL nulldrv_PolyPolyline( PHYSDEV dev, const POINT *points, const DWORD *counts, DWORD lines )
{
/* FIXME: could be implemented with Polyline */
return TRUE;
}
static BOOL CDECL nulldrv_Polygon( PHYSDEV dev, const POINT *points, INT count )
{
return TRUE;
}
static BOOL CDECL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count )
{
return TRUE;
}
static BOOL CDECL nulldrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{
return TRUE;
}
static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT ell_width, INT ell_height )
{
return TRUE;
}
static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
{
return color;
}
const DC_FUNCTIONS null_driver = const DC_FUNCTIONS null_driver =
{ {
NULL, /* pAbortDoc */ NULL, /* pAbortDoc */
NULL, /* pAbortPath */ NULL, /* pAbortPath */
NULL, /* pAlphaBlend */ NULL, /* pAlphaBlend */
NULL, /* pAngleArc */ NULL, /* pAngleArc */
NULL, /* pArc */ nulldrv_Arc, /* pArc */
NULL, /* pArcTo */ NULL, /* pArcTo */
NULL, /* pBeginPath */ NULL, /* pBeginPath */
NULL, /* pBitBlt */ NULL, /* pBitBlt */
NULL, /* pChoosePixelFormat */ NULL, /* pChoosePixelFormat */
NULL, /* pChord */ nulldrv_Chord, /* pChord */
NULL, /* pCloseFigure */ NULL, /* pCloseFigure */
NULL, /* pCreateBitmap */ NULL, /* pCreateBitmap */
NULL, /* pCreateDC */ NULL, /* pCreateDC */
@ -333,7 +419,7 @@ const DC_FUNCTIONS null_driver =
NULL, /* pDeleteObject */ NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */ NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */ NULL, /* pDeviceCapabilities */
NULL, /* pEllipse */ nulldrv_Ellipse, /* pEllipse */
NULL, /* pEndDoc */ NULL, /* pEndDoc */
NULL, /* pEndPage */ NULL, /* pEndPage */
NULL, /* pEndPath */ NULL, /* pEndPath */
@ -342,7 +428,7 @@ const DC_FUNCTIONS null_driver =
NULL, /* pExcludeClipRect */ NULL, /* pExcludeClipRect */
NULL, /* pExtDeviceMode */ NULL, /* pExtDeviceMode */
NULL, /* pExtEscape */ NULL, /* pExtEscape */
NULL, /* pExtFloodFill */ nulldrv_ExtFloodFill, /* pExtFloodFill */
NULL, /* pExtSelectClipRgn */ NULL, /* pExtSelectClipRgn */
NULL, /* pExtTextOut */ NULL, /* pExtTextOut */
NULL, /* pFillPath */ NULL, /* pFillPath */
@ -357,36 +443,36 @@ const DC_FUNCTIONS null_driver =
NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetICMProfile */ NULL, /* pGetICMProfile */
NULL, /* pGetNearestColor */ NULL, /* pGetNearestColor */
NULL, /* pGetPixel */ nulldrv_GetPixel, /* pGetPixel */
NULL, /* pGetPixelFormat */ NULL, /* pGetPixelFormat */
NULL, /* pGetSystemPaletteEntries */ NULL, /* pGetSystemPaletteEntries */
NULL, /* pGetTextExtentExPoint */ NULL, /* pGetTextExtentExPoint */
NULL, /* pGetTextMetrics */ NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pInvertRgn */ NULL, /* pInvertRgn */
NULL, /* pLineTo */ nulldrv_LineTo, /* pLineTo */
NULL, /* pModifyWorldTransform */ NULL, /* pModifyWorldTransform */
NULL, /* pMoveTo */ nulldrv_MoveTo, /* pMoveTo */
NULL, /* pOffsetClipRgn */ NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg */ NULL, /* pOffsetViewportOrg */
NULL, /* pOffsetWindowOrg */ NULL, /* pOffsetWindowOrg */
NULL, /* pPaintRgn */ nulldrv_PaintRgn, /* pPaintRgn */
NULL, /* pPatBlt */ NULL, /* pPatBlt */
NULL, /* pPie */ nulldrv_Pie, /* pPie */
NULL, /* pPolyBezier */ NULL, /* pPolyBezier */
NULL, /* pPolyBezierTo */ NULL, /* pPolyBezierTo */
NULL, /* pPolyDraw */ NULL, /* pPolyDraw */
NULL, /* pPolyPolygon */ nulldrv_PolyPolygon, /* pPolyPolygon */
NULL, /* pPolyPolyline */ nulldrv_PolyPolyline, /* pPolyPolyline */
NULL, /* pPolygon */ nulldrv_Polygon, /* pPolygon */
NULL, /* pPolyline */ nulldrv_Polyline, /* pPolyline */
NULL, /* pPolylineTo */ NULL, /* pPolylineTo */
NULL, /* pRealizeDefaultPalette */ NULL, /* pRealizeDefaultPalette */
NULL, /* pRealizePalette */ NULL, /* pRealizePalette */
NULL, /* pRectangle */ nulldrv_Rectangle, /* pRectangle */
NULL, /* pResetDC */ NULL, /* pResetDC */
NULL, /* pRestoreDC */ NULL, /* pRestoreDC */
NULL, /* pRoundRect */ nulldrv_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */ NULL, /* pSaveDC */
NULL, /* pScaleViewportExt */ NULL, /* pScaleViewportExt */
NULL, /* pScaleWindowExt */ NULL, /* pScaleWindowExt */
@ -409,7 +495,7 @@ const DC_FUNCTIONS null_driver =
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetMapMode */ NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */ NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */ nulldrv_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */ NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */ NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */ NULL, /* pSetROP2 */

View File

@ -51,7 +51,10 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_LineTo(dc, x, y); ret = PATH_LineTo(dc, x, y);
else else
ret = dc->funcs->pLineTo && dc->funcs->pLineTo(dc->physDev,x,y); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pLineTo );
ret = physdev->funcs->pLineTo( physdev, x, y );
}
if(ret) { if(ret) {
dc->CursPosX = x; dc->CursPosX = x;
dc->CursPosY = y; dc->CursPosY = y;
@ -79,7 +82,11 @@ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt )
dc->CursPosY = y; dc->CursPosY = y;
if(PATH_IsPathOpen(dc->path)) ret = PATH_MoveTo(dc); if(PATH_IsPathOpen(dc->path)) ret = PATH_MoveTo(dc);
else if (dc->funcs->pMoveTo) ret = dc->funcs->pMoveTo(dc->physDev,x,y); else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pMoveTo );
ret = physdev->funcs->pMoveTo( physdev, x, y );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -100,8 +107,11 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc, left, top, right, bottom, xstart, ystart, xend, yend,0); ret = PATH_Arc(dc, left, top, right, bottom, xstart, ystart, xend, yend,0);
else if (dc->funcs->pArc) else
ret = dc->funcs->pArc(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pArc );
ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -166,9 +176,11 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,2); ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,2);
else if(dc->funcs->pPie) else
ret = dc->funcs->pPie(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPie );
ret = physdev->funcs->pPie( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -188,9 +200,11 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,1); ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,1);
else if(dc->funcs->pChord) else
ret = dc->funcs->pChord(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pChord );
ret = physdev->funcs->pChord( physdev, left, top, right, bottom, xstart, ystart, xend, yend );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
} }
@ -209,8 +223,11 @@ BOOL WINAPI Ellipse( HDC hdc, INT left, INT top,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Ellipse(dc,left,top,right,bottom); ret = PATH_Ellipse(dc,left,top,right,bottom);
else if (dc->funcs->pEllipse) else
ret = dc->funcs->pEllipse(dc->physDev,left,top,right,bottom); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEllipse );
ret = physdev->funcs->pEllipse( physdev, left, top, right, bottom );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
@ -231,8 +248,11 @@ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Rectangle(dc, left, top, right, bottom); ret = PATH_Rectangle(dc, left, top, right, bottom);
else if (dc->funcs->pRectangle) else
ret = dc->funcs->pRectangle(dc->physDev,left,top,right,bottom); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRectangle );
ret = physdev->funcs->pRectangle( physdev, left, top, right, bottom );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -253,8 +273,11 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
update_dc( dc ); update_dc( dc );
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height); ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height);
else if (dc->funcs->pRoundRect) else
ret = dc->funcs->pRoundRect(dc->physDev,left,top,right,bottom,ell_width,ell_height); {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRoundRect );
ret = physdev->funcs->pRoundRect( physdev, left, top, right, bottom, ell_width, ell_height );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -270,8 +293,9 @@ COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color )
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixel );
update_dc( dc ); update_dc( dc );
if (dc->funcs->pSetPixel) ret = dc->funcs->pSetPixel(dc->physDev,x,y,color); ret = physdev->funcs->pSetPixel( physdev, x, y, color );
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -287,12 +311,10 @@ BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color )
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixel );
update_dc( dc ); update_dc( dc );
if (dc->funcs->pSetPixel) physdev->funcs->pSetPixel( physdev, x, y, color );
{
dc->funcs->pSetPixel(dc->physDev,x,y,color);
ret = TRUE; ret = TRUE;
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -312,7 +334,8 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
/* FIXME: should this be in the graphics driver? */ /* FIXME: should this be in the graphics driver? */
if (PtVisible( hdc, x, y )) if (PtVisible( hdc, x, y ))
{ {
if (dc->funcs->pGetPixel) ret = dc->funcs->pGetPixel(dc->physDev,x,y); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetPixel );
ret = physdev->funcs->pGetPixel( physdev, x, y );
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
@ -492,8 +515,9 @@ BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPaintRgn );
update_dc( dc ); update_dc( dc );
if (dc->funcs->pPaintRgn) ret = dc->funcs->pPaintRgn(dc->physDev,hrgn); ret = physdev->funcs->pPaintRgn( physdev, hrgn );
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -600,7 +624,11 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
{ {
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count); if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count);
else if (dc->funcs->pPolyline) ret = dc->funcs->pPolyline(dc->physDev,pt,count); else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyline );
ret = physdev->funcs->pPolyline( physdev, pt, count );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -660,7 +688,11 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count )
{ {
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count); if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count);
else if (dc->funcs->pPolygon) ret = dc->funcs->pPolygon(dc->physDev,pt,count); else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolygon );
ret = physdev->funcs->pPolygon( physdev, pt, count );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -680,7 +712,11 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
{ {
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons); if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons);
else if (dc->funcs->pPolyPolygon) ret = dc->funcs->pPolyPolygon(dc->physDev,pt,counts,polygons); else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolygon );
ret = physdev->funcs->pPolyPolygon( physdev, pt, counts, polygons );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -699,7 +735,11 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
{ {
update_dc( dc ); update_dc( dc );
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines); if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines);
else if (dc->funcs->pPolyPolyline) ret = dc->funcs->pPolyPolyline(dc->physDev,pt,counts,polylines); else
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPolyPolyline );
ret = physdev->funcs->pPolyPolyline( physdev, pt, counts, polylines );
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;
@ -716,8 +756,10 @@ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color,
if (dc) if (dc)
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtFloodFill );
update_dc( dc ); update_dc( dc );
if (dc->funcs->pExtFloodFill) ret = dc->funcs->pExtFloodFill(dc->physDev,x,y,color,fillType); ret = physdev->funcs->pExtFloodFill( physdev, x, y, color, fillType );
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
return ret; return ret;