Alexandre Julliard : gdi32: Add a GetBoundsRect driver entry point.

Alexandre Julliard julliard at winehq.org
Mon Apr 16 13:35:46 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 10 16:17:14 2012 +0200

gdi32: Add a GetBoundsRect driver entry point.

---

 dlls/gdi32/dc.c            |   28 ++++++++++++++++++++++++++++
 dlls/gdi32/dibdrv/dc.c     |    1 +
 dlls/gdi32/driver.c        |    6 ++++++
 dlls/gdi32/enhmfdrv/init.c |    1 +
 dlls/gdi32/freetype.c      |    1 +
 dlls/gdi32/mfdrv/init.c    |   10 ++++++++++
 dlls/gdi32/path.c          |    1 +
 dlls/gdi32/tests/dc.c      |    1 -
 dlls/wineps.drv/init.c     |    1 +
 dlls/winex11.drv/init.c    |    1 +
 dlls/winex11.drv/xrender.c |    1 +
 include/wine/gdi_driver.h  |    3 ++-
 12 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index c256f26..a35e4fa 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -222,6 +222,22 @@ void update_dc( DC *dc )
 
 
 /***********************************************************************
+ *           fetch_device_bounds
+ *
+ * Fetch and clear the device-specific bounds, and add them to the DC if necessary.
+ */
+static BOOL fetch_device_bounds( DC *dc )
+{
+    RECT rect;
+    PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetBoundsRect );
+    UINT ret = physdev->funcs->pGetBoundsRect( physdev, &rect, DCB_RESET );
+
+    if (dc->bounds_enabled && ret == DCB_SET) add_bounds_rect( &dc->bounds, &rect );
+    return ret;
+}
+
+
+/***********************************************************************
  *           DC_DeleteObject
  */
 static BOOL DC_DeleteObject( HGDIOBJ handle )
@@ -1316,6 +1332,12 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
 
     if ( !dc ) return 0;
 
+    if (!fetch_device_bounds( dc ))
+    {
+        release_dc_ptr( dc );
+        return 0;
+    }
+
     if (rect)
     {
         if (is_rect_empty( &dc->bounds ))
@@ -1351,6 +1373,12 @@ UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
     if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0;
     if (!(dc = get_dc_ptr( hdc ))) return 0;
 
+    if (!fetch_device_bounds( dc ))
+    {
+        release_dc_ptr( dc );
+        return 0;
+    }
+
     ret = (dc->bounds_enabled ? DCB_ENABLE : DCB_DISABLE) |
            (is_rect_empty( &dc->bounds ) ? DCB_RESET : DCB_SET);
 
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 9f1a633..af4f6e7 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -599,6 +599,7 @@ const struct gdi_dc_funcs dib_driver =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     NULL,                               /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
     NULL,                               /* pGetCharWidth */
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 36bf48f..43dcc20 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -311,6 +311,11 @@ static BOOL nulldrv_GdiRealizationInfo( PHYSDEV dev, void *info )
     return FALSE;
 }
 
+static UINT nulldrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
+{
+    return DCB_RESET;
+}
+
 static BOOL nulldrv_GetCharABCWidths( PHYSDEV dev, UINT first, UINT last, LPABC abc )
 {
     return FALSE;
@@ -758,6 +763,7 @@ const struct gdi_dc_funcs null_driver =
     nulldrv_FrameRgn,                   /* pFrameRgn */
     nulldrv_GdiComment,                 /* pGdiComment */
     nulldrv_GdiRealizationInfo,         /* pGdiRealizationInfo */
+    nulldrv_GetBoundsRect,              /* pGetBoundsRect */
     nulldrv_GetCharABCWidths,           /* pGetCharABCWidths */
     nulldrv_GetCharABCWidthsI,          /* pGetCharABCWidthsI */
     nulldrv_GetCharWidth,               /* pGetCharWidth */
diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c
index 883ca5a..3356911 100644
--- a/dlls/gdi32/enhmfdrv/init.c
+++ b/dlls/gdi32/enhmfdrv/init.c
@@ -75,6 +75,7 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
     EMFDRV_FrameRgn,                 /* pFrameRgn */
     EMFDRV_GdiComment,               /* pGdiComment */
     NULL,                            /* pGdiRealizationInfo */
+    NULL,                            /* pGetBoundsRect */
     NULL,                            /* pGetCharABCWidths */
     NULL,                            /* pGetCharABCWidthsI */
     NULL,                            /* pGetCharWidth */
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 0a5d3c3..3875e4f 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -7772,6 +7772,7 @@ static const struct gdi_dc_funcs freetype_funcs =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     freetype_GdiRealizationInfo,        /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     freetype_GetCharABCWidths,          /* pGetCharABCWidths */
     freetype_GetCharABCWidthsI,         /* pGetCharABCWidthsI */
     freetype_GetCharWidth,              /* pGetCharWidth */
diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c
index e02c6be..6ccbfe4 100644
--- a/dlls/gdi32/mfdrv/init.c
+++ b/dlls/gdi32/mfdrv/init.c
@@ -60,6 +60,15 @@ static INT MFDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_da
 
 
 /******************************************************************
+ *         MFDRV_GetBoundsRect
+ */
+static UINT MFDRV_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
+{
+    return 0;
+}
+
+
+/******************************************************************
  *         MFDRV_GetDeviceCaps
  *
  *A very simple implementation that returns DT_METAFILE
@@ -120,6 +129,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
     MFDRV_FrameRgn,                  /* pFrameRgn */
     NULL,                            /* pGdiComment */
     NULL,                            /* pGdiRealizationInfo */
+    MFDRV_GetBoundsRect,             /* pGetBoundsRect */
     NULL,                            /* pGetCharABCWidths */
     NULL,                            /* pGetCharABCWidthsI */
     NULL,                            /* pGetCharWidth */
diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c
index 058a48a..ec6348c 100644
--- a/dlls/gdi32/path.c
+++ b/dlls/gdi32/path.c
@@ -2274,6 +2274,7 @@ const struct gdi_dc_funcs path_driver =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     NULL,                               /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
     NULL,                               /* pGetCharWidth */
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 4b8567d..bc03b25 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -367,7 +367,6 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
         SetMapMode( hdc, MM_TEXT );
         Rectangle( hdc, 2, 2, 5, 5 );
         type = GetBoundsRect( hdc, &rect, DCB_RESET );
-        todo_wine
         ok( !type, "GetBoundsRect succeeded on %s\n", descr );
     }
     else
diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c
index b2597d7..c51a7e3 100644
--- a/dlls/wineps.drv/init.c
+++ b/dlls/wineps.drv/init.c
@@ -857,6 +857,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     NULL,                               /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
     PSDRV_GetCharWidth,                 /* pGetCharWidth */
diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c
index de0d029..324e3f0 100644
--- a/dlls/winex11.drv/init.c
+++ b/dlls/winex11.drv/init.c
@@ -491,6 +491,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     NULL,                               /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
     X11DRV_GetCharWidth,                /* pGetCharWidth */
diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c
index 7c763fc..7cd87d9 100644
--- a/dlls/winex11.drv/xrender.c
+++ b/dlls/winex11.drv/xrender.c
@@ -2684,6 +2684,7 @@ static const struct gdi_dc_funcs xrender_funcs =
     NULL,                               /* pFrameRgn */
     NULL,                               /* pGdiComment */
     NULL,                               /* pGdiRealizationInfo */
+    NULL,                               /* pGetBoundsRect */
     NULL,                               /* pGetCharABCWidths */
     NULL,                               /* pGetCharABCWidthsI */
     NULL,                               /* pGetCharWidth */
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index eb64b36..01e2ebb 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -101,6 +101,7 @@ struct gdi_dc_funcs
     BOOL     (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
     BOOL     (*pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
     BOOL     (*pGdiRealizationInfo)(PHYSDEV,void*);
+    UINT     (*pGetBoundsRect)(PHYSDEV,RECT*,UINT);
     BOOL     (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
     BOOL     (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
     BOOL     (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
@@ -211,7 +212,7 @@ struct gdi_dc_funcs
 };
 
 /* increment this when you change the DC function table */
-#define WINE_GDI_DRIVER_VERSION 24
+#define WINE_GDI_DRIVER_VERSION 25
 
 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
 {




More information about the wine-cvs mailing list