Remove X_DC_INFO from DC and make it behave like any other PDEVICE.

This commit is contained in:
Huw D M Davies 1998-11-25 12:36:03 +00:00 committed by Alexandre Julliard
parent 7129d9f696
commit 9c68faadab
32 changed files with 432 additions and 363 deletions

View file

@ -19,6 +19,7 @@
#include "ts_xlib.h"
#include <sys/signal.h>
#include <fcntl.h>
#include <string.h>
#include "windows.h"
#include "winerror.h"
@ -35,6 +36,7 @@
#include "compobj.h"
#include "spy.h"
#include "message.h"
#include "x11drv.h"
#ifdef HAVE_LIBXXF86DGA
#include "ts_xf86dga.h"

View file

@ -25,6 +25,7 @@
#include "path.h"
#include "debug.h"
#include "winerror.h"
#include "x11drv.h"
/***********************************************************************
* LineTo16 (GDI.19)
@ -623,9 +624,11 @@ void WINAPI DrawFocusRect32( HDC32 hdc, const RECT32* rc )
HPEN32 hOldPen, hnewPen;
INT32 oldDrawMode, oldBkMode;
INT32 left, top, right, bottom;
X11DRV_PDEVICE *physDev;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return;
physDev = (X11DRV_PDEVICE *)dc->physDev;
left = XLPTODP( dc, rc->left );
top = YLPTODP( dc, rc->top );
@ -641,10 +644,10 @@ void WINAPI DrawFocusRect32( HDC32 hdc, const RECT32* rc )
oldBkMode = SetBkMode32(hdc, TRANSPARENT);
/* Hack: make sure the XORPEN operation has an effect */
dc->u.x.pen.pixel = (1 << screenDepth) - 1;
physDev->pen.pixel = (1 << screenDepth) - 1;
if (X11DRV_SetupGCForPen( dc ))
TSXDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );

View file

@ -17,6 +17,7 @@
#include "dc.h"
#include "gdi.h"
#include "xmalloc.h"
#include "x11drv.h"
#include "debug.h"
typedef enum WING_DITHER_TYPE
@ -262,9 +263,12 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
/* destDC is a display DC, srcDC is a memory DC */
DC *dcDst, *dcSrc;
X11DRV_PDEVICE *physDevDst, *physDevSrc;
if (!(dcDst = (DC *)GDI_GetObjPtr( destDC, DC_MAGIC ))) return FALSE;
if (!(dcSrc = (DC *) GDI_GetObjPtr( srcDC, DC_MAGIC ))) return FALSE;
physDevDst = (X11DRV_PDEVICE *)dcDst->physDev;
physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev;
if (dcDst->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion( dcDst );
@ -275,10 +279,10 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest,
widDest = widDest * dcDst->vportExtX / dcDst->wndExtX;
heiDest = heiDest * dcDst->vportExtY / dcDst->wndExtY;
TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
TSXCopyArea( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
xSrc, ySrc, widDest, heiDest, xDest, yDest );
TSXSetFunction( display, physDevDst->gc, GXcopy );
TSXCopyArea( display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
xSrc, ySrc, widDest, heiDest, xDest, yDest );
return TRUE;
}

View file

@ -816,6 +816,8 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
RECT32 *visRectSrc, RECT32 *visRectDst )
{
XImage *imageSrc, *imageDst;
X11DRV_PDEVICE *physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev;
RECT32 rectSrc = *visRectSrc;
RECT32 rectDst = *visRectDst;
@ -828,7 +830,7 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
OffsetRect32( &rectDst, -xDst, -yDst );
/* FIXME: avoid BadMatch errors */
imageSrc = XGetImage( display, dcSrc->u.x.drawable,
imageSrc = XGetImage( display, physDevSrc->drawable,
visRectSrc->left, visRectSrc->top,
visRectSrc->right - visRectSrc->left,
visRectSrc->bottom - visRectSrc->top,
@ -837,9 +839,9 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
rectDst.bottom - rectDst.top, dcDst->w.bitsPerPixel );
BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc,
widthDst, heightDst, &rectSrc, &rectDst,
dcDst->u.x.textPixel, dcDst->w.bitsPerPixel != 1 ?
dcDst->u.x.backgroundPixel :
dcSrc->u.x.backgroundPixel,
physDevDst->textPixel, dcDst->w.bitsPerPixel != 1 ?
physDevDst->backgroundPixel :
physDevSrc->backgroundPixel,
dcDst->w.stretchBltMode );
XPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0,
rectDst.right - rectDst.left, rectDst.bottom - rectDst.top );
@ -861,25 +863,27 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
register INT32 x, y;
INT32 width = visRectSrc->right - visRectSrc->left;
INT32 height = visRectSrc->bottom - visRectSrc->top;
X11DRV_PDEVICE *physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev;
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
if (!COLOR_PixelToPalette ||
(dcDst->w.bitsPerPixel == 1)) /* monochrome -> monochrome */
{
XCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
XCopyArea( display, physDevSrc->drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top, width, height, 0, 0);
}
else /* color -> color */
{
if (dcSrc->w.flags & DC_MEMORY)
imageSrc = XGetImage( display, dcSrc->u.x.drawable,
imageSrc = XGetImage( display, physDevSrc->drawable,
visRectSrc->left, visRectSrc->top,
width, height, AllPlanes, ZPixmap );
else
{
/* Make sure we don't get a BadMatch error */
XCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
XCopyArea( display, physDevSrc->drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top,
width, height, 0, 0);
imageSrc = XGetImage( display, pixmap, 0, 0, width, height,
@ -901,30 +905,30 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
if (COLOR_PixelToPalette)
{
XSetBackground( display, gc,
COLOR_PixelToPalette[dcDst->u.x.textPixel] );
COLOR_PixelToPalette[physDevDst->textPixel] );
XSetForeground( display, gc,
COLOR_PixelToPalette[dcDst->u.x.backgroundPixel]);
COLOR_PixelToPalette[physDevDst->backgroundPixel]);
}
else
{
XSetBackground( display, gc, dcDst->u.x.textPixel );
XSetForeground( display, gc, dcDst->u.x.backgroundPixel );
XSetBackground( display, gc, physDevDst->textPixel );
XSetForeground( display, gc, physDevDst->backgroundPixel );
}
XCopyPlane( display, dcSrc->u.x.drawable, pixmap, gc,
XCopyPlane( display, physDevSrc->drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top,
width, height, 0, 0, 1 );
}
else /* color -> monochrome */
{
/* FIXME: avoid BadMatch error */
imageSrc = XGetImage( display, dcSrc->u.x.drawable,
imageSrc = XGetImage( display, physDevSrc->drawable,
visRectSrc->left, visRectSrc->top,
width, height, AllPlanes, ZPixmap );
XCREATEIMAGE( imageDst, width, height, dcDst->w.bitsPerPixel );
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) ==
dcSrc->u.x.backgroundPixel) );
physDevSrc->backgroundPixel) );
XPutImage( display, pixmap, gc, imageDst,
0, 0, 0, 0, width, height );
XDestroyImage( imageSrc );
@ -944,11 +948,12 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
{
INT32 width = visRectDst->right - visRectDst->left;
INT32 height = visRectDst->bottom - visRectDst->top;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!COLOR_PixelToPalette || (dc->w.bitsPerPixel == 1) ||
(COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL) )
{
XCopyArea( display, dc->u.x.drawable, pixmap, gc,
XCopyArea( display, physDev->drawable, pixmap, gc,
visRectDst->left, visRectDst->top, width, height, 0, 0 );
}
else
@ -957,13 +962,13 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
XImage *image;
if (dc->w.flags & DC_MEMORY)
image = XGetImage( display, dc->u.x.drawable,
image = XGetImage( display, physDev->drawable,
visRectDst->left, visRectDst->top,
width, height, AllPlanes, ZPixmap );
else
{
/* Make sure we don't get a BadMatch error */
XCopyArea( display, dc->u.x.drawable, pixmap, gc,
XCopyArea( display, physDev->drawable, pixmap, gc,
visRectDst->left, visRectDst->top, width, height, 0, 0);
image = XGetImage( display, pixmap, 0, 0, width, height,
AllPlanes, ZPixmap );
@ -988,13 +993,14 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
{
INT32 width = visRectDst->right - visRectDst->left;
INT32 height = visRectDst->bottom - visRectDst->top;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/* !COLOR_PaletteToPixel is _NOT_ enough */
if (!COLOR_PaletteToPixel || (dc->w.bitsPerPixel == 1) ||
(COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL) )
{
XCopyArea( display, pixmap, dc->u.x.drawable, gc, 0, 0,
XCopyArea( display, pixmap, physDev->drawable, gc, 0, 0,
width, height, visRectDst->left, visRectDst->top );
}
else
@ -1008,7 +1014,7 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
XPutPixel( image, x, y,
COLOR_PaletteToPixel[XGetPixel( image, x, y )]);
}
XPutImage( display, dc->u.x.drawable, gc, image, 0, 0,
XPutImage( display, physDev->drawable, gc, image, 0, 0,
visRectDst->left, visRectDst->top, width, height );
XDestroyImage( image );
}
@ -1101,7 +1107,10 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
const BYTE *opcode;
Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */
GC tmpGC = 0;
X11DRV_PDEVICE *physDevSrc = NULL;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev;
if(dcSrc) physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev;
usePat = (((rop >> 4) & 0x0f0000) != (rop & 0x0f0000));
useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000));
useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000));
@ -1169,14 +1178,14 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
{
case BLACKNESS: /* 0x00 */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel)
XSetFunction( display, dcDst->u.x.gc, GXclear );
XSetFunction( display, physDevDst->gc, GXclear );
else
{
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetForeground( display, dcDst->u.x.gc, COLOR_PaletteToPixel[0] );
XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
XSetFunction( display, physDevDst->gc, GXcopy );
XSetForeground( display, physDevDst->gc, COLOR_PaletteToPixel[0] );
XSetFillStyle( display, physDevDst->gc, FillSolid );
}
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
@ -1184,10 +1193,10 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel ||
!Options.perfectGraphics)
{
XSetFunction( display, dcDst->u.x.gc, GXinvert );
XSetFunction( display, physDevDst->gc, GXinvert );
if( COLOR_GetSystemPaletteFlags() & (COLOR_PRIVATE | COLOR_VIRTUAL) )
XSetFunction( display, dcDst->u.x.gc, GXinvert);
XSetFunction( display, physDevDst->gc, GXinvert);
else
{
/* Xor is much better when we do not have full colormap. */
@ -1195,11 +1204,11 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
/* and white. */
Pixel xor_pix = (WhitePixelOfScreen(screen) ^
BlackPixelOfScreen(screen));
XSetFunction( display, dcDst->u.x.gc, GXxor );
XSetForeground( display, dcDst->u.x.gc, xor_pix);
XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
XSetFunction( display, physDevDst->gc, GXxor );
XSetForeground( display, physDevDst->gc, xor_pix);
XSetFillStyle( display, physDevDst->gc, FillSolid );
}
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
@ -1209,8 +1218,8 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
if (Options.perfectGraphics) break;
if (X11DRV_SetupGCForBrush( dcDst ))
{
XSetFunction( display, dcDst->u.x.gc, GXxor );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XSetFunction( display, physDevDst->gc, GXxor );
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
@ -1219,8 +1228,8 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
if (Options.perfectGraphics) break;
if (X11DRV_SetupGCForBrush( dcDst ))
{
XSetFunction( display, dcDst->u.x.gc, GXequiv );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XSetFunction( display, physDevDst->gc, GXequiv );
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
@ -1228,53 +1237,54 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
XSetGraphicsExposures( display, dcDst->u.x.gc, True );
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XCopyArea( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
XSetGraphicsExposures( display, physDevDst->gc, True );
XSetFunction( display, physDevDst->gc, GXcopy );
XCopyArea( display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top );
XSetGraphicsExposures( display, dcDst->u.x.gc, False );
XSetGraphicsExposures( display, physDevDst->gc, False );
return TRUE;
}
if (dcSrc->w.bitsPerPixel == 1)
{
XSetBackground( display, dcDst->u.x.gc, dcDst->u.x.textPixel );
XSetForeground( display, dcDst->u.x.gc, dcDst->u.x.backgroundPixel );
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetGraphicsExposures( display, dcDst->u.x.gc, True );
XCopyPlane( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
XSetBackground( display, physDevDst->gc, physDevDst->textPixel );
XSetForeground( display, physDevDst->gc,
physDevDst->backgroundPixel );
XSetFunction( display, physDevDst->gc, GXcopy );
XSetGraphicsExposures( display, physDevDst->gc, True );
XCopyPlane( display, physDevSrc->drawable,
physDevDst->drawable, physDevDst->gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top, 1 );
XSetGraphicsExposures( display, dcDst->u.x.gc, False );
XSetGraphicsExposures( display, physDevDst->gc, False );
return TRUE;
}
break;
case PATCOPY: /* 0xf0 */
if (!X11DRV_SetupGCForBrush( dcDst )) return TRUE;
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XSetFunction( display, physDevDst->gc, GXcopy );
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case WHITENESS: /* 0xff */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel)
XSetFunction( display, dcDst->u.x.gc, GXset );
XSetFunction( display, physDevDst->gc, GXset );
else
{
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetForeground( display, dcDst->u.x.gc,
XSetFunction( display, physDevDst->gc, GXcopy );
XSetForeground( display, physDevDst->gc,
COLOR_PaletteToPixel[COLOR_GetSystemPaletteSize() - 1]);
XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
XSetFillStyle( display, physDevDst->gc, FillSolid );
}
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
XFillRectangle( display, physDevDst->drawable, physDevDst->gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
tmpGC = XCreateGC( display, dcDst->u.x.drawable, 0, NULL );
tmpGC = XCreateGC( display, physDevDst->drawable, 0, NULL );
pixmaps[DST] = XCreatePixmap( display, rootWindow, width, height,
dcDst->w.bitsPerPixel );
if (useSrc)
@ -1331,9 +1341,9 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
break;
}
}
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetFunction( display, physDevDst->gc, GXcopy );
BITBLT_PutDstArea( dcDst, pixmaps[destUsed ? DST : SRC],
dcDst->u.x.gc, &visRectDst );
physDevDst->gc, &visRectDst );
XFreePixmap( display, pixmaps[DST] );
if (pixmaps[SRC]) XFreePixmap( display, pixmaps[SRC] );
if (pixmaps[TMP]) XFreePixmap( display, pixmaps[TMP] );

View file

@ -58,6 +58,8 @@ HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
HRGN32 hrgn;
HBITMAP32 prevHandle = dc->w.hBitmap;
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!(dc->w.flags & DC_MEMORY)) return 0;
@ -66,7 +68,7 @@ HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
return 0;
if(bmp->DDBitmap->funcs != dc->funcs) {
WARN(bitmap, "Trying to select non-X11 DDB into an X11 dc\n");
WARN(x11drv, "Trying to select non-X11 DDB into an X11 dc\n");
return 0;
}
@ -87,15 +89,15 @@ HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
dc->w.hVisRgn = hrgn;
}
dc->u.x.drawable = pbitmap->pixmap;
dc->w.hBitmap = hbitmap;
physDev->drawable = pbitmap->pixmap;
dc->w.hBitmap = hbitmap;
/* Change GC depth if needed */
if (dc->w.bitsPerPixel != bmp->bitmap.bmBitsPixel)
{
TSXFreeGC( display, dc->u.x.gc );
dc->u.x.gc = TSXCreateGC( display, dc->u.x.drawable, 0, NULL );
TSXFreeGC( display, physDev->gc );
physDev->gc = TSXCreateGC( display, physDev->drawable, 0, NULL );
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
DC_InitDC( dc );
}
@ -139,19 +141,18 @@ X11DRV_PHYSBITMAP *X11DRV_AllocBitmap( BITMAPOBJ *bmp )
X11DRV_PHYSBITMAP *pbitmap;
if(!(bmp->DDBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DDBITMAP)))) {
WARN(bitmap, "Can't alloc DDBITMAP\n");
WARN(x11drv, "Can't alloc DDBITMAP\n");
return NULL;
}
if(!(pbitmap = HeapAlloc(GetProcessHeap(), 0,sizeof(X11DRV_PHYSBITMAP)))) {
WARN(bitmap, "Can't alloc X11DRV_PHYSBITMAP\n");
WARN(x11drv, "Can't alloc X11DRV_PHYSBITMAP\n");
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap);
return NULL;
}
bmp->DDBitmap->physBitmap = pbitmap;
bmp->DDBitmap->funcs = DRIVER_FindDriver( "DISPLAY" );
return pbitmap;
}
@ -172,7 +173,7 @@ BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap )
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if(!bmp) {
WARN(bitmap, "Bad bitmap handle %08x\n", hbitmap);
WARN(x11drv, "Bad bitmap handle %08x\n", hbitmap);
return FALSE;
}
@ -180,6 +181,8 @@ BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap )
if (bmp->bitmap.bmPlanes != 1) return 0;
if ((bmp->bitmap.bmBitsPixel != 1) &&
(bmp->bitmap.bmBitsPixel != screenDepth)) {
ERR(x11drv, "Trying to make bitmap with planes=%d, bpp=%d\n",
bmp->bitmap.bmPlanes, bmp->bitmap.bmBitsPixel);
GDI_HEAP_UNLOCK( hbitmap );
return FALSE;
}
@ -194,7 +197,7 @@ BOOL32 X11DRV_CreateBitmap( HBITMAP32 hbitmap )
pbitmap->pixmap = TSXCreatePixmap(display, rootWindow, bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, bmp->bitmap.bmBitsPixel);
if (!pbitmap->pixmap) {
WARN(bitmap, "Can't create Pixmap\n");
WARN(x11drv, "Can't create Pixmap\n");
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap->physBitmap);
HeapFree(GetProcessHeap(), 0, bmp->DDBitmap);
GDI_HEAP_UNLOCK( hbitmap );
@ -239,7 +242,7 @@ static LONG X11DRV_GetBitmapBits(BITMAPOBJ *bmp, void *buffer, LONG count)
LPBYTE tbuf;
int h, w, pad;
TRACE(x11drv, "(bmp=%p, buffer=%p, count=%lx)\n", bmp, buffer, count);
TRACE(x11drv, "(bmp=%p, buffer=%p, count=0x%lx)\n", bmp, buffer, count);
pad = BITMAP_GetPadding(bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel);
@ -340,7 +343,7 @@ static LONG X11DRV_GetBitmapBits(BITMAPOBJ *bmp, void *buffer, LONG count)
}
break;
default:
FIXME(bitmap, "Unhandled bits:%d\n", bmp->bitmap.bmBitsPixel);
FIXME(x11drv, "Unhandled bits:%d\n", bmp->bitmap.bmBitsPixel);
}
XDestroyImage( image );
LeaveCriticalSection( &X11DRV_CritSection );
@ -365,7 +368,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
LPBYTE sbuf;
int w, h, pad;
TRACE(x11drv, "(bmp=%p, bits=%p, count=%lx)\n", bmp, bits, count);
TRACE(x11drv, "(bmp=%p, bits=%p, count=0x%lx)\n", bmp, bits, count);
pad = BITMAP_GetPadding(bmp->bitmap.bmWidth, bmp->bitmap.bmBitsPixel);
@ -451,7 +454,7 @@ static LONG X11DRV_SetBitmapBits(BITMAPOBJ *bmp, void *bits, LONG count)
}
break;
default:
FIXME(bitmap, "Unhandled bits:%d\n", bmp->bitmap.bmBitsPixel);
FIXME(x11drv, "Unhandled bits:%d\n", bmp->bitmap.bmBitsPixel);
}
@ -475,7 +478,7 @@ LONG X11DRV_BitmapBits(HBITMAP32 hbitmap, void *bits, LONG count, WORD flags)
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
LONG ret;
if(!bmp) {
WARN(bitmap, "Bad bitmap handle %08x\n", hbitmap);
WARN(x11drv, "Bad bitmap handle %08x\n", hbitmap);
return FALSE;
}
@ -484,7 +487,7 @@ LONG X11DRV_BitmapBits(HBITMAP32 hbitmap, void *bits, LONG count, WORD flags)
else if(flags == DDB_SET)
ret = X11DRV_SetBitmapBits(bmp, bits, count);
else {
ERR(bitmap, "Unknown flags value %d\n", flags);
ERR(x11drv, "Unknown flags value %d\n", flags);
ret = 0;
}

View file

@ -1,5 +1,5 @@
/*
* GDI brush objects
* X11DRV brush objects
*
* Copyright 1993, 1994 Alexandre Julliard
*/
@ -142,18 +142,20 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
*/
static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if ((dc->w.bitsPerPixel > 1) && (screenDepth <= 8) && !COLOR_IsSolid( color ))
{
/* Dithered brush */
dc->u.x.brush.pixmap = BRUSH_DitherColor( dc, color );
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0;
physDev->brush.pixmap = BRUSH_DitherColor( dc, color );
physDev->brush.fillStyle = FillTiled;
physDev->brush.pixel = 0;
}
else
{
/* Solid brush */
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, color );
dc->u.x.brush.fillStyle = FillSolid;
physDev->brush.pixel = COLOR_ToPhysical( dc, color );
physDev->brush.fillStyle = FillSolid;
}
}
@ -164,6 +166,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
static BOOL32 BRUSH_SelectPatternBrush( DC * dc, HBITMAP32 hbitmap )
{
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
@ -181,28 +184,28 @@ static BOOL32 BRUSH_SelectPatternBrush( DC * dc, HBITMAP32 hbitmap )
if ((dc->w.bitsPerPixel == 1) && (bmp->bitmap.bmBitsPixel != 1))
{
/* Special case: a color pattern on a monochrome DC */
dc->u.x.brush.pixmap = TSXCreatePixmap( display, rootWindow, 8, 8, 1 );
physDev->brush.pixmap = TSXCreatePixmap( display, rootWindow, 8, 8, 1);
/* FIXME: should probably convert to monochrome instead */
TSXCopyPlane( display, pbitmap->pixmap, dc->u.x.brush.pixmap,
TSXCopyPlane( display, pbitmap->pixmap, physDev->brush.pixmap,
BITMAP_monoGC, 0, 0, 8, 8, 0, 0, 1 );
}
else
{
dc->u.x.brush.pixmap = TSXCreatePixmap( display, rootWindow,
8, 8, bmp->bitmap.bmBitsPixel );
TSXCopyArea( display, pbitmap->pixmap, dc->u.x.brush.pixmap,
physDev->brush.pixmap = TSXCreatePixmap( display, rootWindow,
8, 8, bmp->bitmap.bmBitsPixel );
TSXCopyArea( display, pbitmap->pixmap, physDev->brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
}
if (bmp->bitmap.bmBitsPixel > 1)
{
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0; /* Ignored */
physDev->brush.fillStyle = FillTiled;
physDev->brush.pixel = 0; /* Ignored */
}
else
{
dc->u.x.brush.fillStyle = FillOpaqueStippled;
dc->u.x.brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
physDev->brush.fillStyle = FillOpaqueStippled;
physDev->brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
}
GDI_HEAP_UNLOCK( hbitmap );
return TRUE;
@ -219,38 +222,19 @@ HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
HBITMAP16 hBitmap;
BITMAPINFO * bmpInfo;
HBRUSH16 prevHandle = dc->w.hBrush;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE(gdi, "hdc=%04x hbrush=%04x\n",
dc->hSelf,hbrush);
#ifdef NOTDEF
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
LOGBRUSH16 logbrush = { brush->logbrush.lbStyle,
brush->logbrush.lbColor,
brush->logbrush.lbHatch };
switch (brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_HATCHED:
case BS_HOLLOW:
if (!MF_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MF_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
break;
}
return 1; /* FIXME? */
}
#endif
dc->w.hBrush = hbrush;
if (dc->u.x.brush.pixmap)
if (physDev->brush.pixmap)
{
TSXFreePixmap( display, dc->u.x.brush.pixmap );
dc->u.x.brush.pixmap = 0;
TSXFreePixmap( display, physDev->brush.pixmap );
physDev->brush.pixmap = 0;
}
dc->u.x.brush.style = brush->logbrush.lbStyle;
physDev->brush.style = brush->logbrush.lbStyle;
switch(brush->logbrush.lbStyle)
{
@ -265,10 +249,10 @@ HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
case BS_HATCHED:
TRACE(gdi, "BS_HATCHED\n" );
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
dc->u.x.brush.pixmap = TSXCreateBitmapFromData( display, rootWindow,
physDev->brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
physDev->brush.pixmap = TSXCreateBitmapFromData( display, rootWindow,
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
dc->u.x.brush.fillStyle = FillStippled;
physDev->brush.fillStyle = FillStippled;
break;
case BS_PATTERN:

View file

@ -21,12 +21,13 @@
void X11DRV_SetDeviceClipping( DC * dc )
{
XRectangle *pXrect;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
if (!obj)
{
ERR(x11drv, "Rgn is 0. Please report this.\n");
return;
/*exit(1);*/
}
if (obj->rgn->numRects > 0)
@ -54,7 +55,7 @@ void X11DRV_SetDeviceClipping( DC * dc )
else
pXrect = NULL;
TSXSetClipRectangles( display, dc->u.x.gc, 0, 0,
TSXSetClipRectangles( display, physDev->gc, 0, 0,
pXrect, obj->rgn->numRects, YXBanded );
if(pXrect)

View file

@ -1098,6 +1098,7 @@ INT32 X11DRV_SetDIBitsToDevice( DC *dc, INT32 xDest, INT32 yDest, DWORD cx,
DWORD width, oldcy = cy;
INT32 result;
int height, tmpheight;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
@ -1115,7 +1116,7 @@ INT32 X11DRV_SetDIBitsToDevice( DC *dc, INT32 xDest, INT32 yDest, DWORD cx,
if (!cx || !cy) return 0;
X11DRV_SetupGCForText( dc ); /* To have the correct colors */
TSXSetFunction(display, dc->u.x.gc, X11DRV_XROPfunction[dc->w.ROPmode-1]);
TSXSetFunction(display, physDev->gc, X11DRV_XROPfunction[dc->w.ROPmode-1]);
if (descr.infoBpp <= 8)
{
@ -1132,8 +1133,8 @@ INT32 X11DRV_SetDIBitsToDevice( DC *dc, INT32 xDest, INT32 yDest, DWORD cx,
descr.lines = tmpheight >= 0 ? lines : -lines;
descr.infoWidth = width;
descr.depth = dc->w.bitsPerPixel;
descr.drawable = dc->u.x.drawable;
descr.gc = dc->u.x.gc;
descr.drawable = physDev->drawable;
descr.gc = physDev->gc;
descr.xSrc = xSrc;
descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)
: ySrc - startscan;

View file

@ -75,21 +75,22 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
XGCValues val;
unsigned long mask;
Pixmap pixmap = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (dc->u.x.brush.style == BS_NULL) return FALSE;
if (dc->u.x.brush.pixel == -1)
if (physDev->brush.style == BS_NULL) return FALSE;
if (physDev->brush.pixel == -1)
{
/* Special case used for monochrome pattern brushes.
* We need to swap foreground and background because
* Windows does it the wrong way...
*/
val.foreground = dc->u.x.backgroundPixel;
val.background = dc->u.x.textPixel;
val.foreground = physDev->backgroundPixel;
val.background = physDev->textPixel;
}
else
{
val.foreground = dc->u.x.brush.pixel;
val.background = dc->u.x.backgroundPixel;
val.foreground = physDev->brush.pixel;
val.background = physDev->backgroundPixel;
}
if (fMapColors && COLOR_PixelToPalette)
{
@ -110,13 +111,13 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
val.foreground = BlackPixelOfScreen(screen) ^ WhitePixelOfScreen(screen);
val.function = GXxor;
}
val.fill_style = dc->u.x.brush.fillStyle;
val.fill_style = physDev->brush.fillStyle;
switch(val.fill_style)
{
case FillStippled:
case FillOpaqueStippled:
if (dc->w.backgroundMode==OPAQUE) val.fill_style = FillOpaqueStippled;
val.stipple = dc->u.x.brush.pixmap;
val.stipple = physDev->brush.pixmap;
mask = GCStipple;
break;
@ -127,7 +128,7 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
XImage *image;
EnterCriticalSection( &X11DRV_CritSection );
pixmap = XCreatePixmap( display, rootWindow, 8, 8, screenDepth );
image = XGetImage( display, dc->u.x.brush.pixmap, 0, 0, 8, 8,
image = XGetImage( display, physDev->brush.pixmap, 0, 0, 8, 8,
AllPlanes, ZPixmap );
for (y = 0; y < 8; y++)
for (x = 0; x < 8; x++)
@ -138,7 +139,7 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
LeaveCriticalSection( &X11DRV_CritSection );
val.tile = pixmap;
}
else val.tile = dc->u.x.brush.pixmap;
else val.tile = physDev->brush.pixmap;
mask = GCTile;
break;
@ -161,26 +162,28 @@ BOOL32 X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
/***********************************************************************
* X11DRV_SetupGCForBrush
*
* Setup dc->u.x.gc for drawing operations using current brush.
* Setup physDev->gc for drawing operations using current brush.
* Return FALSE if brush is BS_NULL, TRUE otherwise.
*/
BOOL32 X11DRV_SetupGCForBrush( DC * dc )
{
return X11DRV_SetupGCForPatBlt( dc, dc->u.x.gc, FALSE );
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
return X11DRV_SetupGCForPatBlt( dc, physDev->gc, FALSE );
}
/***********************************************************************
* X11DRV_SetupGCForPen
*
* Setup dc->u.x.gc for drawing operations using current pen.
* Setup physDev->gc for drawing operations using current pen.
* Return FALSE if pen is PS_NULL, TRUE otherwise.
*/
BOOL32 X11DRV_SetupGCForPen( DC * dc )
{
XGCValues val;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (dc->u.x.pen.style == PS_NULL) return FALSE;
if (physDev->pen.style == PS_NULL) return FALSE;
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
@ -195,7 +198,7 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
val.function = GXcopy;
break;
case R2_XORPEN :
val.foreground = dc->u.x.pen.pixel;
val.foreground = physDev->pen.pixel;
/* It is very unlikely someone wants to XOR with 0 */
/* This fixes the rubber-drawings in paintbrush */
if (val.foreground == 0)
@ -204,24 +207,24 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
val.function = GXxor;
break;
default :
val.foreground = dc->u.x.pen.pixel;
val.foreground = physDev->pen.pixel;
val.function = X11DRV_XROPfunction[dc->w.ROPmode-1];
}
val.background = dc->u.x.backgroundPixel;
val.background = physDev->backgroundPixel;
val.fill_style = FillSolid;
if ((dc->u.x.pen.style!=PS_SOLID) && (dc->u.x.pen.style!=PS_INSIDEFRAME))
if ((physDev->pen.style!=PS_SOLID) && (physDev->pen.style!=PS_INSIDEFRAME))
{
TSXSetDashes( display, dc->u.x.gc, 0,
dc->u.x.pen.dashes, dc->u.x.pen.dash_len );
TSXSetDashes( display, physDev->gc, 0, physDev->pen.dashes,
physDev->pen.dash_len );
val.line_style = (dc->w.backgroundMode == OPAQUE) ?
LineDoubleDash : LineOnOffDash;
}
else val.line_style = LineSolid;
val.line_width = dc->u.x.pen.width;
val.line_width = physDev->pen.width;
if (val.line_width <= 1) {
val.cap_style = CapNotLast;
} else {
switch (dc->u.x.pen.endcap)
switch (physDev->pen.endcap)
{
case PS_ENDCAP_SQUARE:
val.cap_style = CapProjecting;
@ -234,7 +237,7 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
val.cap_style = CapRound;
}
}
switch (dc->u.x.pen.linejoin)
switch (physDev->pen.linejoin)
{
case PS_JOIN_BEVEL:
val.join_style = JoinBevel;
@ -246,7 +249,7 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
default:
val.join_style = JoinRound;
}
TSXChangeGC( display, dc->u.x.gc,
TSXChangeGC( display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCLineWidth |
GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val );
return TRUE;
@ -256,12 +259,13 @@ BOOL32 X11DRV_SetupGCForPen( DC * dc )
/***********************************************************************
* X11DRV_SetupGCForText
*
* Setup dc->u.x.gc for text drawing operations.
* Setup physDev->gc for text drawing operations.
* Return FALSE if the font is null, TRUE otherwise.
*/
BOOL32 X11DRV_SetupGCForText( DC * dc )
{
XFontStruct* xfs = XFONT_GetFontStruct( dc->u.x.font );
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
XFontStruct* xfs = XFONT_GetFontStruct( physDev->font );
if( xfs )
{
@ -270,12 +274,12 @@ BOOL32 X11DRV_SetupGCForText( DC * dc )
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
val.function = GXcopy; /* Text is always GXcopy */
val.foreground = dc->u.x.textPixel;
val.background = dc->u.x.backgroundPixel;
val.foreground = physDev->textPixel;
val.background = physDev->backgroundPixel;
val.fill_style = FillSolid;
val.font = xfs->fid;
TSXChangeGC( display, dc->u.x.gc,
TSXChangeGC( display, physDev->gc,
GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFont, &val );
return TRUE;
@ -285,9 +289,6 @@ BOOL32 X11DRV_SetupGCForText( DC * dc )
}
/**********************************************************************
* X11DRV_MoveToEx
*/
@ -309,8 +310,10 @@ X11DRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt) {
BOOL32
X11DRV_LineTo( DC *dc, INT32 x, INT32 y )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (X11DRV_SetupGCForPen( dc ))
TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine(display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX ),
dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY ),
dc->w.DCOrgX + XLPTODP( dc, x ),
@ -338,6 +341,7 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
INT32 width, oldwidth, oldendcap;
double start_angle, end_angle;
XPoint points[4];
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
@ -353,12 +357,12 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
if ((left == right) || (top == bottom)
||(lines && ((right-left==1)||(bottom-top==1)))) return TRUE;
oldwidth = width = dc->u.x.pen.width;
oldendcap= dc->u.x.pen.endcap;
oldwidth = width = physDev->pen.width;
oldendcap = physDev->pen.endcap;
if (!width) width = 1;
if(dc->u.x.pen.style == PS_NULL) width = 0;
if(physDev->pen.style == PS_NULL) width = 0;
if ((dc->u.x.pen.style == PS_INSIDEFRAME))
if ((physDev->pen.style == PS_INSIDEFRAME))
{
if (2*width > (right-left)) width=(right-left + 1)/2;
if (2*width > (bottom-top)) width=(bottom-top + 1)/2;
@ -367,9 +371,9 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
top += width / 2;
bottom -= (width - 1) / 2;
}
if(width == 0) width=1; /* more accurate */
dc->u.x.pen.width=width;
dc->u.x.pen.endcap=PS_ENDCAP_SQUARE;
if(width == 0) width = 1; /* more accurate */
physDev->pen.width = width;
physDev->pen.endcap = PS_ENDCAP_SQUARE;
xcenter = (right + left) / 2;
ycenter = (bottom + top) / 2;
@ -395,8 +399,9 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
/* Fill arc with brush if Chord() or Pie() */
if ((lines > 0) && X11DRV_SetupGCForBrush( dc )) {
TSXSetArcMode( display, dc->u.x.gc, (lines==1) ? ArcChord : ArcPieSlice);
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXSetArcMode( display, physDev->gc,
(lines==1) ? ArcChord : ArcPieSlice);
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, istart_angle, idiff_angle );
}
@ -404,7 +409,7 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
/* Draw arc and lines */
if (X11DRV_SetupGCForPen( dc )){
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, istart_angle, idiff_angle );
if (lines) {
@ -460,12 +465,12 @@ X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
}
lines++;
}
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
points, lines+1, CoordModeOrigin );
}
}
dc->u.x.pen.width=oldwidth;
dc->u.x.pen.endcap=oldendcap;
physDev->pen.width = oldwidth;
physDev->pen.endcap = oldendcap;
return TRUE;
}
@ -512,6 +517,8 @@ BOOL32
X11DRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
{
INT32 width, oldwidth;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
@ -521,11 +528,11 @@ X11DRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
oldwidth = width = dc->u.x.pen.width;
oldwidth = width = physDev->pen.width;
if (!width) width = 1;
if(dc->u.x.pen.style == PS_NULL) width = 0;
if(physDev->pen.style == PS_NULL) width = 0;
if ((dc->u.x.pen.style == PS_INSIDEFRAME))
if ((physDev->pen.style == PS_INSIDEFRAME))
{
if (2*width > (right-left)) width=(right-left + 1)/2;
if (2*width > (bottom-top)) width=(bottom-top + 1)/2;
@ -534,18 +541,18 @@ X11DRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
top += width / 2;
bottom -= (width - 1) / 2;
}
if(width == 0) width=1; /* more accurate */
dc->u.x.pen.width=width;
if(width == 0) width = 1; /* more accurate */
physDev->pen.width = width;
if (X11DRV_SetupGCForBrush( dc ))
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
if (X11DRV_SetupGCForPen( dc ))
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
dc->u.x.pen.width=oldwidth;
physDev->pen.width = oldwidth;
return TRUE;
}
@ -557,6 +564,7 @@ BOOL32
X11DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
INT32 width, oldwidth, oldjoinstyle;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE(graphics, "(%d %d %d %d)\n",
left, top, right, bottom);
@ -571,11 +579,11 @@ X11DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
oldwidth = width = dc->u.x.pen.width;
oldwidth = width = physDev->pen.width;
if (!width) width = 1;
if(dc->u.x.pen.style == PS_NULL) width = 0;
if(physDev->pen.style == PS_NULL) width = 0;
if ((dc->u.x.pen.style == PS_INSIDEFRAME))
if ((physDev->pen.style == PS_INSIDEFRAME))
{
if (2*width > (right-left)) width=(right-left + 1)/2;
if (2*width > (bottom-top)) width=(bottom-top + 1)/2;
@ -584,27 +592,27 @@ X11DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
top += width / 2;
bottom -= (width - 1) / 2;
}
if(width == 1) width=0;
dc->u.x.pen.width=width;
oldjoinstyle=dc->u.x.pen.linejoin;
if(dc->u.x.pen.type!=PS_GEOMETRIC)
dc->u.x.pen.linejoin=PS_JOIN_MITER;
if(width == 1) width = 0;
physDev->pen.width = width;
oldjoinstyle = physDev->pen.linejoin;
if(physDev->pen.type != PS_GEOMETRIC)
physDev->pen.linejoin = PS_JOIN_MITER;
if ((right > left + width) && (bottom > top + width))
{
if (X11DRV_SetupGCForBrush( dc ))
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + (width + 1) / 2,
dc->w.DCOrgY + top + (width + 1) / 2,
right-left-width-1, bottom-top-width-1);
}
if (X11DRV_SetupGCForPen( dc ))
TSXDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );
dc->u.x.pen.width=oldwidth;
dc->u.x.pen.linejoin=oldjoinstyle;
physDev->pen.width = oldwidth;
physDev->pen.linejoin = oldjoinstyle;
return TRUE;
}
@ -616,6 +624,7 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 ell_width, INT32 ell_height )
{
INT32 width, oldwidth, oldendcap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE(graphics, "(%d %d %d %d %d %d\n",
left, top, right, bottom, ell_width, ell_height);
@ -638,12 +647,12 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
oldwidth=width = dc->u.x.pen.width;
oldendcap = dc->u.x.pen.endcap;
oldwidth = width = physDev->pen.width;
oldendcap = physDev->pen.endcap;
if (!width) width = 1;
if(dc->u.x.pen.style == PS_NULL) width = 0;
if(physDev->pen.style == PS_NULL) width = 0;
if ((dc->u.x.pen.style == PS_INSIDEFRAME))
if ((physDev->pen.style == PS_INSIDEFRAME))
{
if (2*width > (right-left)) width=(right-left + 1)/2;
if (2*width > (bottom-top)) width=(bottom-top + 1)/2;
@ -652,59 +661,60 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
top += width / 2;
bottom -= (width - 1) / 2;
}
if(width == 0) width=1;
dc->u.x.pen.width=width;
dc->u.x.pen.endcap=PS_ENDCAP_SQUARE;
if(width == 0) width = 1;
physDev->pen.width = width;
physDev->pen.endcap = PS_ENDCAP_SQUARE;
if (X11DRV_SetupGCForBrush( dc ))
{
if (ell_width > (right-left) )
if (ell_height > (bottom-top) )
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, bottom - top - 1,
0, 360 * 64 );
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, bottom - top - 1,
0, 360 * 64 );
else{
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, ell_height, 0, 180 * 64 );
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height - 1,
right - left - 1, ell_height, 180 * 64, 180 * 64 );
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, ell_height, 0, 180 * 64 );
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height - 1,
right - left - 1, ell_height, 180 * 64,
180 * 64 );
}
else if (ell_height > (bottom-top) ){
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, bottom - top - 1, 90 * 64, 180 * 64 );
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width -1, dc->w.DCOrgY + top,
ell_width, bottom - top - 1, 270 * 64, 180 * 64 );
}else{
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, ell_height, 90 * 64, 90 * 64 );
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height - 1,
ell_width, ell_height, 180 * 64, 90 * 64 );
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width - 1,
dc->w.DCOrgY + bottom - ell_height - 1,
ell_width, ell_height, 270 * 64, 90 * 64 );
TSXFillArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width - 1,
dc->w.DCOrgY + top,
ell_width, ell_height, 0, 90 * 64 );
}
if (ell_width < right - left)
{
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + (ell_width + 1) / 2,
dc->w.DCOrgY + top + 1,
right - left - ell_width - 1,
(ell_height + 1) / 2 - 1);
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + (ell_width + 1) / 2,
dc->w.DCOrgY + bottom - (ell_height) / 2 - 1,
right - left - ell_width - 1,
@ -712,7 +722,7 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
}
if (ell_height < bottom - top)
{
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + 1,
dc->w.DCOrgY + top + (ell_height + 1) / 2,
right - left - 2,
@ -731,49 +741,49 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
if (X11DRV_SetupGCForPen(dc)) {
if (ell_width > (right-left) )
if (ell_height > (bottom-top) )
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, bottom -top - 1, 0 , 360 * 64 );
else{
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right - left - 1, ell_height - 1, 0 , 180 * 64 );
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height,
right - left - 1, ell_height - 1, 180 * 64 , 180 * 64 );
}
else if (ell_height > (bottom-top) ){
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width - 1 , bottom - top - 1, 90 * 64 , 180 * 64 );
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + top,
ell_width - 1 , bottom - top - 1, 270 * 64 , 180 * 64 );
}else{
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width - 1, ell_height - 1, 90 * 64, 90 * 64 );
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + bottom - ell_height,
ell_width - 1, ell_height - 1, 180 * 64, 90 * 64 );
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + bottom - ell_height,
ell_width - 1, ell_height - 1, 270 * 64, 90 * 64 );
TSXDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawArc( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top,
ell_width - 1, ell_height - 1, 0, 90 * 64 );
}
if (ell_width < right - left)
{
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + top,
dc->w.DCOrgX + right - (ell_width+1) / 2,
dc->w.DCOrgY + top);
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left + ell_width / 2 ,
dc->w.DCOrgY + bottom - 1,
dc->w.DCOrgX + right - (ell_width+1)/ 2,
@ -781,20 +791,20 @@ X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
}
if (ell_height < bottom - top)
{
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + right - 1,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + right - 1,
dc->w.DCOrgY + bottom - (ell_height+1) / 2);
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - (ell_height+1) / 2);
}
}
dc->u.x.pen.width=oldwidth;
dc->u.x.pen.endcap=oldendcap;
physDev->pen.width = oldwidth;
physDev->pen.endcap = oldendcap;
return TRUE;
}
@ -806,14 +816,15 @@ COLORREF
X11DRV_SetPixel( DC *dc, INT32 x, INT32 y, COLORREF color )
{
Pixel pixel;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
pixel = COLOR_ToPhysical( dc, color );
TSXSetForeground( display, dc->u.x.gc, pixel );
TSXSetFunction( display, dc->u.x.gc, GXcopy );
TSXDrawPoint( display, dc->u.x.drawable, dc->u.x.gc, x, y );
TSXSetForeground( display, physDev->gc, pixel );
TSXSetFunction( display, physDev->gc, GXcopy );
TSXDrawPoint( display, physDev->drawable, physDev->gc, x, y );
/* inefficient but simple... */
@ -830,13 +841,14 @@ X11DRV_GetPixel( DC *dc, INT32 x, INT32 y )
static Pixmap pixmap = 0;
XImage * image;
int pixel;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
EnterCriticalSection( &X11DRV_CritSection );
if (dc->w.flags & DC_MEMORY)
{
image = XGetImage( display, dc->u.x.drawable, x, y, 1, 1,
image = XGetImage( display, physDev->drawable, x, y, 1, 1,
AllPlanes, ZPixmap );
}
else
@ -845,7 +857,7 @@ X11DRV_GetPixel( DC *dc, INT32 x, INT32 y )
/* to avoid a BadMatch error */
if (!pixmap) pixmap = XCreatePixmap( display, rootWindow,
1, 1, dc->w.bitsPerPixel );
XCopyArea( display, dc->u.x.drawable, pixmap, BITMAP_colorGC,
XCopyArea( display, physDev->drawable, pixmap, BITMAP_colorGC,
x, y, 1, 1, 0, 0 );
image = XGetImage( display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
}
@ -866,6 +878,7 @@ X11DRV_PaintRgn( DC *dc, HRGN32 hrgn )
RECT32 box;
HRGN32 tmpVisRgn, prevVisRgn;
HDC32 hdc = dc->hSelf; /* FIXME: should not mix dc/hdc this way */
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!(tmpVisRgn = CreateRectRgn32( 0, 0, 0, 0 ))) return FALSE;
@ -889,7 +902,7 @@ X11DRV_PaintRgn( DC *dc, HRGN32 hrgn )
GetRgnBox32( dc->w.hGCClipRgn, &box );
if (X11DRV_SetupGCForBrush( dc ))
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
box.left, box.top,
box.right-box.left, box.bottom-box.top );
@ -908,7 +921,9 @@ X11DRV_Polyline( DC *dc, const POINT32* pt, INT32 count )
INT32 oldwidth;
register int i;
XPoint *points;
if((oldwidth=dc->u.x.pen.width)==0) dc->u.x.pen.width=1;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if((oldwidth = physDev->pen.width) == 0) physDev->pen.width = 1;
points = (XPoint *) xmalloc (sizeof (XPoint) * (count));
for (i = 0; i < count; i++)
@ -918,11 +933,11 @@ X11DRV_Polyline( DC *dc, const POINT32* pt, INT32 count )
}
if (X11DRV_SetupGCForPen ( dc ))
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
points, count, CoordModeOrigin );
free( points );
dc->u.x.pen.width=oldwidth;
physDev->pen.width = oldwidth;
return TRUE;
}
@ -935,6 +950,7 @@ X11DRV_Polygon( DC *dc, const POINT32* pt, INT32 count )
{
register int i;
XPoint *points;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
points = (XPoint *) xmalloc (sizeof (XPoint) * (count+1));
for (i = 0; i < count; i++)
@ -945,11 +961,11 @@ X11DRV_Polygon( DC *dc, const POINT32* pt, INT32 count )
points[count] = points[0];
if (X11DRV_SetupGCForBrush( dc ))
TSXFillPolygon( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillPolygon( display, physDev->drawable, physDev->gc,
points, count+1, Complex, CoordModeOrigin);
if (X11DRV_SetupGCForPen ( dc ))
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
points, count+1, CoordModeOrigin );
free( points );
@ -964,11 +980,11 @@ BOOL32
X11DRV_PolyPolygon( DC *dc, const POINT32* pt, const INT32* counts, UINT32 polygons)
{
HRGN32 hrgn;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/* FIXME: The points should be converted to device coords before */
/* creating the region. */
/* FIXME: The points should be converted to device coords before */
/* creating the region. But as CreatePolyPolygonRgn is not */
/* really correct either, it doesn't matter much... */
/* At least the outline will be correct :-) */
hrgn = CreatePolyPolygonRgn32( pt, counts, polygons, dc->w.polyFillMode );
X11DRV_PaintRgn( dc, hrgn );
DeleteObject32( hrgn );
@ -992,7 +1008,7 @@ X11DRV_PolyPolygon( DC *dc, const POINT32* pt, const INT32* counts, UINT32 polyg
pt++;
}
points[j] = points[0];
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
points, j + 1, CoordModeOrigin );
}
free( points );
@ -1007,6 +1023,7 @@ X11DRV_PolyPolygon( DC *dc, const POINT32* pt, const INT32* counts, UINT32 polyg
BOOL32
X11DRV_PolyPolyline( DC *dc, const POINT32* pt, const DWORD* counts, DWORD polylines )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (X11DRV_SetupGCForPen ( dc ))
{
int i, j, max = 0;
@ -1024,7 +1041,7 @@ X11DRV_PolyPolyline( DC *dc, const POINT32* pt, const DWORD* counts, DWORD polyl
pt++;
}
points[j] = points[0];
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
points, j + 1, CoordModeOrigin );
}
free( points );
@ -1045,6 +1062,7 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
int xOrg, int yOrg,
Pixel pixel, WORD fillType )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
int left, right;
#define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
@ -1058,7 +1076,7 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
left = right = x;
while ((left > 0) && TO_FLOOD( left-1, y )) left--;
while ((right < image->width) && TO_FLOOD( right, y )) right++;
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
XFillRectangle( display, physDev->drawable, physDev->gc,
xOrg + left, yOrg + y, right-left, 1 );
/* Set the pixels of this line so we don't fill it again */
@ -1124,10 +1142,11 @@ static BOOL32 X11DRV_DoFloodFill( const struct FloodFill_params *params )
XImage *image;
RECT32 rect;
DC *dc = params->dc;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (GetRgnBox32( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE;
if (!(image = XGetImage( display, dc->u.x.drawable,
if (!(image = XGetImage( display, physDev->drawable,
rect.left,
rect.top,
rect.right - rect.left,
@ -1137,7 +1156,7 @@ static BOOL32 X11DRV_DoFloodFill( const struct FloodFill_params *params )
if (X11DRV_SetupGCForBrush( dc ))
{
/* ROP mode is always GXcopy for flood-fill */
XSetFunction( display, dc->u.x.gc, GXcopy );
XSetFunction( display, physDev->gc, GXcopy );
X11DRV_InternalFloodFill(image, dc,
XLPTODP(dc,params->x) + dc->w.DCOrgX - rect.left,
YLPTODP(dc,params->y) + dc->w.DCOrgY - rect.top,
@ -1293,8 +1312,10 @@ static BOOL32 BezierCheck( int level, POINT32 *Points)
static void X11DRV_Bezier(int level, DC * dc, POINT32 *Points,
XPoint* xpoints, unsigned int* pIx)
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if(*pIx == BEZMAXPOINTS){
TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLines( display, physDev->drawable, physDev->gc,
xpoints, *pIx, CoordModeOrigin );
*pIx=0;
}
@ -1343,6 +1364,8 @@ X11DRV_PolyBezier(DC *dc, POINT32 start, const POINT32* BezierPoints, DWORD coun
int i;
unsigned int ix=0;
XPoint* xpoints;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TRACE(graphics, "dc=%04x count=%ld %d,%d - %d,%d - %d,%d -%d,%d \n",
(int)dc, count,
start.x, start.y,
@ -1366,8 +1389,8 @@ X11DRV_PolyBezier(DC *dc, POINT32 start, const POINT32* BezierPoints, DWORD coun
X11DRV_Bezier(BEZIERMAXDEPTH , dc, Points, xpoints, &ix );
count -=3;
}
if( ix) TSXDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
xpoints, ix, CoordModeOrigin );
if( ix) TSXDrawLines( display, physDev->drawable, physDev->gc,
xpoints, ix, CoordModeOrigin );
free(xpoints);
return TRUE;
}

View file

@ -8,7 +8,8 @@
#include "x11drv.h"
#include "color.h"
#include "bitmap.h"
#include "winnt.h"
#include "debug.h"
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
@ -170,10 +171,13 @@ static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
{
X11DRV_PDEVICE *physDev;
physDev = &dc->u.x; /* for now */
dc->physDev = physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*physDev) );
if(!physDev) {
ERR(x11drv, "Can't allocate physDev\n");
return FALSE;
}
memset( physDev, 0, sizeof(*physDev) );
dc->physDev = physDev;
dc->w.devCaps = &X11DRV_DevCaps;
if (dc->w.flags & DC_MEMORY)
{
@ -227,6 +231,8 @@ static BOOL32 X11DRV_DeleteDC( DC *dc )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TSXFreeGC( display, physDev->gc );
HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL;
return TRUE;
}

View file

@ -1,5 +1,5 @@
/*
* GDI pen objects
* X11DRV pen objects
*
* Copyright 1993 Alexandre Julliard
*/
@ -20,40 +20,41 @@ static const char PEN_alternate[] = { 1,1 }; /* FIXME */
HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
HPEN32 prevHandle = dc->w.hPen;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
dc->u.x.pen.type = pen->logpen.lopnStyle & PS_TYPE_MASK;
dc->u.x.pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
dc->u.x.pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
physDev->pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
physDev->pen.type = pen->logpen.lopnStyle & PS_TYPE_MASK;
physDev->pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
physDev->pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
dc->u.x.pen.width = (pen->logpen.lopnWidth.x * dc->vportExtX +
physDev->pen.width = (pen->logpen.lopnWidth.x * dc->vportExtX +
dc->wndExtX / 2) / dc->wndExtX;
if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
physDev->pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
{
case PS_DASH:
dc->u.x.pen.dashes = (char *)PEN_dash;
dc->u.x.pen.dash_len = 2;
physDev->pen.dashes = (char *)PEN_dash;
physDev->pen.dash_len = 2;
break;
case PS_DOT:
dc->u.x.pen.dashes = (char *)PEN_dot;
dc->u.x.pen.dash_len = 2;
physDev->pen.dashes = (char *)PEN_dot;
physDev->pen.dash_len = 2;
break;
case PS_DASHDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdot;
dc->u.x.pen.dash_len = 4;
physDev->pen.dashes = (char *)PEN_dashdot;
physDev->pen.dash_len = 4;
break;
case PS_DASHDOTDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
dc->u.x.pen.dash_len = 6;
physDev->pen.dashes = (char *)PEN_dashdotdot;
physDev->pen.dash_len = 6;
break;
case PS_ALTERNATE:
/* FIXME: should be alternating _pixels_ that are set */
dc->u.x.pen.dashes = (char *)PEN_alternate;
dc->u.x.pen.dash_len = 2;
physDev->pen.dashes = (char *)PEN_alternate;
physDev->pen.dash_len = 2;
break;
case PS_USERSTYLE:
/* FIXME */

View file

@ -35,10 +35,11 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
RECT32 rect;
char dfBreakChar, lfUnderline, lfStrikeOut;
BOOL32 rotated = FALSE;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!X11DRV_SetupGCForText( dc )) return TRUE;
pfo = XFONT_GetFontObject( dc->u.x.font );
pfo = XFONT_GetFontObject( physDev->font );
font = pfo->fs;
if (pfo->lf.lfEscapement && pfo->lpX11Trans)
@ -48,7 +49,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
lfStrikeOut = (pfo->fo_flags & FO_SYNTH_STRIKEOUT) ? 1 : 0;
TRACE(text,"hdc=%04x df=%04x %d,%d %s, %d flags=%d lpDx=%p\n",
dc->hSelf, (UINT16)(dc->u.x.font), x, y,
dc->hSelf, (UINT16)(physDev->font), x, y,
debugstr_an (str, count), count, flags, lpDx);
/* some strings sent here end in a newline for whatever reason. I have no
@ -102,8 +103,8 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
if (flags & ETO_OPAQUE)
{
TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXSetForeground( display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + rect.left, dc->w.DCOrgY + rect.top,
rect.right-rect.left, rect.bottom-rect.top );
}
@ -195,8 +196,9 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
(y - ascent < rect.top) ||
(y + descent >= rect.bottom))
{
TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXSetForeground( display, physDev->gc,
physDev->backgroundPixel );
TSXFillRectangle( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + x,
dc->w.DCOrgY + y - ascent,
width,
@ -207,12 +209,12 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
/* Draw the text (count > 0 verified) */
TSXSetForeground( display, dc->u.x.gc, dc->u.x.textPixel );
TSXSetForeground( display, physDev->gc, physDev->textPixel );
if (!dc->w.charExtra && !dc->w.breakExtra && !lpDx)
{
if(!rotated)
{
TSXDrawString( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawString( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y, str, count );
}
else
@ -229,7 +231,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
int y_i = IROUND((double) (dc->w.DCOrgY + y) - offset *
pfo->lpX11Trans->b / 1000.0 );
TSXDrawString( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawString( display, physDev->drawable, physDev->gc,
x_i, y_i, &str[i], 1);
offset += (double) (font->per_char ?
font->per_char[char_metric_offset].attributes:
@ -293,7 +295,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
}
}
TSXDrawText( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawText( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y, items, pitem - items );
HeapFree( GetProcessHeap(), 0, items );
}
@ -309,11 +311,11 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
if (!TSXGetFontProperty( font, XA_UNDERLINE_THICKNESS, &lineWidth ))
lineWidth = 0;
else if (lineWidth == 1) lineWidth = 0;
TSXSetLineAttributes( display, dc->u.x.gc, lineWidth,
LineSolid, CapRound, JoinBevel );
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y + linePos,
dc->w.DCOrgX + x + width, dc->w.DCOrgY + y + linePos );
TSXSetLineAttributes( display, physDev->gc, lineWidth,
LineSolid, CapRound, JoinBevel );
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y + linePos,
dc->w.DCOrgX + x + width, dc->w.DCOrgY + y + linePos );
}
if (lfStrikeOut)
{
@ -322,9 +324,9 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
lineAscent = ascent / 2;
if (!TSXGetFontProperty( font, XA_STRIKEOUT_DESCENT, &lineDescent ))
lineDescent = -lineAscent * 2 / 3;
TSXSetLineAttributes( display, dc->u.x.gc, lineAscent + lineDescent,
TSXSetLineAttributes( display, physDev->gc, lineAscent + lineDescent,
LineSolid, CapRound, JoinBevel );
TSXDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawLine( display, physDev->drawable, physDev->gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y - lineAscent,
dc->w.DCOrgX + x + width, dc->w.DCOrgY + y - lineAscent );
}

View file

@ -2206,16 +2206,17 @@ HFONT32 X11DRV_FONT_SelectObject( DC* dc, HFONT32 hfont, FONTOBJ* font )
{
HFONT32 hPrevFont = 0;
LOGFONT16 lf;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( CHECK_PFONT(dc->u.x.font) )
XFONT_ReleaseCacheEntry( __PFONT(dc->u.x.font) );
if( CHECK_PFONT(physDev->font) )
XFONT_ReleaseCacheEntry( __PFONT(physDev->font) );
/* FIXME: do we need to pass anything back from here? */
memcpy(&lf,&font->logfont,sizeof(lf));
lf.lfWidth = font->logfont.lfWidth * dc->vportExtX/dc->wndExtX;
lf.lfHeight = font->logfont.lfHeight* dc->vportExtY/dc->wndExtY;
dc->u.x.font = XFONT_RealizeFont( &lf );
physDev->font = XFONT_RealizeFont( &lf );
hPrevFont = dc->w.hFont;
dc->w.hFont = hfont;
@ -2268,7 +2269,8 @@ BOOL32 X11DRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf,
BOOL32 X11DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
LPSIZE32 size )
{
fontObject* pfo = XFONT_GetFontObject( dc->u.x.font );
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
fontObject* pfo = XFONT_GetFontObject( physDev->font );
if( pfo ) {
if( !pfo->lpX11Trans ) {
int dir, ascent, descent;
@ -2307,9 +2309,11 @@ BOOL32 X11DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
*/
BOOL32 X11DRV_GetTextMetrics(DC *dc, TEXTMETRIC32A *metrics)
{
if( CHECK_PFONT(dc->u.x.font) )
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( CHECK_PFONT(physDev->font) )
{
fontObject* pfo = __PFONT(dc->u.x.font);
fontObject* pfo = __PFONT(physDev->font);
XFONT_GetTextMetric( pfo, metrics );
return TRUE;
@ -2324,7 +2328,8 @@ BOOL32 X11DRV_GetTextMetrics(DC *dc, TEXTMETRIC32A *metrics)
BOOL32 X11DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer )
{
fontObject* pfo = XFONT_GetFontObject( dc->u.x.font );
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
fontObject* pfo = XFONT_GetFontObject( physDev->font );
if( pfo )
{

View file

@ -8,6 +8,8 @@
#define __WINE_BITMAP_H
#include "gdi.h"
#include "ts_xlib.h"
#include "ts_xutil.h"
/* Additional info for DIB section objects */
typedef struct

View file

@ -3,6 +3,7 @@
#include "palette.h"
#include "gdi.h"
#include "x11drv.h"
#define COLOR_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
#define COLOR_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */

View file

@ -10,7 +10,6 @@
#include "windows.h"
#include "ldt.h"
#include "local.h"
#include "x11drv.h"
#include "path.h"
#include <math.h>
@ -139,8 +138,6 @@ typedef struct
BOOL32 vport2WorldValid; /* Is xformVport2World valid? */
} WIN_DC_INFO;
typedef X11DRV_PDEVICE X_DC_INFO; /* Temporary */
typedef struct tagDC
{
GDIOBJHDR header;
@ -161,14 +158,12 @@ typedef struct tagDC
INT32 vportExtY;
WIN_DC_INFO w;
union
{
X_DC_INFO x;
/* other devices (e.g. printer) */
} u;
} DC;
/* Device functions for the Wine driver interface */
typedef INT32 (*DEVICEFONTENUMPROC)(LPENUMLOGFONT16,LPNEWTEXTMETRIC16,UINT16,LPARAM);
typedef struct tagDC_FUNCS
{
BOOL32 (*pArc)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
@ -432,11 +427,4 @@ extern BOOL32 DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs );
extern const DC_FUNCTIONS *DRIVER_FindDriver( LPCSTR name );
extern BOOL32 DRIVER_UnregisterDriver( LPCSTR name );
extern BOOL32 DIB_Init(void);
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
#endif /* __WINE_GDI_H */

View file

@ -9,6 +9,7 @@
#include "ts_xutil.h"
#include "winbase.h"
#include "windows.h"
#include "gdi.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
/* X physical pen */
@ -59,7 +60,6 @@ extern GC BITMAP_monoGC, BITMAP_colorGC;
#define BITMAP_GC(bmp) \
(((bmp)->bitmap.bmBitsPixel == 1) ? BITMAP_monoGC : BITMAP_colorGC)
typedef INT32 (*DEVICEFONTENUMPROC)(LPENUMLOGFONT16,LPNEWTEXTMETRIC16,UINT16,LPARAM);
/* Wine driver X11 functions */
@ -158,6 +158,12 @@ extern BOOL32 X11DRV_SetupGCForText( struct tagDC *dc );
extern const int X11DRV_XROPfunction[];
extern Display * display;
extern Screen * screen;
extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
/* Xlib critical section */
extern CRITICAL_SECTION X11DRV_CritSection;

View file

@ -8,7 +8,7 @@
#define __WINE_X11FONT_H
#include "gdi.h"
#include "x11drv.h"
#pragma pack(1)
/* this is a part of the font resource header, should

View file

@ -34,6 +34,7 @@
#include "xmalloc.h"
#include "version.h"
#include "winnls.h"
#include "x11drv.h"
/* when adding new languages look at ole/ole2nls.c
* for proper iso name and Windows code (add 0x0400

View file

@ -16,7 +16,7 @@
#include "cursoricon.h"
#include "color.h"
#include "debug.h"
#include "x11drv.h"
/***********************************************************************
* BITMAP_GetPadding

View file

@ -14,6 +14,7 @@
#include "color.h"
#include "debug.h"
#include "xmalloc.h"
#include "x11drv.h"
/* Palette indexed mode:

View file

@ -14,7 +14,7 @@
#include "debug.h"
#include "font.h"
#include "winerror.h"
#include "x11drv.h"
/***********************************************************************
* DC_Init_DC_INFO
@ -221,7 +221,6 @@ HDC16 WINAPI GetDCState( HDC16 hdc )
TRACE(dc, "(%04x): returning %04x\n", hdc, handle );
memset( &newdc->u.x, 0, sizeof(newdc->u.x) );
newdc->w.flags = dc->w.flags | DC_SAVED;
newdc->w.devCaps = dc->w.devCaps;
newdc->w.hPen = dc->w.hPen;
@ -854,15 +853,18 @@ UINT32 WINAPI SetTextAlign32( HDC32 hdc, UINT32 textAlign )
BOOL32 WINAPI GetDCOrgEx( HDC32 hDC, LPPOINT32 lpp )
{
DC * dc;
X11DRV_PDEVICE *physDev;
if (!lpp) return FALSE;
if (!(dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC ))) return FALSE;
physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!(dc->w.flags & DC_MEMORY))
{
Window root;
int w, h, border, depth;
/* FIXME: this is not correct for managed windows */
TSXGetGeometry( display, dc->u.x.drawable, &root,
TSXGetGeometry( display, physDev->drawable, &root,
&lpp->x, &lpp->y, &w, &h, &border, &depth );
}
else lpp->x = lpp->y = 0;

View file

@ -16,7 +16,7 @@
#include "region.h"
#include "debug.h"
#include "gdi.h"
#include "x11drv.h"
/***********************************************************************
* GDI stock objects

View file

@ -26,6 +26,7 @@
#include "heap.h"
#include "sysmetrics.h"
#include "debug.h"
#include "x11drv.h"
#define NB_DCE 5 /* Number of DCEs created at startup */
@ -522,12 +523,14 @@ static void DCE_OffsetVisRgn( HDC32 hDC, HRGN32 hVisRgn )
*/
static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags, BOOL32 bSetClipOrigin )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!wndPtr) /* Get a DC for the whole screen */
{
dc->w.DCOrgX = 0;
dc->w.DCOrgY = 0;
dc->u.x.drawable = rootWindow;
TSXSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors );
physDev->drawable = rootWindow;
TSXSetSubwindowMode( display, physDev->gc, IncludeInferiors );
}
else
{
@ -549,7 +552,7 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags, BOOL32 bSetClipOri
}
dc->w.DCOrgX -= wndPtr->rectWindow.left;
dc->w.DCOrgY -= wndPtr->rectWindow.top;
dc->u.x.drawable = wndPtr->window;
physDev->drawable = wndPtr->window;
#if 0
/* This is needed when we reuse a cached DC because
@ -558,7 +561,7 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags, BOOL32 bSetClipOri
*/
if( bSetClipOrigin )
TSXSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX, dc->w.DCOrgY );
#endif
}
}

View file

@ -20,6 +20,7 @@
#include "heap.h"
#include "debug.h"
#include "debugtools.h"
#include "x11drv.h"
Cursor DISPLAY_XCursor = None; /* Current X cursor */

View file

@ -41,7 +41,7 @@
#include "dde_proc.h"
#include "winsock.h"
#include "mouse.h"
#include "x11drv.h"
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */

View file

@ -15,6 +15,7 @@
#include "bitmap.h"
#include "gdi.h"
#include "dc.h"
#include "x11drv.h"
#define MAX_DRAWLINES 8
@ -33,6 +34,7 @@ BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen )
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( X11DRV_SetupGCForPen( dc ) )
@ -48,7 +50,7 @@ BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen )
l[i].y1 = pXY[j].y + dc->w.DCOrgY;
l[i].y2 = pXY[j + 1].y + dc->w.DCOrgY;
}
TSXDrawSegments( display, dc->u.x.drawable, dc->u.x.gc, l, N );
TSXDrawSegments( display, physDev->drawable, physDev->gc, l, N );
bRet = TRUE;
}
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
@ -72,6 +74,7 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
DC *dc;
BOOL32 ret = TRUE;
X11DRV_PHYSBITMAP *pbitmap;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
@ -79,6 +82,7 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
GDI_HEAP_UNLOCK( hdc );
return FALSE;
}
physDev = (X11DRV_PDEVICE *)dc->physDev;
/* HACK for now */
if(!bmp->DDBitmap)
@ -87,12 +91,12 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
xdest += dc->w.DCOrgX; ydest += dc->w.DCOrgY;
TSXSetFunction( display, dc->u.x.gc, GXcopy );
TSXSetFunction( display, physDev->gc, GXcopy );
if (bmp->bitmap.bmBitsPixel == 1)
{
TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel );
TSXSetBackground( display, dc->u.x.gc, dc->u.x.textPixel );
TSXCopyPlane( display, pbitmap->pixmap, dc->u.x.drawable, dc->u.x.gc,
TSXSetForeground( display, physDev->gc, physDev->backgroundPixel );
TSXSetBackground( display, physDev->gc, physDev->textPixel );
TSXCopyPlane( display, pbitmap->pixmap, physDev->drawable, physDev->gc,
xsrc, ysrc, width, height, xdest, ydest, 1 );
}
else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
@ -103,21 +107,25 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
if( COLOR_GetMonoPlane(&plane) )
{
TSXSetForeground(display, dc->u.x.gc, dc->u.x.backgroundPixel);
TSXSetBackground(display, dc->u.x.gc, dc->u.x.textPixel);
TSXSetForeground( display, physDev->gc,
physDev->backgroundPixel );
TSXSetBackground( display, physDev->gc, physDev->textPixel );
}
else
{
TSXSetForeground(display, dc->u.x.gc, dc->u.x.textPixel);
TSXSetBackground(display, dc->u.x.gc, dc->u.x.backgroundPixel);
TSXSetForeground( display, physDev->gc, physDev->textPixel );
TSXSetBackground( display, physDev->gc,
physDev->backgroundPixel );
}
TSXCopyPlane( display, pbitmap->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height, xdest, ydest, plane );
TSXCopyPlane( display, pbitmap->pixmap, physDev->drawable,
physDev->gc, xsrc, ysrc, width, height, xdest, ydest,
plane );
}
else
{
TSXCopyArea( display, pbitmap->pixmap, dc->u.x.drawable,
dc->u.x.gc, xsrc, ysrc, width, height, xdest, ydest );
TSXCopyArea( display, pbitmap->pixmap, physDev->drawable,
physDev->gc, xsrc, ysrc, width, height, xdest,
ydest );
}
}
else
@ -170,9 +178,10 @@ void GRAPH_DrawGenericReliefRect(
HBRUSH32 hPrevBrush;
INT32 w, h;
RECT32 r = *rect;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
physDev = (X11DRV_PDEVICE *)dc->physDev;
OffsetRect32( &r, dc->w.DCOrgX, dc->w.DCOrgY);
h = rect->bottom - rect->top; w = rect->right - rect->left;
@ -182,12 +191,12 @@ void GRAPH_DrawGenericReliefRect(
{
INT32 i;
TSXSetFunction( display, dc->u.x.gc, GXcopy );
TSXSetFunction( display, physDev->gc, GXcopy );
for (i = 0; i < highlight_size; i++)
{
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left + i, r.top, 1, h - i );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left, r.top + i, w - i, 1 );
}
}
@ -197,12 +206,12 @@ void GRAPH_DrawGenericReliefRect(
{
INT32 i;
TSXSetFunction( display, dc->u.x.gc, GXcopy );
TSXSetFunction( display, physDev->gc, GXcopy );
for (i = 0; i < shadow_size; i++)
{
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.right - i - 1, r.top + i, 1, h - i );
TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXFillRectangle( display, physDev->drawable, physDev->gc,
r.left + i, r.bottom - i - 1, w - i, 1 );
}
}
@ -224,10 +233,11 @@ void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( X11DRV_SetupGCForPen( dc ) )
TSXDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
TSXDrawRectangle( display, physDev->drawable, physDev->gc,
x + dc->w.DCOrgX, y + dc->w.DCOrgY, w - 1, h - 1);
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
GDI_HEAP_UNLOCK( hdc );
@ -242,8 +252,10 @@ BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMonoBitmap, INT32 x, INT32 y)
BITMAPOBJ *bmp = NULL;
DC *dc;
X11DRV_PHYSBITMAP *pbitmap = NULL;
X11DRV_PDEVICE *physDev;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
physDev = (X11DRV_PDEVICE *)dc->physDev;
if ( hMonoBitmap )
{
if ( !(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hMonoBitmap, BITMAP_MAGIC))
@ -257,10 +269,11 @@ BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMonoBitmap, INT32 x, INT32 y)
if(!bmp->DDBitmap)
X11DRV_CreateBitmap( hMonoBitmap );
pbitmap = bmp->DDBitmap->physBitmap;
TSXSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX + x, dc->w.DCOrgY + y);
TSXSetClipOrigin( display, physDev->gc, dc->w.DCOrgX + x,
dc->w.DCOrgY + y );
}
TSXSetClipMask( display, dc->u.x.gc, (bmp) ? pbitmap->pixmap : None );
TSXSetClipMask( display, physDev->gc, (bmp) ? pbitmap->pixmap : None );
GDI_HEAP_UNLOCK( hdc );
GDI_HEAP_UNLOCK( hMonoBitmap );

View file

@ -26,6 +26,7 @@
#include "debugtools.h"
#include "struct32.h"
#include "winerror.h"
#include "x11drv.h"
static INT16 captureHT = HTCLIENT;
static HWND32 captureWnd = 0;

View file

@ -11,7 +11,7 @@
#include "mouse.h"
#include "debug.h"
#include "debugtools.h"
#include "x11drv.h"
static LPMOUSE_EVENT_PROC DefMouseEventProc = NULL;

View file

@ -18,7 +18,7 @@
#include "graphics.h"
#include "sysmetrics.h"
#include "debug.h"
#include "x11drv.h"
/*************************************************************************
* ScrollWindow16 (USER.61)
@ -346,6 +346,7 @@ rect?rect->left:0, rect?rect->top:0, rect ?rect->right:0, rect ?rect->bottom:0,
((flags & SW_SCROLLCHILDREN) ? DCX_NOCLIPCHILDREN : 0) );
if( (dc = (DC *)GDI_GetObjPtr(hDC, DC_MAGIC)) )
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
POINT32 dst, src;
if( dx > 0 ) dst.x = (src.x = dc->w.DCOrgX + cliprc.left) + dx;
@ -358,13 +359,15 @@ rect?rect->left:0, rect?rect->top:0, rect ?rect->right:0, rect ?rect->bottom:0,
(cliprc.bottom - cliprc.top > abs(dy)))
{
if (bUpdate) /* handles non-Wine windows hanging over the scrolled area */
TSXSetGraphicsExposures( display, dc->u.x.gc, True );
TSXSetFunction( display, dc->u.x.gc, GXcopy );
TSXCopyArea( display, dc->u.x.drawable, dc->u.x.drawable, dc->u.x.gc,
src.x, src.y, cliprc.right - cliprc.left - abs(dx),
cliprc.bottom - cliprc.top - abs(dy), dst.x, dst.y );
TSXSetGraphicsExposures( display, physDev->gc, True );
TSXSetFunction( display, physDev->gc, GXcopy );
TSXCopyArea( display, physDev->drawable, physDev->drawable,
physDev->gc, src.x, src.y,
cliprc.right - cliprc.left - abs(dx),
cliprc.bottom - cliprc.top - abs(dy),
dst.x, dst.y );
if (bUpdate)
TSXSetGraphicsExposures( display, dc->u.x.gc, False );
TSXSetGraphicsExposures( display, physDev->gc, False );
}
if( dc->w.hVisRgn && bUpdate )

View file

@ -10,6 +10,7 @@
#include "options.h"
#include "tweak.h"
#include "sysmetrics.h"
#include "x11drv.h"
short sysMetrics[SM_CMETRICS+1];

View file

@ -25,6 +25,7 @@
#include "queue.h"
#include "shell.h"
#include "callback.h"
#include "x11drv.h"
/***********************************************************************
* GetFreeSystemResources (USER.284)