gdi32: Use NtGdiGetAndSetDCDword for SetDCBrushColor.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
59b2aabd61
commit
02ee9bf246
|
@ -821,6 +821,7 @@ INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap )
|
|||
*/
|
||||
BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *prev_value )
|
||||
{
|
||||
PHYSDEV physdev;
|
||||
BOOL ret = TRUE;
|
||||
DC *dc;
|
||||
|
||||
|
@ -843,6 +844,13 @@ BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *pre
|
|||
set_text_color( dc, value );
|
||||
break;
|
||||
|
||||
case NtGdiSetDCBrushColor:
|
||||
physdev = GET_DC_PHYSDEV( dc, pSetDCBrushColor );
|
||||
*prev_value = dc->attr->brush_color;
|
||||
value = physdev->funcs->pSetDCBrushColor( physdev, value );
|
||||
if (value != CLR_INVALID) dc->attr->brush_color = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN( "unknown method %u\n", method );
|
||||
ret = FALSE;
|
||||
|
@ -1287,32 +1295,6 @@ DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout )
|
|||
return old_layout;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCBrushColor (GDI32.@)
|
||||
*/
|
||||
COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
|
||||
{
|
||||
DC *dc;
|
||||
COLORREF oldClr = CLR_INVALID;
|
||||
|
||||
TRACE("hdc(%p) crColor(%08x)\n", hdc, crColor);
|
||||
|
||||
dc = get_dc_ptr( hdc );
|
||||
if (dc)
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDCBrushColor );
|
||||
crColor = physdev->funcs->pSetDCBrushColor( physdev, crColor );
|
||||
if (crColor != CLR_INVALID)
|
||||
{
|
||||
oldClr = dc->attr->brush_color;
|
||||
dc->attr->brush_color = crColor;
|
||||
}
|
||||
release_dc_ptr( dc );
|
||||
}
|
||||
|
||||
return oldClr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCPenColor (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,6 @@ extern BOOL CDECL EMFDRV_ScaleWindowExtEx( PHYSDEV dev, INT xNum, INT xDenom
|
|||
INT yNum, INT yDenom, SIZE *size ) DECLSPEC_HIDDEN;
|
||||
extern HBITMAP CDECL EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle ) DECLSPEC_HIDDEN;
|
||||
extern HFONT CDECL EMFDRV_SelectFont( PHYSDEV dev, HFONT handle, UINT *aa_flags ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF CDECL EMFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF CDECL EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern INT CDECL EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc,
|
||||
INT ySrc, UINT startscan, UINT lines, LPCVOID bits,
|
||||
|
|
|
@ -114,7 +114,7 @@ static const struct gdi_dc_funcs emfdrv_driver =
|
|||
NULL, /* pSelectPen */
|
||||
NULL, /* pSetBkColor */
|
||||
NULL, /* pSetBoundsRect */
|
||||
EMFDRV_SetDCBrushColor, /* pSetDCBrushColor*/
|
||||
NULL, /* pSetDCBrushColor*/
|
||||
EMFDRV_SetDCPenColor, /* pSetDCPenColor*/
|
||||
EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
||||
NULL, /* pSetDeviceClipping */
|
||||
|
|
|
@ -466,25 +466,24 @@ BOOL EMFDC_SelectObject( DC_ATTR *dc_attr, HGDIOBJ obj )
|
|||
}
|
||||
|
||||
/******************************************************************
|
||||
* EMFDRV_SetDCBrushColor
|
||||
* EMFDC_SetDCBrushColor
|
||||
*/
|
||||
COLORREF CDECL EMFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color )
|
||||
BOOL EMFDC_SetDCBrushColor( DC_ATTR *dc_attr, COLORREF color )
|
||||
{
|
||||
EMFDRV_PDEVICE *physDev = get_emf_physdev( dev );
|
||||
DC *dc = get_physdev_dc( dev );
|
||||
EMFDRV_PDEVICE *emf = dc_attr->emf;
|
||||
EMRSELECTOBJECT emr;
|
||||
DWORD index;
|
||||
|
||||
if (dc->hBrush != GetStockObject( DC_BRUSH )) return color;
|
||||
if (GetCurrentObject( dc_attr->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return TRUE;
|
||||
|
||||
if (physDev->dc_brush) DeleteObject( physDev->dc_brush );
|
||||
if (!(physDev->dc_brush = CreateSolidBrush( color ))) return CLR_INVALID;
|
||||
if (!(index = EMFDRV_CreateBrushIndirect(dev, physDev->dc_brush ))) return CLR_INVALID;
|
||||
GDI_hdc_using_object( physDev->dc_brush, dev->hdc, EMFDC_DeleteObject );
|
||||
if (emf->dc_brush) DeleteObject( emf->dc_brush );
|
||||
if (!(emf->dc_brush = CreateSolidBrush( color ))) return FALSE;
|
||||
if (!(index = EMFDRV_CreateBrushIndirect( &emf->dev, emf->dc_brush ))) return FALSE;
|
||||
GDI_hdc_using_object( emf->dc_brush, dc_attr->hdc, EMFDC_DeleteObject );
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.ihObject = index;
|
||||
return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
|
||||
return EMFDRV_WriteRecord( &emf->dev, &emr.emr );
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -191,6 +191,7 @@ extern BOOL EMFDC_SelectPalette( DC_ATTR *dc_attr, HPALETTE palette ) DECLSPEC_H
|
|||
extern BOOL EMFDC_SetArcDirection( DC_ATTR *dc_attr, INT dir ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetBkColor( DC_ATTR *dc_attr, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetBkMode( DC_ATTR *dc_attr, INT mode ) DECLSPEC_HIDDEN;
|
||||
extern BOOL EMFDC_SetDCBrushColor( DC_ATTR *dc_attr, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern INT EMFDC_SetDIBitsToDevice( DC_ATTR *dc_attr, INT x_dest, INT y_dest, DWORD width,
|
||||
DWORD height, INT x_src, INT y_src, UINT startscan,
|
||||
UINT lines, const void *bits, const BITMAPINFO *info,
|
||||
|
|
|
@ -315,6 +315,19 @@ COLORREF WINAPI GetDCBrushColor( HDC hdc )
|
|||
return dc_attr ? dc_attr->brush_color : CLR_INVALID;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCBrushColor (GDI32.@)
|
||||
*/
|
||||
COLORREF WINAPI SetDCBrushColor( HDC hdc, COLORREF color )
|
||||
{
|
||||
DC_ATTR *dc_attr;
|
||||
COLORREF ret;
|
||||
|
||||
if (!(dc_attr = get_dc_attr( hdc ))) return CLR_INVALID;
|
||||
if (dc_attr->emf && !EMFDC_SetDCBrushColor( dc_attr, color )) return CLR_INVALID;
|
||||
return NtGdiGetAndSetDCDword( hdc, NtGdiSetDCBrushColor, color, &ret ) ? ret : CLR_INVALID;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetDCPenColor (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -106,6 +106,7 @@ enum
|
|||
/* not compatible with Windows */
|
||||
NtGdiSetBkColor = 100,
|
||||
NtGdiSetTextColor,
|
||||
NtGdiSetDCBrushColor,
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
Loading…
Reference in New Issue