Commit 3009e03d authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add a SetBoundsRect driver entry point.

parent 30acd235
......@@ -222,22 +222,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
*/
static BOOL DC_DeleteObject( HGDIOBJ handle )
......@@ -262,6 +246,8 @@ void DC_InitDC( DC* dc )
SelectObject( dc->hSelf, dc->hFont );
update_dc_clipping( dc );
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 ret = 0;
PHYSDEV physdev;
RECT device_rect;
UINT ret;
DC *dc = get_dc_ptr( hdc );
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 );
return 0;
}
if (dc->bounds_enabled && ret == DCB_SET) add_bounds_rect( &dc->bounds, &device_rect );
if (rect)
{
......@@ -1356,6 +1347,8 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
}
DPtoLP( hdc, (POINT *)rect, 2 );
}
else ret = 0;
if (flags & DCB_RESET) reset_bounds( &dc->bounds );
release_dc_ptr( dc );
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)
{
PHYSDEV physdev;
UINT ret;
DC *dc;
if ((flags & DCB_ENABLE) && (flags & DCB_DISABLE)) 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 );
return 0;
}
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 );
......
......@@ -408,6 +408,18 @@ static UINT dibdrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
}
/***********************************************************************
* 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
*/
static INT dibdrv_ChoosePixelFormat( PHYSDEV dev, const PIXELFORMATDESCRIPTOR *pfd )
......@@ -690,6 +702,7 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
dibdrv_SetBoundsRect, /* pSetBoundsRect */
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
dibdrv_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */
......
......@@ -562,6 +562,11 @@ static INT nulldrv_SetBkMode( PHYSDEV dev, INT mode )
return mode;
}
static UINT nulldrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
{
return DCB_RESET;
}
static COLORREF nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
{
return color;
......@@ -825,6 +830,7 @@ const struct gdi_dc_funcs null_driver =
nulldrv_SetArcDirection, /* pSetArcDirection */
nulldrv_SetBkColor, /* pSetBkColor */
nulldrv_SetBkMode, /* pSetBkMode */
nulldrv_SetBoundsRect, /* pSetBoundsRect */
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
nulldrv_SetDCPenColor, /* pSetDCPenColor */
nulldrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */
......
......@@ -137,6 +137,7 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
EMFDRV_SetArcDirection, /* pSetArcDirection */
EMFDRV_SetBkColor, /* pSetBkColor */
EMFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetBoundsRect */
EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
EMFDRV_SetDCPenColor, /* pSetDCPenColor*/
EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
......
......@@ -69,6 +69,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
*
*A very simple implementation that returns DT_METAFILE
......@@ -191,6 +200,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pSetArcDirection */
MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBkMode, /* pSetBkMode */
MFDRV_SetBoundsRect, /* pSetBoundsRect */
MFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
MFDRV_SetDCPenColor, /* pSetDCPenColor*/
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
......
......@@ -368,6 +368,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
Rectangle( hdc, 2, 2, 5, 5 );
type = GetBoundsRect( hdc, &rect, DCB_RESET );
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
{
......@@ -387,7 +389,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
else
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 );
Rectangle( hdc, 2, 2, 4, 4 );
type = GetBoundsRect( hdc, &rect, DCB_RESET );
......
......@@ -919,6 +919,7 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pSetArcDirection */
PSDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetBoundsRect */
PSDRV_SetDCBrushColor, /* pSetDCBrushColor */
PSDRV_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */
......
......@@ -214,6 +214,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.@)
*/
static INT X11DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
......@@ -565,6 +578,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
X11DRV_SetBoundsRect, /* pSetBoundsRect */
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
X11DRV_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */
......
......@@ -2747,6 +2747,7 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pSetArcDirection */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetBoundsRect */
NULL, /* pSetDCBrushColor */
NULL, /* pSetDCPenColor */
NULL, /* pSetDIBitsToDevice */
......
......@@ -163,6 +163,7 @@ struct gdi_dc_funcs
INT (*pSetArcDirection)(PHYSDEV,INT);
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
INT (*pSetBkMode)(PHYSDEV,INT);
UINT (*pSetBoundsRect)(PHYSDEV,RECT*,UINT);
COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
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 */
#define WINE_GDI_DRIVER_VERSION 25
#define WINE_GDI_DRIVER_VERSION 26
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment