From c82cb23bc2d6afea639e1013643df5e42bc33844 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 8 Mar 2011 19:37:08 +0100 Subject: [PATCH] gdi32: Add initial support for a null graphics driver. --- dlls/gdi32/dc.c | 2 + dlls/gdi32/driver.c | 136 +++++++++++++++++++++++++++++++++++++++ dlls/gdi32/gdi_private.h | 4 ++ 3 files changed, 142 insertions(+) diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 4388debd445..088f6c71e65 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -78,6 +78,7 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic ) if (!(dc = HeapAlloc( GetProcessHeap(), 0, sizeof(*dc) ))) return NULL; dc->funcs = funcs; + dc->nulldrv.funcs = &null_driver; dc->physDev = NULL; dc->thread = GetCurrentThreadId(); dc->refcount = 1; @@ -150,6 +151,7 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic ) HeapFree( GetProcessHeap(), 0, dc ); dc = NULL; } + dc->nulldrv.hdc = dc->hSelf; return dc; } diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 7966c6434ea..de858c843d8 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -312,6 +312,142 @@ done: } +const DC_FUNCTIONS null_driver = +{ + NULL, /* pAbortDoc */ + NULL, /* pAbortPath */ + NULL, /* pAlphaBlend */ + NULL, /* pAngleArc */ + NULL, /* pArc */ + NULL, /* pArcTo */ + NULL, /* pBeginPath */ + NULL, /* pBitBlt */ + NULL, /* pChoosePixelFormat */ + NULL, /* pChord */ + NULL, /* pCloseFigure */ + NULL, /* pCreateBitmap */ + NULL, /* pCreateDC */ + NULL, /* pCreateDIBSection */ + NULL, /* pDeleteBitmap */ + NULL, /* pDeleteDC */ + NULL, /* pDeleteObject */ + NULL, /* pDescribePixelFormat */ + NULL, /* pDeviceCapabilities */ + NULL, /* pEllipse */ + NULL, /* pEndDoc */ + NULL, /* pEndPage */ + NULL, /* pEndPath */ + NULL, /* pEnumICMProfiles */ + NULL, /* pEnumDeviceFonts */ + NULL, /* pExcludeClipRect */ + NULL, /* pExtDeviceMode */ + NULL, /* pExtEscape */ + NULL, /* pExtFloodFill */ + NULL, /* pExtSelectClipRgn */ + NULL, /* pExtTextOut */ + NULL, /* pFillPath */ + NULL, /* pFillRgn */ + NULL, /* pFlattenPath */ + NULL, /* pFrameRgn */ + NULL, /* pGdiComment */ + NULL, /* pGetBitmapBits */ + NULL, /* pGetCharWidth */ + NULL, /* pGetDIBits */ + NULL, /* pGetDeviceCaps */ + NULL, /* pGetDeviceGammaRamp */ + NULL, /* pGetICMProfile */ + NULL, /* pGetNearestColor */ + NULL, /* pGetPixel */ + NULL, /* pGetPixelFormat */ + NULL, /* pGetSystemPaletteEntries */ + NULL, /* pGetTextExtentExPoint */ + NULL, /* pGetTextMetrics */ + NULL, /* pIntersectClipRect */ + NULL, /* pInvertRgn */ + NULL, /* pLineTo */ + NULL, /* pModifyWorldTransform */ + NULL, /* pMoveTo */ + NULL, /* pOffsetClipRgn */ + NULL, /* pOffsetViewportOrg */ + NULL, /* pOffsetWindowOrg */ + NULL, /* pPaintRgn */ + NULL, /* pPatBlt */ + NULL, /* pPie */ + NULL, /* pPolyBezier */ + NULL, /* pPolyBezierTo */ + NULL, /* pPolyDraw */ + NULL, /* pPolyPolygon */ + NULL, /* pPolyPolyline */ + NULL, /* pPolygon */ + NULL, /* pPolyline */ + NULL, /* pPolylineTo */ + NULL, /* pRealizeDefaultPalette */ + NULL, /* pRealizePalette */ + NULL, /* pRectangle */ + NULL, /* pResetDC */ + NULL, /* pRestoreDC */ + NULL, /* pRoundRect */ + NULL, /* pSaveDC */ + NULL, /* pScaleViewportExt */ + NULL, /* pScaleWindowExt */ + NULL, /* pSelectBitmap */ + NULL, /* pSelectBrush */ + NULL, /* pSelectClipPath */ + NULL, /* pSelectFont */ + NULL, /* pSelectPalette */ + NULL, /* pSelectPen */ + NULL, /* pSetArcDirection */ + NULL, /* pSetBitmapBits */ + NULL, /* pSetBkColor */ + NULL, /* pSetBkMode */ + NULL, /* pSetDCBrushColor */ + NULL, /* pSetDCPenColor */ + NULL, /* pSetDIBColorTable */ + NULL, /* pSetDIBits */ + NULL, /* pSetDIBitsToDevice */ + NULL, /* pSetDeviceClipping */ + NULL, /* pSetDeviceGammaRamp */ + NULL, /* pSetMapMode */ + NULL, /* pSetMapperFlags */ + NULL, /* pSetPixel */ + NULL, /* pSetPixelFormat */ + NULL, /* pSetPolyFillMode */ + NULL, /* pSetROP2 */ + NULL, /* pSetRelAbs */ + NULL, /* pSetStretchBltMode */ + NULL, /* pSetTextAlign */ + NULL, /* pSetTextCharacterExtra */ + NULL, /* pSetTextColor */ + NULL, /* pSetTextJustification */ + NULL, /* pSetViewportExt */ + NULL, /* pSetViewportOrg */ + NULL, /* pSetWindowExt */ + NULL, /* pSetWindowOrg */ + NULL, /* pSetWorldTransform */ + NULL, /* pStartDoc */ + NULL, /* pStartPage */ + NULL, /* pStretchBlt */ + NULL, /* pStretchDIBits */ + NULL, /* pStrokeAndFillPath */ + NULL, /* pStrokePath */ + NULL, /* pSwapBuffers */ + NULL, /* pUnrealizePalette */ + NULL, /* pWidenPath */ + NULL, /* pwglCopyContext */ + NULL, /* pwglCreateContext */ + NULL, /* pwglCreateContextAttribsARB */ + NULL, /* pwglDeleteContext */ + NULL, /* pwglGetProcAddress */ + NULL, /* pwglGetPbufferDCARB */ + NULL, /* pwglMakeCurrent */ + NULL, /* pwglMakeContextCurrentARB */ + NULL, /* pwglSetPixelFormatWINE */ + NULL, /* pwglShareLists */ + NULL, /* pwglUseFontBitmapsA */ + NULL, /* pwglUseFontBitmapsW */ +}; + + /***************************************************************************** * DRIVER_GetDriverName * diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 5b241cd78b9..190afc2dc69 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -244,6 +244,7 @@ typedef struct tagDC { GDIOBJHDR header; HDC hSelf; /* Handle to this DC */ + struct gdi_physdev nulldrv; /* physdev for the null driver */ const struct tagDC_FUNCS *funcs; /* DC function table */ PHYSDEV physDev; /* Physical device (driver-specific) */ DWORD thread; /* thread owning the DC */ @@ -389,10 +390,13 @@ extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN; /* driver.c */ +extern const DC_FUNCTIONS null_driver DECLSPEC_HIDDEN; extern const DC_FUNCTIONS *DRIVER_get_display_driver(void) DECLSPEC_HIDDEN; extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN; extern BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) DECLSPEC_HIDDEN; +#define GET_DC_PHYSDEV(dc,func) ((dc)->physDev->funcs->func ? (dc)->physDev : &(dc)->nulldrv) + /* enhmetafile.c */ extern HENHMETAFILE EMF_Create_HENHMETAFILE(ENHMETAHEADER *emh, BOOL on_disk ) DECLSPEC_HIDDEN;