mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 11:43:31 +00:00
winex11: Don't cache text and background pixel values to support PALETTEINDEX properly.
This commit is contained in:
parent
aba9ddc4a0
commit
98dd61e2f3
5 changed files with 25 additions and 43 deletions
|
@ -850,9 +850,12 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|||
}
|
||||
if (physDevSrc->depth == 1)
|
||||
{
|
||||
int text_pixel = X11DRV_PALETTE_ToPhysical( physDevDst, GetTextColor(physDevDst->dev.hdc) );
|
||||
int bkgnd_pixel = X11DRV_PALETTE_ToPhysical( physDevDst, GetBkColor(physDevDst->dev.hdc) );
|
||||
|
||||
wine_tsx11_lock();
|
||||
XSetBackground( gdi_display, physDevDst->gc, physDevDst->textPixel );
|
||||
XSetForeground( gdi_display, physDevDst->gc, physDevDst->backgroundPixel );
|
||||
XSetBackground( gdi_display, physDevDst->gc, text_pixel );
|
||||
XSetForeground( gdi_display, physDevDst->gc, bkgnd_pixel );
|
||||
XSetFunction( gdi_display, physDevDst->gc, OP_ROP(*opcode) );
|
||||
XCopyPlane( gdi_display, physDevSrc->drawable,
|
||||
physDevDst->drawable, physDevDst->gc,
|
||||
|
@ -881,15 +884,18 @@ BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
|||
to color or vice versa, the foreground and background color of
|
||||
the device context are used. In fact, it also applies to the
|
||||
case when it is converted from mono to mono. */
|
||||
int text_pixel = X11DRV_PALETTE_ToPhysical( physDevDst, GetTextColor(physDevDst->dev.hdc) );
|
||||
int bkgnd_pixel = X11DRV_PALETTE_ToPhysical( physDevDst, GetBkColor(physDevDst->dev.hdc) );
|
||||
|
||||
if (X11DRV_PALETTE_XPixelToPalette && physDevDst->depth != 1)
|
||||
{
|
||||
XSetBackground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[physDevDst->textPixel] );
|
||||
XSetForeground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[physDevDst->backgroundPixel]);
|
||||
XSetBackground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[text_pixel] );
|
||||
XSetForeground( gdi_display, gc, X11DRV_PALETTE_XPixelToPalette[bkgnd_pixel]);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSetBackground( gdi_display, gc, physDevDst->textPixel );
|
||||
XSetForeground( gdi_display, gc, physDevDst->backgroundPixel );
|
||||
XSetBackground( gdi_display, gc, text_pixel );
|
||||
XSetForeground( gdi_display, gc, bkgnd_pixel );
|
||||
}
|
||||
XCopyPlane( gdi_display, physDevSrc->drawable, src_pixmap, gc,
|
||||
physDevSrc->dc_rect.left + src->visrect.left,
|
||||
|
|
|
@ -274,13 +274,13 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors )
|
|||
* We need to swap foreground and background because
|
||||
* Windows does it the wrong way...
|
||||
*/
|
||||
val.foreground = physDev->backgroundPixel;
|
||||
val.background = physDev->textPixel;
|
||||
val.foreground = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
|
||||
val.background = X11DRV_PALETTE_ToPhysical( physDev, GetTextColor(physDev->dev.hdc) );
|
||||
}
|
||||
else
|
||||
{
|
||||
val.foreground = physDev->brush.pixel;
|
||||
val.background = physDev->backgroundPixel;
|
||||
val.background = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
|
||||
}
|
||||
if (fMapColors && X11DRV_PALETTE_XPixelToPalette)
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ static BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
|
|||
val.foreground = physDev->pen.pixel;
|
||||
val.function = X11DRV_XROPfunction[rop2-1];
|
||||
}
|
||||
val.background = physDev->backgroundPixel;
|
||||
val.background = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
|
||||
val.fill_style = FillSolid;
|
||||
val.line_width = physDev->pen.width;
|
||||
if (val.line_width <= 1) {
|
||||
|
@ -463,8 +463,8 @@ BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev )
|
|||
XGCValues val;
|
||||
|
||||
val.function = GXcopy; /* Text is always GXcopy */
|
||||
val.foreground = physDev->textPixel;
|
||||
val.background = physDev->backgroundPixel;
|
||||
val.foreground = X11DRV_PALETTE_ToPhysical( physDev, GetTextColor(physDev->dev.hdc) );
|
||||
val.background = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
|
||||
val.fill_style = FillSolid;
|
||||
val.font = xfs->fid;
|
||||
|
||||
|
@ -1493,29 +1493,6 @@ fallback:
|
|||
return dev->funcs->pGradientFill( dev, vert_array, nvert, grad_array, ngrad, mode );
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* X11DRV_SetBkColor
|
||||
*/
|
||||
COLORREF X11DRV_SetBkColor( PHYSDEV dev, COLORREF color )
|
||||
{
|
||||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||
|
||||
physDev->backgroundPixel = X11DRV_PALETTE_ToPhysical( physDev, color );
|
||||
return color;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* X11DRV_SetTextColor
|
||||
*/
|
||||
COLORREF X11DRV_SetTextColor( PHYSDEV dev, COLORREF color )
|
||||
{
|
||||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||
|
||||
physDev->textPixel = X11DRV_PALETTE_ToPhysical( physDev, color );
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char *get_icm_profile( unsigned long *size )
|
||||
{
|
||||
Atom type;
|
||||
|
|
|
@ -550,7 +550,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
|
|||
NULL, /* pSelectPalette */
|
||||
X11DRV_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
X11DRV_SetBkColor, /* pSetBkColor */
|
||||
NULL, /* pSetBkColor */
|
||||
NULL, /* pSetBkMode */
|
||||
X11DRV_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
X11DRV_SetDCPenColor, /* pSetDCPenColor */
|
||||
|
@ -568,7 +568,7 @@ static const struct gdi_dc_funcs x11drv_funcs =
|
|||
NULL, /* pSetStretchBltMode */
|
||||
NULL, /* pSetTextAlign */
|
||||
NULL, /* pSetTextCharacterExtra */
|
||||
X11DRV_SetTextColor, /* pSetTextColor */
|
||||
NULL, /* pSetTextColor */
|
||||
NULL, /* pSetTextJustification */
|
||||
NULL, /* pSetViewportExt */
|
||||
NULL, /* pSetViewportOrg */
|
||||
|
|
|
@ -43,6 +43,7 @@ BOOL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
X11DRV_PDEVICE *physDev = get_x11drv_dev( dev );
|
||||
BOOL restore_region = FALSE;
|
||||
unsigned int i;
|
||||
int pixel;
|
||||
fontObject* pfo = XFONT_GetFontObject( physDev->font );
|
||||
XFontStruct* font;
|
||||
BOOL rotated = FALSE;
|
||||
|
@ -70,8 +71,9 @@ BOOL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
|
||||
if (flags & ETO_OPAQUE)
|
||||
{
|
||||
pixel = X11DRV_PALETTE_ToPhysical( physDev, GetBkColor(physDev->dev.hdc) );
|
||||
wine_tsx11_lock();
|
||||
XSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
|
||||
XSetForeground( gdi_display, physDev->gc, pixel );
|
||||
XFillRectangle( gdi_display, physDev->drawable, physDev->gc,
|
||||
physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top,
|
||||
lprect->right - lprect->left, lprect->bottom - lprect->top );
|
||||
|
@ -97,8 +99,9 @@ BOOL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
goto END;
|
||||
}
|
||||
|
||||
pixel = X11DRV_PALETTE_ToPhysical( physDev, GetTextColor(physDev->dev.hdc) );
|
||||
wine_tsx11_lock();
|
||||
XSetForeground( gdi_display, physDev->gc, physDev->textPixel );
|
||||
XSetForeground( gdi_display, physDev->gc, pixel );
|
||||
wine_tsx11_unlock();
|
||||
if(!rotated)
|
||||
{
|
||||
|
|
|
@ -141,8 +141,6 @@ typedef struct
|
|||
X_PHYSBRUSH brush;
|
||||
X_PHYSBITMAP *bitmap; /* currently selected bitmap for memory DCs */
|
||||
BOOL has_gdi_font; /* is current font a GDI font? */
|
||||
int backgroundPixel;
|
||||
int textPixel;
|
||||
int depth; /* bit depth of the DC */
|
||||
ColorShifts *color_shifts; /* color shifts of the DC */
|
||||
int exposures; /* count of graphics exposures operations */
|
||||
|
@ -210,14 +208,12 @@ extern HBITMAP X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDD
|
|||
extern HBRUSH X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
|
||||
extern HFONT X11DRV_SelectFont( PHYSDEV dev, HFONT hfont ) DECLSPEC_HIDDEN;
|
||||
extern HPEN X11DRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *pattern ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN;
|
||||
extern void X11DRV_SetDeviceClipping( PHYSDEV dev, HRGN rgn ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_SetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) DECLSPEC_HIDDEN;
|
||||
extern COLORREF X11DRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
|
||||
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN;
|
||||
extern BOOL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN;
|
||||
|
|
Loading…
Reference in a new issue