gdi32: Add a GetBoundsRect driver entry point.

This commit is contained in:
Alexandre Julliard 2012-04-10 16:17:14 +02:00
parent b1ccff1a9c
commit 582a2f511f
12 changed files with 53 additions and 2 deletions

View File

@ -221,6 +221,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
*/
@ -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);

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -59,6 +59,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
*
@ -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 */

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -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 )
{