Alexandre Julliard : gdi32: Add null driver entry points for the pixel format functions.

Alexandre Julliard julliard at winehq.org
Fri Mar 11 10:23:38 CST 2011


Module: wine
Branch: master
Commit: 806d0c4f86db654dc72a28cfd94b98233ef102fb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=806d0c4f86db654dc72a28cfd94b98233ef102fb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Mar 11 12:26:25 2011 +0100

gdi32: Add null driver entry points for the pixel format functions.

---

 dlls/gdi32/driver.c   |   36 +++++++++++++++++++++---
 dlls/gdi32/painting.c |   70 +++++++++++++++++++++----------------------------
 2 files changed, 61 insertions(+), 45 deletions(-)

diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index e1a9897..61cbfe5 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -323,6 +323,11 @@ static BOOL CDECL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bo
     return TRUE;
 }
 
+static INT CDECL nulldrv_ChoosePixelFormat( PHYSDEV dev, const PIXELFORMATDESCRIPTOR *descr )
+{
+    return 0;
+}
+
 static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
                                  INT xstart, INT ystart, INT xend, INT yend )
 {
@@ -334,6 +339,12 @@ static BOOL CDECL nulldrv_DeleteObject( PHYSDEV dev, HGDIOBJ obj )
     return TRUE;
 }
 
+static INT CDECL nulldrv_DescribePixelFormat( PHYSDEV dev, INT format,
+                                              UINT size, PIXELFORMATDESCRIPTOR * descr )
+{
+    return 0;
+}
+
 static DWORD CDECL nulldrv_DeviceCapabilities( LPSTR buffer, LPCSTR device, LPCSTR port,
                                                WORD cap, LPSTR output, DEVMODEA *devmode )
 {
@@ -382,6 +393,11 @@ static COLORREF CDECL nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
     return 0;
 }
 
+static INT CDECL nulldrv_GetPixelFormat( PHYSDEV dev )
+{
+    return 0;
+}
+
 static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
 {
     return TRUE;
@@ -505,6 +521,11 @@ static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF colo
     return color;
 }
 
+static BOOL CDECL nulldrv_SetPixelFormat( PHYSDEV dev, INT format, const PIXELFORMATDESCRIPTOR *descr )
+{
+    return FALSE;
+}
+
 static INT CDECL nulldrv_SetPolyFillMode( PHYSDEV dev, INT mode )
 {
     return mode;
@@ -555,6 +576,11 @@ static INT CDECL nulldrv_StartPage( PHYSDEV dev )
     return 1;
 }
 
+static BOOL CDECL nulldrv_SwapBuffers( PHYSDEV dev )
+{
+    return TRUE;
+}
+
 static BOOL CDECL nulldrv_wglCopyContext( HGLRC ctx_src, HGLRC ctx_dst, UINT mask )
 {
     return FALSE;
@@ -626,7 +652,7 @@ const DC_FUNCTIONS null_driver =
     nulldrv_ArcTo,                      /* pArcTo */
     NULL,                               /* pBeginPath */
     NULL,                               /* pBitBlt */
-    NULL,                               /* pChoosePixelFormat */
+    nulldrv_ChoosePixelFormat,          /* pChoosePixelFormat */
     nulldrv_Chord,                      /* pChord */
     NULL,                               /* pCloseFigure */
     NULL,                               /* pCreateBitmap */
@@ -635,7 +661,7 @@ const DC_FUNCTIONS null_driver =
     NULL,                               /* pDeleteBitmap */
     NULL,                               /* pDeleteDC */
     nulldrv_DeleteObject,               /* pDeleteObject */
-    NULL,                               /* pDescribePixelFormat */
+    nulldrv_DescribePixelFormat,        /* pDescribePixelFormat */
     nulldrv_DeviceCapabilities,         /* pDeviceCapabilities */
     nulldrv_Ellipse,                    /* pEllipse */
     nulldrv_EndDoc,                     /* pEndDoc */
@@ -662,7 +688,7 @@ const DC_FUNCTIONS null_driver =
     NULL,                               /* pGetICMProfile */
     NULL,                               /* pGetNearestColor */
     nulldrv_GetPixel,                   /* pGetPixel */
-    NULL,                               /* pGetPixelFormat */
+    nulldrv_GetPixelFormat,             /* pGetPixelFormat */
     NULL,                               /* pGetSystemPaletteEntries */
     NULL,                               /* pGetTextExtentExPoint */
     NULL,                               /* pGetTextMetrics */
@@ -715,7 +741,7 @@ const DC_FUNCTIONS null_driver =
     nulldrv_SetMapMode,                 /* pSetMapMode */
     nulldrv_SetMapperFlags,             /* pSetMapperFlags */
     nulldrv_SetPixel,                   /* pSetPixel */
-    NULL,                               /* pSetPixelFormat */
+    nulldrv_SetPixelFormat,             /* pSetPixelFormat */
     nulldrv_SetPolyFillMode,            /* pSetPolyFillMode */
     nulldrv_SetROP2,                    /* pSetROP2 */
     nulldrv_SetRelAbs,                  /* pSetRelAbs */
@@ -735,7 +761,7 @@ const DC_FUNCTIONS null_driver =
     NULL,                               /* pStretchDIBits */
     NULL,                               /* pStrokeAndFillPath */
     NULL,                               /* pStrokePath */
-    NULL,                               /* pSwapBuffers */
+    nulldrv_SwapBuffers,                /* pSwapBuffers */
     NULL,                               /* pUnrealizePalette */
     NULL,                               /* pWidenPath */
     nulldrv_wglCopyContext,             /* pwglCopyContext */
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index 8c788d5..22cc50c 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -545,12 +545,12 @@ INT WINAPI ChoosePixelFormat( HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd )
 
     TRACE("(%p,%p)\n",hdc,ppfd);
 
-    if (!dc) return 0;
-
-    if (!dc->funcs->pChoosePixelFormat) FIXME(" :stub\n");
-    else ret = dc->funcs->pChoosePixelFormat(dc->physDev,ppfd);
-
-    release_dc_ptr( dc );
+    if (dc)
+    {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pChoosePixelFormat );
+        ret = physdev->funcs->pChoosePixelFormat( physdev, ppfd );
+        release_dc_ptr( dc );
+    }
     return ret;
 }
 
@@ -576,13 +576,13 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
 
     TRACE("(%p,%d,%p)\n",hdc,iPixelFormat,ppfd);
 
-    if (!dc) return 0;
-
-    update_dc( dc );
-    if (!dc->funcs->pSetPixelFormat) FIXME(" :stub\n");
-    else bRet = dc->funcs->pSetPixelFormat(dc->physDev,iPixelFormat,ppfd);
-
-    release_dc_ptr( dc );
+    if (dc)
+    {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixelFormat );
+        update_dc( dc );
+        bRet = physdev->funcs->pSetPixelFormat( physdev, iPixelFormat, ppfd );
+        release_dc_ptr( dc );
+    }
     return bRet;
 }
 
@@ -605,13 +605,13 @@ INT WINAPI GetPixelFormat( HDC hdc )
 
     TRACE("(%p)\n",hdc);
 
-    if (!dc) return 0;
-
-    update_dc( dc );
-    if (!dc->funcs->pGetPixelFormat) FIXME(" :stub\n");
-    else ret = dc->funcs->pGetPixelFormat(dc->physDev);
-
-    release_dc_ptr( dc );
+    if (dc)
+    {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetPixelFormat );
+        update_dc( dc );
+        ret = physdev->funcs->pGetPixelFormat( physdev );
+        release_dc_ptr( dc );
+    }
     return ret;
 }
 
@@ -638,19 +638,13 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
 
     TRACE("(%p,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd);
 
-    if (!dc) return 0;
-
-    update_dc( dc );
-    if (!dc->funcs->pDescribePixelFormat)
+    if (dc)
     {
-        FIXME(" :stub\n");
-        ppfd->nSize = nBytes;
-        ppfd->nVersion = 1;
-	ret = 3;
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDescribePixelFormat );
+        update_dc( dc );
+        ret = physdev->funcs->pDescribePixelFormat( physdev, iPixelFormat, nBytes, ppfd );
+        release_dc_ptr( dc );
     }
-    else ret = dc->funcs->pDescribePixelFormat(dc->physDev,iPixelFormat,nBytes,ppfd);
-
-    release_dc_ptr( dc );
     return ret;
 }
 
@@ -673,17 +667,13 @@ BOOL WINAPI SwapBuffers( HDC hdc )
 
     TRACE("(%p)\n",hdc);
 
-    if (!dc) return TRUE;
-
-    update_dc( dc );
-    if (!dc->funcs->pSwapBuffers)
+    if (dc)
     {
-        FIXME(" :stub\n");
-	bRet = TRUE;
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSwapBuffers );
+        update_dc( dc );
+        bRet = physdev->funcs->pSwapBuffers( physdev );
+        release_dc_ptr( dc );
     }
-    else bRet = dc->funcs->pSwapBuffers(dc->physDev);
-
-    release_dc_ptr( dc );
     return bRet;
 }
 




More information about the wine-cvs mailing list