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

Alexandre Julliard julliard at winehq.org
Thu Mar 17 12:26:58 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 16 21:14:24 2011 +0100

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

---

 dlls/gdi32/dib.c    |   38 ++++++++++++++------------------------
 dlls/gdi32/driver.c |   24 +++++++++++++++++++++---
 2 files changed, 35 insertions(+), 27 deletions(-)

diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index 2810c74..05e51df 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -382,26 +382,19 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
                            UINT lines, LPCVOID bits, const BITMAPINFO *info,
                            UINT coloruse )
 {
-    INT ret;
+    INT ret = 0;
     DC *dc;
 
     if (!bits) return 0;
 
-    if (!(dc = get_dc_ptr( hdc ))) return 0;
-
-    if(dc->funcs->pSetDIBitsToDevice)
+    if ((dc = get_dc_ptr( hdc )))
     {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDIBitsToDevice );
         update_dc( dc );
-        ret = dc->funcs->pSetDIBitsToDevice( dc->physDev, xDest, yDest, cx, cy, xSrc,
-					     ySrc, startscan, lines, bits,
-					     info, coloruse );
-    }
-    else {
-        FIXME("unimplemented on hdc %p\n", hdc);
-	ret = 0;
+        ret = physdev->funcs->pSetDIBitsToDevice( physdev, xDest, yDest, cx, cy, xSrc,
+                                                  ySrc, startscan, lines, bits, info, coloruse );
+        release_dc_ptr( dc );
     }
-
-    release_dc_ptr( dc );
     return ret;
 }
 
@@ -418,6 +411,8 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA
 
     if ((bitmap = GDI_GetObjPtr( dc->hBitmap, OBJ_BITMAP )))
     {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDIBColorTable );
+
         /* Check if currently selected bitmap is a DIB */
         if (bitmap->color_table)
         {
@@ -429,11 +424,8 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, CONST RGBQUA
             }
         }
         GDI_ReleaseObj( dc->hBitmap );
+        physdev->funcs->pSetDIBColorTable( physdev, startpos, entries, colors );
     }
-
-    if (dc->funcs->pSetDIBColorTable)
-        dc->funcs->pSetDIBColorTable(dc->physDev, startpos, entries, colors);
-
     release_dc_ptr( dc );
     return result;
 }
@@ -1361,19 +1353,17 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
 
     if (ret && ((bmp = GDI_GetObjPtr(ret, OBJ_BITMAP))))
     {
+        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pCreateDIBSection );
         bmp->dib = dib;
-        bmp->funcs = dc->funcs;
+        bmp->funcs = physdev->funcs;
         /* create local copy of DIB palette */
         if (bpp <= 8) DIB_CopyColorTable( dc, bmp, usage, bmi );
         GDI_ReleaseObj( ret );
 
-        if (dc->funcs->pCreateDIBSection)
+        if (!physdev->funcs->pCreateDIBSection( physdev, ret, bmi, usage ))
         {
-            if (!dc->funcs->pCreateDIBSection(dc->physDev, ret, bmi, usage))
-            {
-                DeleteObject( ret );
-                ret = 0;
-            }
+            DeleteObject( ret );
+            ret = 0;
         }
     }
 
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index afd853b..fa77a2e 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -339,6 +339,12 @@ static BOOL CDECL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap, LPVOID bits
     return TRUE;
 }
 
+static HBITMAP CDECL nulldrv_CreateDIBSection( PHYSDEV dev, HBITMAP bitmap,
+                                               const BITMAPINFO *info, UINT usage )
+{
+    return bitmap;
+}
+
 static BOOL CDECL nulldrv_DeleteBitmap( HBITMAP bitmap )
 {
     return TRUE;
@@ -576,6 +582,18 @@ static COLORREF CDECL nulldrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
     return color;
 }
 
+static UINT CDECL nulldrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RGBQUAD *colors )
+{
+    return 0;
+}
+
+static INT CDECL nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD width, DWORD height,
+                                            INT x_src, INT y_src, UINT start, UINT lines,
+                                            const void *bits, const BITMAPINFO *info, UINT coloruse )
+{
+    return 0;
+}
+
 static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn )
 {
 }
@@ -736,7 +754,7 @@ const DC_FUNCTIONS null_driver =
     nulldrv_CloseFigure,                /* pCloseFigure */
     nulldrv_CreateBitmap,               /* pCreateBitmap */
     NULL,                               /* pCreateDC */
-    NULL,                               /* pCreateDIBSection */
+    nulldrv_CreateDIBSection,           /* pCreateDIBSection */
     nulldrv_DeleteBitmap,               /* pDeleteBitmap */
     NULL,                               /* pDeleteDC */
     nulldrv_DeleteObject,               /* pDeleteObject */
@@ -811,9 +829,9 @@ const DC_FUNCTIONS null_driver =
     nulldrv_SetBkMode,                  /* pSetBkMode */
     nulldrv_SetDCBrushColor,            /* pSetDCBrushColor */
     nulldrv_SetDCPenColor,              /* pSetDCPenColor */
-    NULL,                               /* pSetDIBColorTable */
+    nulldrv_SetDIBColorTable,           /* pSetDIBColorTable */
     nulldrv_SetDIBits,                  /* pSetDIBits */
-    NULL,                               /* pSetDIBitsToDevice */
+    nulldrv_SetDIBitsToDevice,          /* pSetDIBitsToDevice */
     nulldrv_SetDeviceClipping,          /* pSetDeviceClipping */
     nulldrv_SetDeviceGammaRamp,         /* pSetDeviceGammaRamp */
     nulldrv_SetLayout,                  /* pSetLayout */




More information about the wine-cvs mailing list