From 1f6f82782cd8b214734173f548480f1fc9aeca47 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 8 Mar 2011 20:30:03 +0100 Subject: [PATCH] gdi32: Add null driver entry points for a number of simple painting functions. --- dlls/gdi32/driver.c | 118 ++++++++++++++++++++++++++++++++++++------ dlls/gdi32/painting.c | 100 ++++++++++++++++++++++++----------- 2 files changed, 173 insertions(+), 45 deletions(-) diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index de858c843d8..2223fe6a336 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -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 = { NULL, /* pAbortDoc */ NULL, /* pAbortPath */ NULL, /* pAlphaBlend */ NULL, /* pAngleArc */ - NULL, /* pArc */ + nulldrv_Arc, /* pArc */ NULL, /* pArcTo */ NULL, /* pBeginPath */ NULL, /* pBitBlt */ NULL, /* pChoosePixelFormat */ - NULL, /* pChord */ + nulldrv_Chord, /* pChord */ NULL, /* pCloseFigure */ NULL, /* pCreateBitmap */ NULL, /* pCreateDC */ @@ -333,7 +419,7 @@ const DC_FUNCTIONS null_driver = NULL, /* pDeleteObject */ NULL, /* pDescribePixelFormat */ NULL, /* pDeviceCapabilities */ - NULL, /* pEllipse */ + nulldrv_Ellipse, /* pEllipse */ NULL, /* pEndDoc */ NULL, /* pEndPage */ NULL, /* pEndPath */ @@ -342,7 +428,7 @@ const DC_FUNCTIONS null_driver = NULL, /* pExcludeClipRect */ NULL, /* pExtDeviceMode */ NULL, /* pExtEscape */ - NULL, /* pExtFloodFill */ + nulldrv_ExtFloodFill, /* pExtFloodFill */ NULL, /* pExtSelectClipRgn */ NULL, /* pExtTextOut */ NULL, /* pFillPath */ @@ -357,36 +443,36 @@ const DC_FUNCTIONS null_driver = NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetICMProfile */ NULL, /* pGetNearestColor */ - NULL, /* pGetPixel */ + nulldrv_GetPixel, /* pGetPixel */ NULL, /* pGetPixelFormat */ NULL, /* pGetSystemPaletteEntries */ NULL, /* pGetTextExtentExPoint */ NULL, /* pGetTextMetrics */ NULL, /* pIntersectClipRect */ NULL, /* pInvertRgn */ - NULL, /* pLineTo */ + nulldrv_LineTo, /* pLineTo */ NULL, /* pModifyWorldTransform */ - NULL, /* pMoveTo */ + nulldrv_MoveTo, /* pMoveTo */ NULL, /* pOffsetClipRgn */ NULL, /* pOffsetViewportOrg */ NULL, /* pOffsetWindowOrg */ - NULL, /* pPaintRgn */ + nulldrv_PaintRgn, /* pPaintRgn */ NULL, /* pPatBlt */ - NULL, /* pPie */ + nulldrv_Pie, /* pPie */ NULL, /* pPolyBezier */ NULL, /* pPolyBezierTo */ NULL, /* pPolyDraw */ - NULL, /* pPolyPolygon */ - NULL, /* pPolyPolyline */ - NULL, /* pPolygon */ - NULL, /* pPolyline */ + nulldrv_PolyPolygon, /* pPolyPolygon */ + nulldrv_PolyPolyline, /* pPolyPolyline */ + nulldrv_Polygon, /* pPolygon */ + nulldrv_Polyline, /* pPolyline */ NULL, /* pPolylineTo */ NULL, /* pRealizeDefaultPalette */ NULL, /* pRealizePalette */ - NULL, /* pRectangle */ + nulldrv_Rectangle, /* pRectangle */ NULL, /* pResetDC */ NULL, /* pRestoreDC */ - NULL, /* pRoundRect */ + nulldrv_RoundRect, /* pRoundRect */ NULL, /* pSaveDC */ NULL, /* pScaleViewportExt */ NULL, /* pScaleWindowExt */ @@ -409,7 +495,7 @@ const DC_FUNCTIONS null_driver = NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetMapMode */ NULL, /* pSetMapperFlags */ - NULL, /* pSetPixel */ + nulldrv_SetPixel, /* pSetPixel */ NULL, /* pSetPixelFormat */ NULL, /* pSetPolyFillMode */ NULL, /* pSetROP2 */ diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 991c326caf2..403019637d4 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -51,7 +51,10 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y ) if(PATH_IsPathOpen(dc->path)) ret = PATH_LineTo(dc, x, y); 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) { dc->CursPosX = x; dc->CursPosY = y; @@ -79,7 +82,11 @@ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt ) dc->CursPosY = y; 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 ); return ret; } @@ -100,8 +107,11 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_Arc(dc, left, top, right, bottom, xstart, ystart, xend, yend,0); - else if (dc->funcs->pArc) - ret = dc->funcs->pArc(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pArc ); + ret = physdev->funcs->pArc( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); + } release_dc_ptr( dc ); } return ret; @@ -166,9 +176,11 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,2); - else if(dc->funcs->pPie) - ret = dc->funcs->pPie(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); - + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPie ); + ret = physdev->funcs->pPie( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); + } release_dc_ptr( dc ); return ret; } @@ -188,9 +200,11 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,1); - else if(dc->funcs->pChord) - ret = dc->funcs->pChord(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend); - + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pChord ); + ret = physdev->funcs->pChord( physdev, left, top, right, bottom, xstart, ystart, xend, yend ); + } release_dc_ptr( dc ); return ret; } @@ -209,8 +223,11 @@ BOOL WINAPI Ellipse( HDC hdc, INT left, INT top, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_Ellipse(dc,left,top,right,bottom); - else if (dc->funcs->pEllipse) - ret = dc->funcs->pEllipse(dc->physDev,left,top,right,bottom); + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pEllipse ); + ret = physdev->funcs->pEllipse( physdev, left, top, right, bottom ); + } release_dc_ptr( dc ); return ret; @@ -231,8 +248,11 @@ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_Rectangle(dc, left, top, right, bottom); - else if (dc->funcs->pRectangle) - ret = dc->funcs->pRectangle(dc->physDev,left,top,right,bottom); + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRectangle ); + ret = physdev->funcs->pRectangle( physdev, left, top, right, bottom ); + } release_dc_ptr( dc ); } return ret; @@ -253,8 +273,11 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right, update_dc( dc ); if(PATH_IsPathOpen(dc->path)) ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height); - else if (dc->funcs->pRoundRect) - ret = dc->funcs->pRoundRect(dc->physDev,left,top,right,bottom,ell_width,ell_height); + else + { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRoundRect ); + ret = physdev->funcs->pRoundRect( physdev, left, top, right, bottom, ell_width, ell_height ); + } release_dc_ptr( dc ); } return ret; @@ -270,8 +293,9 @@ COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color ) if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixel ); 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 ); } return ret; @@ -287,12 +311,10 @@ BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color ) if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixel ); update_dc( dc ); - if (dc->funcs->pSetPixel) - { - dc->funcs->pSetPixel(dc->physDev,x,y,color); - ret = TRUE; - } + physdev->funcs->pSetPixel( physdev, x, y, color ); + ret = TRUE; release_dc_ptr( dc ); } return ret; @@ -312,7 +334,8 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y ) /* FIXME: should this be in the graphics driver? */ 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 ); } @@ -492,8 +515,9 @@ BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn ) if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pPaintRgn ); update_dc( dc ); - if (dc->funcs->pPaintRgn) ret = dc->funcs->pPaintRgn(dc->physDev,hrgn); + ret = physdev->funcs->pPaintRgn( physdev, hrgn ); release_dc_ptr( dc ); } return ret; @@ -600,7 +624,11 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count ) { update_dc( dc ); 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 ); } return ret; @@ -660,7 +688,11 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count ) { update_dc( dc ); 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 ); } return ret; @@ -680,7 +712,11 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts, { update_dc( dc ); 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 ); } return ret; @@ -699,7 +735,11 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts, { update_dc( dc ); 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 ); } return ret; @@ -716,8 +756,10 @@ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, if (dc) { + PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtFloodFill ); + 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 ); } return ret;