gdi32: Add a SetBoundsRect driver entry point.

This commit is contained in:
Alexandre Julliard 2012-04-25 12:26:44 +02:00
parent 30acd235dd
commit 3009e03df7
10 changed files with 68 additions and 22 deletions

View File

@ -221,22 +221,6 @@ 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 * DC_DeleteObject
*/ */
@ -262,6 +246,8 @@ void DC_InitDC( DC* dc )
SelectObject( dc->hSelf, dc->hFont ); SelectObject( dc->hSelf, dc->hFont );
update_dc_clipping( dc ); update_dc_clipping( dc );
SetVirtualResolution( dc->hSelf, 0, 0, 0, 0 ); SetVirtualResolution( dc->hSelf, 0, 0, 0, 0 );
physdev = GET_DC_PHYSDEV( dc, pSetBoundsRect );
physdev->funcs->pSetBoundsRect( physdev, &dc->bounds, dc->bounds_enabled ? DCB_ENABLE : DCB_DISABLE );
} }
@ -1327,16 +1313,21 @@ HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hColorSpace )
*/ */
UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags) UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
{ {
UINT ret = 0; PHYSDEV physdev;
RECT device_rect;
UINT ret;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if ( !dc ) return 0; if ( !dc ) return 0;
if (!fetch_device_bounds( dc )) physdev = GET_DC_PHYSDEV( dc, pGetBoundsRect );
ret = physdev->funcs->pGetBoundsRect( physdev, &device_rect, DCB_RESET );
if (!ret)
{ {
release_dc_ptr( dc ); release_dc_ptr( dc );
return 0; return 0;
} }
if (dc->bounds_enabled && ret == DCB_SET) add_bounds_rect( &dc->bounds, &device_rect );
if (rect) if (rect)
{ {
@ -1356,6 +1347,8 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
} }
DPtoLP( hdc, (POINT *)rect, 2 ); DPtoLP( hdc, (POINT *)rect, 2 );
} }
else ret = 0;
if (flags & DCB_RESET) reset_bounds( &dc->bounds ); if (flags & DCB_RESET) reset_bounds( &dc->bounds );
release_dc_ptr( dc ); release_dc_ptr( dc );
return ret; return ret;
@ -1367,20 +1360,23 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
*/ */
UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags) UINT WINAPI SetBoundsRect(HDC hdc, const RECT* rect, UINT flags)
{ {
PHYSDEV physdev;
UINT ret; UINT ret;
DC *dc; DC *dc;
if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0; if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) return 0;
if (!(dc = get_dc_ptr( hdc ))) return 0; if (!(dc = get_dc_ptr( hdc ))) return 0;
if (!fetch_device_bounds( dc )) physdev = GET_DC_PHYSDEV( dc, pSetBoundsRect );
ret = physdev->funcs->pSetBoundsRect( physdev, &dc->bounds, flags );
if (!ret)
{ {
release_dc_ptr( dc ); release_dc_ptr( dc );
return 0; return 0;
} }
ret = (dc->bounds_enabled ? DCB_ENABLE : DCB_DISABLE) | ret = (dc->bounds_enabled ? DCB_ENABLE : DCB_DISABLE) |
(is_rect_empty( &dc->bounds ) ? DCB_RESET : DCB_SET); (is_rect_empty( &dc->bounds ) ? ret & DCB_SET : DCB_SET);
if (flags & DCB_RESET) reset_bounds( &dc->bounds ); if (flags & DCB_RESET) reset_bounds( &dc->bounds );

View File

@ -407,6 +407,18 @@ static UINT dibdrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
return DCB_SET; return DCB_SET;
} }
/***********************************************************************
* dibdrv_SetBoundsRect
*/
static UINT dibdrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
if (is_rect_empty( &pdev->bounds )) return DCB_RESET;
if (flags & DCB_RESET) reset_bounds( &pdev->bounds );
return DCB_SET;
}
/*********************************************************************** /***********************************************************************
* dibdrv_ChoosePixelFormat * dibdrv_ChoosePixelFormat
*/ */
@ -690,6 +702,7 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
dibdrv_SetBoundsRect, /* pSetBoundsRect */
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */ dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
dibdrv_SetDCPenColor, /* pSetDCPenColor */ dibdrv_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */

View File

@ -562,6 +562,11 @@ static INT nulldrv_SetBkMode( PHYSDEV dev, INT mode )
return mode; return mode;
} }
static UINT nulldrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
return DCB_RESET;
}
static COLORREF nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) static COLORREF nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
{ {
return color; return color;
@ -825,6 +830,7 @@ const struct gdi_dc_funcs null_driver =
nulldrv_SetArcDirection, /* pSetArcDirection */ nulldrv_SetArcDirection, /* pSetArcDirection */
nulldrv_SetBkColor, /* pSetBkColor */ nulldrv_SetBkColor, /* pSetBkColor */
nulldrv_SetBkMode, /* pSetBkMode */ nulldrv_SetBkMode, /* pSetBkMode */
nulldrv_SetBoundsRect, /* pSetBoundsRect */
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */ nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
nulldrv_SetDCPenColor, /* pSetDCPenColor */ nulldrv_SetDCPenColor, /* pSetDCPenColor */
nulldrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */ nulldrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */

View File

@ -137,6 +137,7 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
EMFDRV_SetArcDirection, /* pSetArcDirection */ EMFDRV_SetArcDirection, /* pSetArcDirection */
EMFDRV_SetBkColor, /* pSetBkColor */ EMFDRV_SetBkColor, /* pSetBkColor */
EMFDRV_SetBkMode, /* pSetBkMode */ EMFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetBoundsRect */
EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/ EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
EMFDRV_SetDCPenColor, /* pSetDCPenColor*/ EMFDRV_SetDCPenColor, /* pSetDCPenColor*/
EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */

View File

@ -68,6 +68,15 @@ static UINT MFDRV_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
} }
/******************************************************************
* MFDRV_SetBoundsRect
*/
static UINT MFDRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
return 0;
}
/****************************************************************** /******************************************************************
* MFDRV_GetDeviceCaps * MFDRV_GetDeviceCaps
* *
@ -191,6 +200,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
MFDRV_SetBkColor, /* pSetBkColor */ MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBkMode, /* pSetBkMode */ MFDRV_SetBkMode, /* pSetBkMode */
MFDRV_SetBoundsRect, /* pSetBoundsRect */
MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/ MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
MFDRV_SetDCPenColor, /* pSetDCPenColor*/ MFDRV_SetDCPenColor, /* pSetDCPenColor*/
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */

View File

@ -368,6 +368,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
Rectangle( hdc, 2, 2, 5, 5 ); Rectangle( hdc, 2, 2, 5, 5 );
type = GetBoundsRect( hdc, &rect, DCB_RESET ); type = GetBoundsRect( hdc, &rect, DCB_RESET );
ok( !type, "GetBoundsRect succeeded on %s\n", descr ); ok( !type, "GetBoundsRect succeeded on %s\n", descr );
type = SetBoundsRect( hdc, &rect, DCB_RESET | DCB_ENABLE );
ok( !type, "SetBoundsRect succeeded on %s\n", descr );
} }
else else
{ {
@ -387,7 +389,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
else else
ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr ); ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE ); type = SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
ok( type == (DCB_RESET | DCB_DISABLE), "SetBoundsRect returned %x\n", type );
SetMapMode( hdc, MM_TEXT ); SetMapMode( hdc, MM_TEXT );
Rectangle( hdc, 2, 2, 4, 4 ); Rectangle( hdc, 2, 2, 4, 4 );
type = GetBoundsRect( hdc, &rect, DCB_RESET ); type = GetBoundsRect( hdc, &rect, DCB_RESET );

View File

@ -919,6 +919,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
PSDRV_SetBkColor, /* pSetBkColor */ PSDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetBoundsRect */
PSDRV_SetDCBrushColor, /* pSetDCBrushColor */ PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
PSDRV_SetDCPenColor, /* pSetDCPenColor */ PSDRV_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */

View File

@ -213,6 +213,19 @@ static UINT X11DRV_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
} }
/***********************************************************************
* X11DRV_SetBoundsRect
*/
static UINT X11DRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
X11DRV_PDEVICE *pdev = get_x11drv_dev( dev );
if (IsRectEmpty( &pdev->bounds )) return DCB_RESET;
if (flags & DCB_RESET) reset_bounds( &pdev->bounds );
return DCB_SET;
}
/*********************************************************************** /***********************************************************************
* GetDeviceCaps (X11DRV.@) * GetDeviceCaps (X11DRV.@)
*/ */
@ -565,6 +578,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
X11DRV_SetBoundsRect, /* pSetBoundsRect */
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */ X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
X11DRV_SetDCPenColor, /* pSetDCPenColor */ X11DRV_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */

View File

@ -2747,6 +2747,7 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */ NULL, /* pSetDCBrushColor */
NULL, /* pSetDCPenColor */ NULL, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */

View File

@ -163,6 +163,7 @@ struct gdi_dc_funcs
INT (*pSetArcDirection)(PHYSDEV,INT); INT (*pSetArcDirection)(PHYSDEV,INT);
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF); COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
INT (*pSetBkMode)(PHYSDEV,INT); INT (*pSetBkMode)(PHYSDEV,INT);
UINT (*pSetBoundsRect)(PHYSDEV,RECT*,UINT);
COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF); COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF); COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT); INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
@ -212,7 +213,7 @@ struct gdi_dc_funcs
}; };
/* increment this when you change the DC function table */ /* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 25 #define WINE_GDI_DRIVER_VERSION 26
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset ) static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
{ {