mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 09:23:39 +00:00
Implemented SetDCPenColor and SetDCBrushColor.
This commit is contained in:
parent
d48f3b60fe
commit
16ff6689df
|
@ -157,7 +157,9 @@ static struct graphics_driver *create_driver( HMODULE module )
|
|||
GET_FUNC(SetBitmapBits);
|
||||
GET_FUNC(SetBkColor);
|
||||
GET_FUNC(SetBkMode);
|
||||
GET_FUNC(SetDCBrushColor);
|
||||
GET_FUNC(SetDCOrg);
|
||||
GET_FUNC(SetDCPenColor);
|
||||
GET_FUNC(SetDIBColorTable);
|
||||
GET_FUNC(SetDIBits);
|
||||
GET_FUNC(SetDIBitsToDevice);
|
||||
|
|
|
@ -116,7 +116,9 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
|
|||
NULL, /* pSetBitmapBits */
|
||||
EMFDRV_SetBkColor, /* pSetBkColor */
|
||||
EMFDRV_SetBkMode, /* pSetBkMode */
|
||||
NULL, /* pSetDCBrushColor */
|
||||
NULL, /* pSetDCOrg */
|
||||
NULL, /* pSetDCPenColor */
|
||||
NULL, /* pSetDIBColorTable */
|
||||
NULL, /* pSetDIBits */
|
||||
EMFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
||||
|
|
|
@ -350,6 +350,7 @@
|
|||
@ stdcall SetColorAdjustment(long ptr)
|
||||
@ stdcall SetColorSpace(long long)
|
||||
@ stdcall SetDCBrushColor(long long)
|
||||
@ stdcall SetDCPenColor(long long)
|
||||
@ stdcall SetDIBColorTable(long long long ptr)
|
||||
@ stdcall SetDIBits(long long long long ptr ptr long)
|
||||
@ stdcall SetDIBitsToDevice(long long long long long long long long long ptr ptr long)
|
||||
|
|
|
@ -117,7 +117,9 @@ static const DC_FUNCTIONS MFDRV_Funcs =
|
|||
NULL, /* pSetBitmapBits */
|
||||
MFDRV_SetBkColor, /* pSetBkColor */
|
||||
MFDRV_SetBkMode, /* pSetBkMode */
|
||||
NULL, /* pSetDCBrushColor*/
|
||||
NULL, /* pSetDCOrg */
|
||||
NULL, /* pSetDCPenColor*/
|
||||
NULL, /* pSetDIBColorTable */
|
||||
NULL, /* pSetDIBits */
|
||||
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
@ cdecl SelectPen(ptr long) X11DRV_SelectPen
|
||||
@ cdecl SetBitmapBits(long ptr long) X11DRV_SetBitmapBits
|
||||
@ cdecl SetBkColor(ptr long) X11DRV_SetBkColor
|
||||
@ cdecl SetDCBrushColor(ptr long) X11DRV_SetDCBrushColor
|
||||
@ cdecl SetDCOrg(ptr long long) X11DRV_SetDCOrg
|
||||
@ cdecl SetDCPenColor(ptr long) X11DRV_SetDCPenColor
|
||||
@ cdecl SetDIBColorTable(ptr long long ptr) X11DRV_SetDIBColorTable
|
||||
@ cdecl SetDIBits(ptr long long long ptr ptr long) X11DRV_SetDIBits
|
||||
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice
|
||||
|
|
|
@ -218,8 +218,6 @@ static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SelectBrush (X11DRV.@)
|
||||
*/
|
||||
|
@ -239,6 +237,8 @@ HBRUSH X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush )
|
|||
physDev->brush.pixmap = 0;
|
||||
}
|
||||
physDev->brush.style = logbrush.lbStyle;
|
||||
if (hbrush == GetStockObject( DC_BRUSH ))
|
||||
logbrush.lbColor = physDev->dc->dcBrushColor;
|
||||
|
||||
switch(logbrush.lbStyle)
|
||||
{
|
||||
|
@ -282,3 +282,15 @@ HBRUSH X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush )
|
|||
}
|
||||
return hbrush;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCBrushColor (X11DRV.@)
|
||||
*/
|
||||
COLORREF X11DRV_SetDCBrushColor( X11DRV_PDEVICE *physDev, COLORREF crColor )
|
||||
{
|
||||
if (GetCurrentObject(physDev->hdc, OBJ_BRUSH) == GetStockObject( DC_BRUSH ))
|
||||
BRUSH_SelectSolidBrush( physDev, crColor );
|
||||
|
||||
return crColor;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
|
|||
dc->xformWorld2Vport.eM11);
|
||||
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
|
||||
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
|
||||
if (hpen == GetStockObject( DC_PEN ))
|
||||
logpen.lopnColor = dc->dcPenColor;
|
||||
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
|
||||
switch(logpen.lopnStyle & PS_STYLE_MASK)
|
||||
{
|
||||
|
@ -79,3 +81,15 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
|
|||
}
|
||||
return hpen;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCPenColor (X11DRV.@)
|
||||
*/
|
||||
COLORREF X11DRV_SetDCPenColor( X11DRV_PDEVICE *physDev, COLORREF crColor )
|
||||
{
|
||||
if (GetCurrentObject(physDev->hdc, OBJ_PEN) == GetStockObject( DC_PEN ))
|
||||
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, crColor );
|
||||
|
||||
return crColor;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ typedef struct tagDC
|
|||
WORD backgroundMode;
|
||||
COLORREF backgroundColor;
|
||||
COLORREF textColor;
|
||||
COLORREF dcBrushColor;
|
||||
COLORREF dcPenColor;
|
||||
short brushOrgX;
|
||||
short brushOrgY;
|
||||
|
||||
|
@ -256,7 +258,9 @@ typedef struct tagDC_FUNCS
|
|||
LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
|
||||
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
|
||||
INT (*pSetBkMode)(PHYSDEV,INT);
|
||||
COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
|
||||
DWORD (*pSetDCOrg)(PHYSDEV,INT,INT);
|
||||
COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
|
||||
UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
|
||||
INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
|
||||
INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
|
||||
|
|
|
@ -1830,8 +1830,10 @@ typedef struct
|
|||
#define DEFAULT_PALETTE 15
|
||||
#define SYSTEM_FIXED_FONT 16
|
||||
#define DEFAULT_GUI_FONT 17
|
||||
#define DC_BRUSH 18
|
||||
#define DC_PEN 19
|
||||
|
||||
#define STOCK_LAST 17
|
||||
#define STOCK_LAST 19
|
||||
|
||||
#define CLR_INVALID 0xffffffff
|
||||
/* Metafile header structure */
|
||||
|
|
85
objects/dc.c
85
objects/dc.c
|
@ -92,6 +92,8 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs, WORD magic )
|
|||
dc->relAbsMode = ABSOLUTE;
|
||||
dc->backgroundMode = OPAQUE;
|
||||
dc->backgroundColor = RGB( 255, 255, 255 );
|
||||
dc->dcBrushColor = RGB( 255, 255, 255 );
|
||||
dc->dcPenColor = RGB( 0, 0, 0 );
|
||||
dc->textColor = RGB( 0, 0, 0 );
|
||||
dc->brushOrgX = 0;
|
||||
dc->brushOrgY = 0;
|
||||
|
@ -301,6 +303,8 @@ HDC WINAPI GetDCState( HDC hdc )
|
|||
newdc->backgroundMode = dc->backgroundMode;
|
||||
newdc->backgroundColor = dc->backgroundColor;
|
||||
newdc->textColor = dc->textColor;
|
||||
newdc->dcBrushColor = dc->dcBrushColor;
|
||||
newdc->dcPenColor = dc->dcPenColor;
|
||||
newdc->brushOrgX = dc->brushOrgX;
|
||||
newdc->brushOrgY = dc->brushOrgY;
|
||||
newdc->textAlign = dc->textAlign;
|
||||
|
@ -389,6 +393,8 @@ void WINAPI SetDCState( HDC hdc, HDC hdcs )
|
|||
dc->backgroundMode = dcs->backgroundMode;
|
||||
dc->backgroundColor = dcs->backgroundColor;
|
||||
dc->textColor = dcs->textColor;
|
||||
dc->dcBrushColor = dcs->dcBrushColor;
|
||||
dc->dcPenColor = dcs->dcPenColor;
|
||||
dc->brushOrgX = dcs->brushOrgX;
|
||||
dc->brushOrgY = dcs->brushOrgY;
|
||||
dc->textAlign = dcs->textAlign;
|
||||
|
@ -855,6 +861,8 @@ COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
|
|||
COLORREF oldColor;
|
||||
DC * dc = DC_GetDCPtr( hdc );
|
||||
|
||||
TRACE("hdc=%p color=0x%08lx\n", hdc, color);
|
||||
|
||||
if (!dc) return CLR_INVALID;
|
||||
oldColor = dc->backgroundColor;
|
||||
if (dc->funcs->pSetBkColor)
|
||||
|
@ -880,6 +888,8 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
|
|||
COLORREF oldColor;
|
||||
DC * dc = DC_GetDCPtr( hdc );
|
||||
|
||||
TRACE(" hdc=%p color=0x%08lx\n", hdc, color);
|
||||
|
||||
if (!dc) return CLR_INVALID;
|
||||
oldColor = dc->textColor;
|
||||
if (dc->funcs->pSetTextColor)
|
||||
|
@ -904,6 +914,9 @@ UINT WINAPI SetTextAlign( HDC hdc, UINT align )
|
|||
{
|
||||
UINT prevAlign;
|
||||
DC *dc = DC_GetDCPtr( hdc );
|
||||
|
||||
TRACE("hdc=%p align=%d\n", hdc, align);
|
||||
|
||||
if (!dc) return 0x0;
|
||||
if (dc->funcs->pSetTextAlign)
|
||||
prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
|
||||
|
@ -1455,9 +1468,75 @@ DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
|
|||
*/
|
||||
COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
|
||||
{
|
||||
FIXME("(%p, %08lx): stub\n", hdc, crColor);
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return CLR_INVALID;
|
||||
DC *dc;
|
||||
COLORREF oldClr = CLR_INVALID;
|
||||
|
||||
TRACE("hdc(%p) crColor(%08lx)\n", hdc, crColor);
|
||||
|
||||
dc = DC_GetDCPtr( hdc );
|
||||
if (dc)
|
||||
{
|
||||
if (dc->funcs->pSetDCBrushColor)
|
||||
crColor = dc->funcs->pSetDCBrushColor( dc->physDev, crColor );
|
||||
else if (dc->hBrush == GetStockObject( DC_BRUSH ))
|
||||
{
|
||||
/* If DC_BRUSH is selected, update driver pen color */
|
||||
HBRUSH hBrush = CreateSolidBrush( crColor );
|
||||
dc->funcs->pSelectBrush( dc->physDev, hBrush );
|
||||
DeleteObject( hBrush );
|
||||
}
|
||||
|
||||
if (crColor != CLR_INVALID)
|
||||
{
|
||||
oldClr = dc->dcBrushColor;
|
||||
dc->dcBrushColor = crColor;
|
||||
}
|
||||
|
||||
GDI_ReleaseObj( hdc );
|
||||
}
|
||||
|
||||
return oldClr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* SetDCPenColor (GDI32.@)
|
||||
*
|
||||
* Sets the current device context (DC) pen color to the specified
|
||||
* color value. If the device cannot represent the specified color
|
||||
* value, the color is set to the nearest physical color.
|
||||
*
|
||||
*/
|
||||
COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
|
||||
{
|
||||
DC *dc;
|
||||
COLORREF oldClr = CLR_INVALID;
|
||||
|
||||
TRACE("hdc(%p) crColor(%08lx)\n", hdc, crColor);
|
||||
|
||||
dc = DC_GetDCPtr( hdc );
|
||||
if (dc)
|
||||
{
|
||||
if (dc->funcs->pSetDCPenColor)
|
||||
crColor = dc->funcs->pSetDCPenColor( dc->physDev, crColor );
|
||||
else if (dc->hPen == GetStockObject( DC_PEN ))
|
||||
{
|
||||
/* If DC_PEN is selected, update the driver pen color */
|
||||
LOGPEN logpen = { PS_SOLID, { 0, 0 }, crColor };
|
||||
HPEN hPen = CreatePenIndirect( &logpen );
|
||||
dc->funcs->pSelectPen( dc->physDev, hPen );
|
||||
DeleteObject( hPen );
|
||||
}
|
||||
|
||||
if (crColor != CLR_INVALID)
|
||||
{
|
||||
oldClr = dc->dcPenColor;
|
||||
dc->dcPenColor = crColor;
|
||||
}
|
||||
|
||||
GDI_ReleaseObj( hdc );
|
||||
}
|
||||
|
||||
return oldClr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -61,6 +61,8 @@ static const LOGPEN WhitePen = { PS_SOLID, { 0, 0 }, RGB(255,255,255) };
|
|||
static const LOGPEN BlackPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
|
||||
static const LOGPEN NullPen = { PS_NULL, { 0, 0 }, 0 };
|
||||
|
||||
static const LOGBRUSH DCBrush = { BS_SOLID, RGB(255,255,255), 0 };
|
||||
static const LOGPEN DCPen = { PS_SOLID, { 0, 0 }, RGB(0,0,0) };
|
||||
|
||||
/* reserve one extra entry for the stock default bitmap */
|
||||
/* this is what Windows does too */
|
||||
|
@ -619,6 +621,8 @@ BOOL GDI_Init(void)
|
|||
stock_objects[SYSTEM_FIXED_FONT] = create_stock_font( "SystemFixed", &deffonts->SystemFixedFont, hkey );
|
||||
stock_objects[DEFAULT_GUI_FONT] = create_stock_font( "DefaultGui", &deffonts->DefaultGuiFont, hkey );
|
||||
|
||||
stock_objects[DC_BRUSH] = CreateBrushIndirect( &DCBrush );
|
||||
stock_objects[DC_PEN] = CreatePenIndirect( &DCPen );
|
||||
|
||||
/* clear the NOSYSTEM bit on all stock objects*/
|
||||
for (i = 0; i < NB_STOCK_OBJECTS; i++)
|
||||
|
|
Loading…
Reference in a new issue