Commit d3cab185 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved DC origin into device-specific structure.

Fixed handling of DC origin in X11 driver.
parent d2e22f93
...@@ -143,6 +143,7 @@ static struct graphics_driver *create_driver( HMODULE module ) ...@@ -143,6 +143,7 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(SetBitmapBits); GET_FUNC(SetBitmapBits);
GET_FUNC(SetBkColor); GET_FUNC(SetBkColor);
GET_FUNC(SetBkMode); GET_FUNC(SetBkMode);
GET_FUNC(SetDCOrg);
GET_FUNC(SetDIBColorTable); GET_FUNC(SetDIBColorTable);
GET_FUNC(SetDIBits); GET_FUNC(SetDIBits);
GET_FUNC(SetDIBitsToDevice); GET_FUNC(SetDIBitsToDevice);
......
...@@ -111,6 +111,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -111,6 +111,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
EMFDRV_SetBkColor, /* pSetBkColor */ EMFDRV_SetBkColor, /* pSetBkColor */
EMFDRV_SetBkMode, /* pSetBkMode */ EMFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */ NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */ NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */
......
...@@ -111,6 +111,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = ...@@ -111,6 +111,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
MFDRV_SetBkColor, /* pSetBkColor */ MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBkMode, /* pSetBkMode */ MFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */ NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */ NULL, /* pSetDIBits */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
......
...@@ -36,10 +36,10 @@ WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y ) ...@@ -36,10 +36,10 @@ WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
DC *dc = physDev->dc; DC *dc = physDev->dc;
POINT16 points[2]; POINT16 points[2];
points[0].x = dc->DCOrgX + XLPTODP( dc, dc->CursPosX ); points[0].x = physDev->org.x + XLPTODP( dc, dc->CursPosX );
points[0].y = dc->DCOrgY + YLPTODP( dc, dc->CursPosY ); points[0].y = physDev->org.y + YLPTODP( dc, dc->CursPosY );
points[1].x = dc->DCOrgX + XLPTODP( dc, x ); points[1].x = physDev->org.x + XLPTODP( dc, x );
points[1].y = dc->DCOrgY + YLPTODP( dc, y ); points[1].y = physDev->org.y + YLPTODP( dc, y );
bRet = PRTDRV_Output(physDev->segptrPDEVICE, bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_POLYLINE, 2, points, OS_POLYLINE, 2, points,
physDev->PenInfo, physDev->PenInfo,
...@@ -63,8 +63,8 @@ WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom) ...@@ -63,8 +63,8 @@ WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0; BOOL bRet = 0;
POINT16 points[2]; POINT16 points[2];
TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n", TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %ld y %ld\n",
left, top, dc->DCOrgX, dc->DCOrgY); left, top, physDev->org.x, physDev->org.y);
TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n", TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
dc->vportOrgX, dc->vportOrgY); dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left); points[0].x = XLPTODP(dc, left);
...@@ -163,7 +163,8 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom) ...@@ -163,7 +163,8 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0; BOOL bRet = 0;
POINT16 points[2]; POINT16 points[2];
TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n", left, top, dc->DCOrgX, dc->DCOrgY); TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %ld y %ld\n",
left, top, physDev->org.x, physDev->org.y);
TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY); TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left); points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top); points[0].y = YLPTODP(dc, top);
...@@ -178,11 +179,3 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom) ...@@ -178,11 +179,3 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
win16drv_SegPtr_DrawMode, dc->hClipRgn); win16drv_SegPtr_DrawMode, dc->hClipRgn);
return bRet; return bRet;
} }
...@@ -50,7 +50,7 @@ SEGPTR win16drv_SegPtr_DrawMode; ...@@ -50,7 +50,7 @@ SEGPTR win16drv_SegPtr_DrawMode;
LPDRAWMODE win16drv_DrawModeP; LPDRAWMODE win16drv_DrawModeP;
static BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, static BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData ); LPCSTR output, const DEVMODEA* initData );
static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap ); static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap );
static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data, static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
...@@ -139,6 +139,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = ...@@ -139,6 +139,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */ NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */ NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */
...@@ -240,8 +241,8 @@ void InitDrawMode(LPDRAWMODE lpDrawMode) ...@@ -240,8 +241,8 @@ void InitDrawMode(LPDRAWMODE lpDrawMode)
lpDrawMode->eMiterLimit = 1; lpDrawMode->eMiterLimit = 1;
} }
BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device, LPCSTR output,
const DEVMODEA* initData ) const DEVMODEA* initData )
{ {
LOADED_PRINTER_DRIVER *pLPD; LOADED_PRINTER_DRIVER *pLPD;
WORD wRet; WORD wRet;
...@@ -254,9 +255,10 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, ...@@ -254,9 +255,10 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) ); physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
dc->physDev = (PHYSDEV)physDev; *pdev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf; physDev->hdc = dc->hSelf;
physDev->dc = dc; physDev->dc = dc;
physDev->org.x = physDev->org.y = 0;
pLPD = LoadPrinterDriver(driver); pLPD = LoadPrinterDriver(driver);
if (pLPD == NULL) if (pLPD == NULL)
......
...@@ -207,6 +207,7 @@ typedef struct ...@@ -207,6 +207,7 @@ typedef struct
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */ LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */
HDC hdc; HDC hdc;
DC *dc; DC *dc;
POINT org; /* Device origin */
DeviceCaps DevCaps; /* Device caps */ DeviceCaps DevCaps; /* Device caps */
} WIN16DRV_PDEVICE; } WIN16DRV_PDEVICE;
...@@ -300,4 +301,3 @@ extern SEGPTR win16drv_SegPtr_DrawMode; ...@@ -300,4 +301,3 @@ extern SEGPTR win16drv_SegPtr_DrawMode;
extern LPDRAWMODE win16drv_DrawModeP; extern LPDRAWMODE win16drv_DrawModeP;
#endif /* __WINE_WIN16DRV_H */ #endif /* __WINE_WIN16DRV_H */
...@@ -39,7 +39,7 @@ BOOL TTYDRV_GDI_Initialize(void) ...@@ -39,7 +39,7 @@ BOOL TTYDRV_GDI_Initialize(void)
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_CreateDC * TTYDRV_DC_CreateDC
*/ */
BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, BOOL TTYDRV_DC_CreateDC(DC *dc, TTYDRV_PDEVICE **pdev, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA *initData) LPCSTR output, const DEVMODEA *initData)
{ {
TTYDRV_PDEVICE *physDev; TTYDRV_PDEVICE *physDev;
...@@ -48,15 +48,14 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, ...@@ -48,15 +48,14 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
dc, debugstr_a(driver), debugstr_a(device), dc, debugstr_a(driver), debugstr_a(device),
debugstr_a(output), initData); debugstr_a(output), initData);
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
sizeof(TTYDRV_PDEVICE)); if(!physDev) {
if(!dc->physDev) {
ERR("Can't allocate physDev\n"); ERR("Can't allocate physDev\n");
return FALSE; return FALSE;
} }
physDev = (TTYDRV_PDEVICE *) dc->physDev; *pdev = physDev;
physDev->hdc = dc->hSelf; physDev->hdc = dc->hSelf;
physDev->dc = dc; physDev->org.x = physDev->org.y = 0;
if(dc->flags & DC_MEMORY){ if(dc->flags & DC_MEMORY){
physDev->window = NULL; physDev->window = NULL;
...@@ -80,7 +79,6 @@ BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev) ...@@ -80,7 +79,6 @@ BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
{ {
TRACE("(%x)\n", physDev->hdc); TRACE("(%x)\n", physDev->hdc);
physDev->dc->physDev = NULL;
HeapFree( GetProcessHeap(), 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
return TRUE; return TRUE;
} }
...@@ -167,3 +165,25 @@ INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap ) ...@@ -167,3 +165,25 @@ INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
return 0; return 0;
} }
} }
/***********************************************************************
* GetDCOrgEx (TTYDRV.@)
*/
BOOL TTYDRV_GetDCOrgEx( TTYDRV_PDEVICE *physDev, LPPOINT pt )
{
*pt = physDev->org;
return TRUE;
}
/***********************************************************************
* SetDCOrg (TTYDRV.@)
*/
DWORD TTYDRV_SetDCOrg( TTYDRV_PDEVICE *physDev, INT x, INT y )
{
DWORD ret = MAKELONG( physDev->org.x, physDev->org.y );
physDev->org.x = x;
physDev->org.y = y;
return ret;
}
...@@ -84,17 +84,22 @@ BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y) ...@@ -84,17 +84,22 @@ BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y)
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
INT row1, col1, row2, col2; INT row1, col1, row2, col2;
DC *dc = physDev->dc; POINT pt[2];
TRACE("(%x, %d, %d)\n", physDev->hdc, x, y); TRACE("(%x, %d, %d)\n", physDev->hdc, x, y);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
row1 = (dc->DCOrgY + XLPTODP(dc, dc->CursPosY)) / physDev->cellHeight; GetCurrentPositionEx( physDev->hdc, &pt[0] );
col1 = (dc->DCOrgX + XLPTODP(dc, dc->CursPosX)) / physDev->cellWidth; pt[1].x = x;
row2 = (dc->DCOrgY + XLPTODP(dc, y)) / physDev->cellHeight; pt[1].y = y;
col2 = (dc->DCOrgX + XLPTODP(dc, x)) / physDev->cellWidth; LPtoDP( physDev->hdc, pt, 2 );
row1 = (physDev->org.y + pt[0].y) / physDev->cellHeight;
col1 = (physDev->org.x + pt[0].x) / physDev->cellWidth;
row2 = (physDev->org.y + pt[1].y) / physDev->cellHeight;
col2 = (physDev->org.x + pt[1].x) / physDev->cellWidth;
if(row1 > row2) { if(row1 > row2) {
INT tmp = row1; INT tmp = row1;
...@@ -190,17 +195,22 @@ BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, ...@@ -190,17 +195,22 @@ BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right,
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
INT row1, col1, row2, col2; INT row1, col1, row2, col2;
DC *dc = physDev->dc; RECT rect;
TRACE("(%x, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom); TRACE("(%x, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
row1 = (dc->DCOrgY + XLPTODP(dc, top)) / physDev->cellHeight; rect.left = left;
col1 = (dc->DCOrgX + XLPTODP(dc, left)) / physDev->cellWidth; rect.top = top;
row2 = (dc->DCOrgY + XLPTODP(dc, bottom)) / physDev->cellHeight; rect.right = right;
col2 = (dc->DCOrgX + XLPTODP(dc, right)) / physDev->cellWidth; rect.bottom = bottom;
LPtoDP( physDev->hdc, (POINT *)&rect, 2 );
row1 = (physDev->org.y + rect.top) / physDev->cellHeight;
col1 = (physDev->org.x + rect.left) / physDev->cellWidth;
row2 = (physDev->org.y + rect.bottom) / physDev->cellHeight;
col2 = (physDev->org.x + rect.right) / physDev->cellWidth;
if(row1 > row2) { if(row1 > row2) {
INT tmp = row1; INT tmp = row1;
...@@ -259,15 +269,18 @@ COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF colo ...@@ -259,15 +269,18 @@ COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF colo
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
INT row, col; INT row, col;
DC *dc = physDev->dc; POINT pt;
TRACE("(%x, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color); TRACE("(%x, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
row = (dc->DCOrgY + XLPTODP(dc, y)) / physDev->cellHeight; pt.x = x;
col = (dc->DCOrgX + XLPTODP(dc, x)) / physDev->cellWidth; pt.y = y;
LPtoDP( physDev->hdc, &pt, 1 );
row = (physDev->org.y + pt.y) / physDev->cellHeight;
col = (physDev->org.x + pt.x) / physDev->cellWidth;
mvwaddch(physDev->window, row, col, ACS_BULLET); mvwaddch(physDev->window, row, col, ACS_BULLET);
wrefresh(physDev->window); wrefresh(physDev->window);
...@@ -328,7 +341,8 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -328,7 +341,8 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
INT row, col; INT row, col;
LPSTR ascii; LPSTR ascii;
DWORD len; DWORD len;
DC *dc = physDev->dc; POINT pt;
UINT text_align = GetTextAlign( physDev->hdc );
TRACE("(%x, %d, %d, 0x%08x, %p, %s, %d, %p)\n", TRACE("(%x, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
physDev->hdc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx); physDev->hdc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
...@@ -336,17 +350,14 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -336,17 +350,14 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
pt.x = x;
pt.y = y;
/* FIXME: Is this really correct? */ /* FIXME: Is this really correct? */
if(dc->textAlign & TA_UPDATECP) { if(text_align & TA_UPDATECP) GetCurrentPositionEx( physDev->hdc, &pt );
x = dc->CursPosX;
y = dc->CursPosY;
}
x = XLPTODP(dc, x);
y = YLPTODP(dc, y);
row = (dc->DCOrgY + y) / physDev->cellHeight; LPtoDP( physDev->hdc, &pt, 1 );
col = (dc->DCOrgX + x) / physDev->cellWidth; row = (physDev->org.y + pt.y) / physDev->cellHeight;
col = (physDev->org.x + pt.x) / physDev->cellWidth;
len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL );
ascii = HeapAlloc( GetProcessHeap(), 0, len ); ascii = HeapAlloc( GetProcessHeap(), 0, len );
WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL );
...@@ -354,9 +365,12 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -354,9 +365,12 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
HeapFree( GetProcessHeap(), 0, ascii ); HeapFree( GetProcessHeap(), 0, ascii );
wrefresh(physDev->window); wrefresh(physDev->window);
if(dc->textAlign & TA_UPDATECP) { if(text_align & TA_UPDATECP)
dc->CursPosX += count * physDev->cellWidth; {
dc->CursPosY += physDev->cellHeight; pt.x += count * physDev->cellWidth;
pt.y += physDev->cellHeight;
DPtoLP( physDev->hdc, &pt, 1 );
MoveToEx( physDev->hdc, pt.x, pt.y, NULL );
} }
return TRUE; return TRUE;
......
...@@ -61,7 +61,7 @@ typedef struct { int dummy; } WINDOW; ...@@ -61,7 +61,7 @@ typedef struct { int dummy; } WINDOW;
typedef struct { typedef struct {
HDC hdc; HDC hdc;
DC *dc; POINT org;
WINDOW *window; WINDOW *window;
int cellWidth; int cellWidth;
int cellHeight; int cellHeight;
...@@ -76,7 +76,6 @@ extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp); ...@@ -76,7 +76,6 @@ extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
extern BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend); extern BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags); extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags);
extern BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA *initData);
extern BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev); extern BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev);
extern BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT width, INT height, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, DWORD rop); extern BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT width, INT height, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, DWORD rop);
extern BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend); extern BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
......
...@@ -6,13 +6,14 @@ init TTYDRV_Init ...@@ -6,13 +6,14 @@ init TTYDRV_Init
@ cdecl Arc(ptr long long long long long long long long) TTYDRV_DC_Arc @ cdecl Arc(ptr long long long long long long long long) TTYDRV_DC_Arc
@ cdecl BitBlt(ptr long long long long ptr long long long) TTYDRV_DC_BitBlt @ cdecl BitBlt(ptr long long long long ptr long long long) TTYDRV_DC_BitBlt
@ cdecl Chord(ptr long long long long long long long long) TTYDRV_DC_Chord @ cdecl Chord(ptr long long long long long long long long) TTYDRV_DC_Chord
@ cdecl CreateDC(ptr str str str ptr) TTYDRV_DC_CreateDC @ cdecl CreateDC(ptr ptr str str str ptr) TTYDRV_DC_CreateDC
@ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC @ cdecl DeleteDC(ptr) TTYDRV_DC_DeleteDC
@ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse @ cdecl Ellipse(ptr long long long long) TTYDRV_DC_Ellipse
@ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill @ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) TTYDRV_DC_ExtTextOut @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) TTYDRV_DC_ExtTextOut
@ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits @ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits
@ cdecl GetCharWidth(ptr long long ptr) TTYDRV_DC_GetCharWidth @ cdecl GetCharWidth(ptr long long ptr) TTYDRV_DC_GetCharWidth
@ cdecl GetDCOrgEx(ptr ptr) TTYDRV_GetDCOrgEx
@ cdecl GetDeviceCaps(ptr long) TTYDRV_GetDeviceCaps @ cdecl GetDeviceCaps(ptr long) TTYDRV_GetDeviceCaps
@ cdecl GetPixel(ptr long long) TTYDRV_DC_GetPixel @ cdecl GetPixel(ptr long long) TTYDRV_DC_GetPixel
@ cdecl GetSystemPaletteEntries(ptr long long ptr) TTYDRV_GetSystemPaletteEntries @ cdecl GetSystemPaletteEntries(ptr long long ptr) TTYDRV_GetSystemPaletteEntries
...@@ -30,6 +31,7 @@ init TTYDRV_Init ...@@ -30,6 +31,7 @@ init TTYDRV_Init
@ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect @ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect
@ cdecl SelectFont(ptr long) TTYDRV_SelectFont @ cdecl SelectFont(ptr long) TTYDRV_SelectFont
@ cdecl SetBitmapBits(long ptr long) TTYDRV_SetBitmapBits @ cdecl SetBitmapBits(long ptr long) TTYDRV_SetBitmapBits
@ cdecl SetDCOrg(ptr long long) TTYDRV_SetDCOrg
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice
@ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel @ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt @ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt
......
...@@ -45,7 +45,7 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -45,7 +45,7 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
HWND hwndLinkAfter; HWND hwndLinkAfter;
#ifdef WINE_CURSES #ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_GetPtr( hwnd );
WINDOW *window; WINDOW *window;
INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */ INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
...@@ -70,7 +70,7 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -70,7 +70,7 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
} }
wndPtr->pDriverData = window; wndPtr->pDriverData = window;
} }
WIN_ReleaseWndPtr( wndPtr ); WIN_ReleasePtr( wndPtr );
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%x): stub\n", hwnd); FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
...@@ -117,14 +117,14 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode ) ...@@ -117,14 +117,14 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
BOOL TTYDRV_DestroyWindow( HWND hwnd ) BOOL TTYDRV_DestroyWindow( HWND hwnd )
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_GetPtr( hwnd );
WINDOW *window = wndPtr->pDriverData; WINDOW *window = wndPtr->pDriverData;
TRACE("(%x)\n", hwnd); TRACE("(%x)\n", hwnd);
if (window && window != root_window) delwin(window); if (window && window != root_window) delwin(window);
wndPtr->pDriverData = NULL; wndPtr->pDriverData = NULL;
WIN_ReleaseWndPtr( wndPtr ); WIN_ReleasePtr( wndPtr );
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%x): stub\n", hwnd); FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
...@@ -367,8 +367,6 @@ static HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags ) ...@@ -367,8 +367,6 @@ static HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags )
BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
DC *dc;
BOOL updateVisRgn;
HRGN hrgnVisible = 0; HRGN hrgnVisible = 0;
POINT org; POINT org;
...@@ -385,17 +383,9 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -385,17 +383,9 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
org.y = wndPtr->rectClient.top; org.y = wndPtr->rectClient.top;
} }
if (!(dc = DC_GetDCPtr( hdc ))) SetDCOrg16( hdc, org.x, org.y );
{
WIN_ReleaseWndPtr( wndPtr );
return FALSE;
}
dc->DCOrgX = org.x;
dc->DCOrgY = org.y;
updateVisRgn = (dc->flags & DC_DIRTY) != 0;
GDI_ReleaseObj( hdc );
if (updateVisRgn) if (SetHookFlags16( hdc, DCHF_VALIDATEVISRGN )) /* DC was dirty */
{ {
if (flags & DCX_PARENTCLIP) if (flags & DCX_PARENTCLIP)
{ {
...@@ -418,7 +408,6 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -418,7 +408,6 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
else else
OffsetRgn( hrgnVisible, -wndPtr->rectClient.left, OffsetRgn( hrgnVisible, -wndPtr->rectClient.left,
-wndPtr->rectClient.top ); -wndPtr->rectClient.top );
OffsetRgn( hrgnVisible, org.x, org.y );
} }
else else
hrgnVisible = CreateRectRgn( 0, 0, 0, 0 ); hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
...@@ -678,7 +667,6 @@ BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos ) ...@@ -678,7 +667,6 @@ BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos )
*/ */
static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect ) static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
{ {
WND *wndPtr;
UINT swpFlags = 0; UINT swpFlags = 0;
WINDOWPLACEMENT wpl; WINDOWPLACEMENT wpl;
...@@ -691,11 +679,8 @@ static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect ) ...@@ -691,11 +679,8 @@ static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
/* If I glark this right, yields an immutable window*/ /* If I glark this right, yields an immutable window*/
swpFlags = SWP_NOSIZE | SWP_NOMOVE; swpFlags = SWP_NOSIZE | SWP_NOMOVE;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
/*cmd handling goes here. see dlls/x1drv/winpos.c*/ /*cmd handling goes here. see dlls/x1drv/winpos.c*/
WIN_ReleaseWndPtr( wndPtr );
return swpFlags; return swpFlags;
} }
......
...@@ -229,7 +229,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev ) ...@@ -229,7 +229,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
/********************************************************************** /**********************************************************************
* PSDRV_CreateDC * PSDRV_CreateDC
*/ */
BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, BOOL PSDRV_CreateDC( DC *dc, PSDRV_PDEVICE **pdev, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData ) LPCSTR output, const DEVMODEA* initData )
{ {
PSDRV_PDEVICE *physDev; PSDRV_PDEVICE *physDev;
...@@ -238,9 +238,9 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -238,9 +238,9 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/* If no device name was specified, retrieve the device name /* If no device name was specified, retrieve the device name
* from the DEVMODE structure from the DC's physDev. * from the DEVMODE structure from the DC's physDev.
* (See CreateCompatibleDC) */ * (See CreateCompatibleDC) */
if ( !device && dc->physDev ) if ( !device && *pdev )
{ {
physDev = (PSDRV_PDEVICE *)dc->physDev; physDev = *pdev;
device = physDev->Devmode->dmPublic.dmDeviceName; device = physDev->Devmode->dmPublic.dmDeviceName;
} }
pi = PSDRV_FindPrinterInfo(device); pi = PSDRV_FindPrinterInfo(device);
...@@ -257,7 +257,7 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -257,7 +257,7 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
sizeof(*physDev) ); sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
dc->physDev = (PHYSDEV)physDev; *pdev = physDev;
physDev->hdc = dc->hSelf; physDev->hdc = dc->hSelf;
physDev->dc = dc; physDev->dc = dc;
...@@ -300,7 +300,6 @@ BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev ) ...@@ -300,7 +300,6 @@ BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev )
HeapFree( PSDRV_Heap, 0, physDev->Devmode ); HeapFree( PSDRV_Heap, 0, physDev->Devmode );
HeapFree( PSDRV_Heap, 0, physDev->job.output ); HeapFree( PSDRV_Heap, 0, physDev->job.output );
physDev->dc->physDev = NULL;
HeapFree( PSDRV_Heap, 0, physDev ); HeapFree( PSDRV_Heap, 0, physDev );
return TRUE; return TRUE;
......
...@@ -5,7 +5,7 @@ init PSDRV_Init ...@@ -5,7 +5,7 @@ init PSDRV_Init
@ cdecl Arc(ptr long long long long long long long long) PSDRV_Arc @ cdecl Arc(ptr long long long long long long long long) PSDRV_Arc
@ cdecl Chord(ptr long long long long long long long long) PSDRV_Chord @ cdecl Chord(ptr long long long long long long long long) PSDRV_Chord
@ cdecl CreateDC(ptr str str str ptr) PSDRV_CreateDC @ cdecl CreateDC(ptr ptr str str str ptr) PSDRV_CreateDC
@ cdecl DeleteDC(ptr) PSDRV_DeleteDC @ cdecl DeleteDC(ptr) PSDRV_DeleteDC
@ cdecl DeviceCapabilities(ptr ptr ptr long ptr ptr) PSDRV_DeviceCapabilities @ cdecl DeviceCapabilities(ptr ptr ptr long ptr ptr) PSDRV_DeviceCapabilities
@ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse @ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse
......
...@@ -426,7 +426,7 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -426,7 +426,7 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
X11DRV_WND_DATA *data = win->pDriverData; X11DRV_WND_DATA *data = win->pDriverData;
Drawable drawable; Drawable drawable;
BOOL visible; BOOL visible;
POINT org; POINT org, drawable_org;
int mode = IncludeInferiors; int mode = IncludeInferiors;
/* don't clip siblings if using parent clip region */ /* don't clip siblings if using parent clip region */
...@@ -466,7 +466,9 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -466,7 +466,9 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
org.x = win->rectWindow.left - win->rectClient.left; org.x = win->rectWindow.left - win->rectClient.left;
org.y = win->rectWindow.top - win->rectClient.top; org.y = win->rectWindow.top - win->rectClient.top;
} }
drawable_org = org;
MapWindowPoints( hwnd, parent, &org, 1 ); MapWindowPoints( hwnd, parent, &org, 1 );
MapWindowPoints( hwnd, 0, &drawable_org, 1 );
/* have to use the parent so that we include siblings */ /* have to use the parent so that we include siblings */
if (parent) drawable = X11DRV_get_client_window( parent ); if (parent) drawable = X11DRV_get_client_window( parent );
else drawable = root_window; else drawable = root_window;
...@@ -478,23 +480,28 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -478,23 +480,28 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
drawable = data->icon_window ? data->icon_window : data->whole_window; drawable = data->icon_window ? data->icon_window : data->whole_window;
org.x = 0; org.x = 0;
org.y = 0; org.y = 0;
drawable_org = org;
} }
else if (flags & DCX_WINDOW) else if (flags & DCX_WINDOW)
{ {
drawable = data->whole_window; drawable = data->whole_window;
org.x = win->rectWindow.left - data->whole_rect.left; org.x = win->rectWindow.left - data->whole_rect.left;
org.y = win->rectWindow.top - data->whole_rect.top; org.y = win->rectWindow.top - data->whole_rect.top;
drawable_org.x = data->whole_rect.left - win->rectClient.left;
drawable_org.y = data->whole_rect.top - win->rectClient.top;
} }
else else
{ {
drawable = data->client_window; drawable = data->client_window;
org.x = 0; org.x = 0;
org.y = 0; org.y = 0;
drawable_org = org;
if (flags & DCX_CLIPCHILDREN) mode = ClipByChildren; /* can use X11 clipping */ if (flags & DCX_CLIPCHILDREN) mode = ClipByChildren; /* can use X11 clipping */
} }
MapWindowPoints( hwnd, 0, &drawable_org, 1 );
} }
X11DRV_SetDrawable( hdc, drawable, mode, org.x, org.y ); X11DRV_SetDrawable( hdc, drawable, mode, &org, &drawable_org );
if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) || if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) ||
SetHookFlags16( hdc, DCHF_VALIDATEVISRGN )) /* DC was dirty */ SetHookFlags16( hdc, DCHF_VALIDATEVISRGN )) /* DC was dirty */
...@@ -509,9 +516,6 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags ) ...@@ -509,9 +516,6 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
CombineRgn( visRgn, visRgn, hrgn, CombineRgn( visRgn, visRgn, hrgn,
(flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF ); (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
/* make it relative to the drawable origin */
OffsetRgn( visRgn, org.x, org.y );
} }
else visRgn = CreateRectRgn( 0, 0, 0, 0 ); else visRgn = CreateRectRgn( 0, 0, 0, 0 );
......
...@@ -8,7 +8,7 @@ init X11DRV_Init ...@@ -8,7 +8,7 @@ init X11DRV_Init
@ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat @ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat
@ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord @ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord
@ cdecl CreateBitmap(ptr long) X11DRV_CreateBitmap @ cdecl CreateBitmap(ptr long) X11DRV_CreateBitmap
@ cdecl CreateDC(ptr str str str ptr) X11DRV_CreateDC @ cdecl CreateDC(ptr ptr str str str ptr) X11DRV_CreateDC
@ cdecl CreateDIBSection(ptr ptr long ptr long long long) X11DRV_DIB_CreateDIBSection @ cdecl CreateDIBSection(ptr ptr long ptr long long long) X11DRV_DIB_CreateDIBSection
@ cdecl DeleteBitmap(long) X11DRV_DeleteBitmap @ cdecl DeleteBitmap(long) X11DRV_DeleteBitmap
@ cdecl DeleteDC(ptr) X11DRV_DeleteDC @ cdecl DeleteDC(ptr) X11DRV_DeleteDC
...@@ -49,6 +49,7 @@ init X11DRV_Init ...@@ -49,6 +49,7 @@ init X11DRV_Init
@ cdecl SelectPen(ptr long) X11DRV_SelectPen @ cdecl SelectPen(ptr long) X11DRV_SelectPen
@ cdecl SetBitmapBits(long ptr long) X11DRV_SetBitmapBits @ cdecl SetBitmapBits(long ptr long) X11DRV_SetBitmapBits
@ cdecl SetBkColor(ptr long) X11DRV_SetBkColor @ cdecl SetBkColor(ptr long) X11DRV_SetBkColor
@ cdecl SetDCOrg(ptr long long) X11DRV_SetDCOrg
@ cdecl SetDIBColorTable(ptr long long ptr) X11DRV_SetDIBColorTable @ cdecl SetDIBColorTable(ptr long long ptr) X11DRV_SetDIBColorTable
@ cdecl SetDIBits(ptr long long long ptr ptr long) X11DRV_SetDIBits @ 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 @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice
......
...@@ -637,7 +637,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -637,7 +637,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(flags & ETO_OPAQUE) { if(flags & ETO_OPAQUE) {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + rc.left, dc->DCOrgY + rc.top, physDev->org.x + rc.left, physDev->org.y + rc.top,
rc.right - rc.left, rc.bottom - rc.top ); rc.right - rc.left, rc.bottom - rc.top );
} }
...@@ -735,7 +735,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -735,7 +735,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
{ {
wine_tsx11_lock(); wine_tsx11_lock();
pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict, pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict,
0, 0, (XRectangle *)data->Buffer, data->rdh.nCount ); physDev->org.x, physDev->org.y,
(XRectangle *)data->Buffer, data->rdh.nCount );
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
...@@ -746,7 +747,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -746,7 +747,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
y - tm.tmAscent < rc.top || y + tm.tmDescent >= rc.bottom) { y - tm.tmAscent < rc.top || y + tm.tmDescent >= rc.bottom) {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y - tm.tmAscent, physDev->org.x + x, physDev->org.y + y - tm.tmAscent,
width, tm.tmAscent + tm.tmDescent ); width, tm.tmAscent + tm.tmDescent );
} }
} }
...@@ -809,8 +810,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -809,8 +810,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
} }
TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count), dc->DCOrgX + x, TRACE("Writing %s at %ld,%ld\n", debugstr_wn(wstr,count),
dc->DCOrgY + y); physDev->org.x + x, physDev->org.y + y);
wine_tsx11_lock(); wine_tsx11_lock();
if(!lpDx) if(!lpDx)
...@@ -819,7 +820,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -819,7 +820,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->pict, physDev->xrender->pict,
physDev->xrender->cacheEntry->font_format, physDev->xrender->cacheEntry->font_format,
physDev->xrender->cacheEntry->glyphset, physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x, dc->DCOrgY + y, 0, 0, physDev->org.x + x, physDev->org.y + y,
glyphs, count); glyphs, count);
else { else {
...@@ -830,8 +831,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag ...@@ -830,8 +831,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->pict, physDev->xrender->pict,
physDev->xrender->cacheEntry->font_format, physDev->xrender->cacheEntry->font_format,
physDev->xrender->cacheEntry->glyphset, physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x + xoff, 0, 0, physDev->org.x + x + xoff,
dc->DCOrgY + y + yoff, physDev->org.y + y + yoff,
glyphs + idx, 1); glyphs + idx, 1);
offset += INTERNAL_XWSTODS(dc, lpDx[idx]); offset += INTERNAL_XWSTODS(dc, lpDx[idx]);
xoff = offset * cosEsc; xoff = offset * cosEsc;
......
...@@ -117,7 +117,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn ) ...@@ -117,7 +117,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn )
RGNDATA *data; RGNDATA *data;
if (!(data = X11DRV_GetRegionData( hrgn, 0 ))) return; if (!(data = X11DRV_GetRegionData( hrgn, 0 ))) return;
TSXSetClipRectangles( gdi_display, physDev->gc, 0, 0, TSXSetClipRectangles( gdi_display, physDev->gc, physDev->org.x, physDev->org.y,
(XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded );
HeapFree( GetProcessHeap(), 0, data ); HeapFree( GetProcessHeap(), 0, data );
} }
...@@ -128,27 +128,17 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn ) ...@@ -128,27 +128,17 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn )
* *
* Set the drawable, clipping mode and origin for a DC. * Set the drawable, clipping mode and origin for a DC.
*/ */
void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int org_y ) void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, const POINT *org,
const POINT *drawable_org )
{ {
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (dc) if (dc)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/*
* This function change the coordinate system (DCOrgX,DCOrgY) physDev->org = *org;
* values. When it moves the origin, other data like the current clipping
* region will not be moved to that new origin. In the case of DCs that are class
* or window DCs that clipping region might be a valid value from a previous use
* of the DC and changing the origin of the DC without moving the clip region
* results in a clip region that is not placed properly in the DC.
* This code will save the dc origin, let the SetDrawable
* modify the origin and reset the clipping. When the clipping is set,
* it is moved according to the new DC origin.
*/
if (dc->hClipRgn) OffsetRgn( dc->hClipRgn, org_x - dc->DCOrgX, org_y - dc->DCOrgY );
dc->DCOrgX = org_x;
dc->DCOrgY = org_y;
physDev->drawable = drawable; physDev->drawable = drawable;
physDev->drawable_org = *drawable_org;
TSXSetSubwindowMode( gdi_display, physDev->gc, mode ); TSXSetSubwindowMode( gdi_display, physDev->gc, mode );
if(physDev->xrender) if(physDev->xrender)
X11DRV_XRender_UpdateDrawable( physDev ); X11DRV_XRender_UpdateDrawable( physDev );
...@@ -202,8 +192,8 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn ) ...@@ -202,8 +192,8 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
if (event.type == NoExpose) break; if (event.type == NoExpose) break;
if (event.type == GraphicsExpose) if (event.type == GraphicsExpose)
{ {
int x = event.xgraphicsexpose.x - dc->DCOrgX; int x = event.xgraphicsexpose.x - physDev->org.x;
int y = event.xgraphicsexpose.y - dc->DCOrgY; int y = event.xgraphicsexpose.y - physDev->org.y;
TRACE( "got %d,%d %dx%d count %d\n", TRACE( "got %d,%d %dx%d count %d\n",
x, y, event.xgraphicsexpose.width, event.xgraphicsexpose.height, x, y, event.xgraphicsexpose.width, event.xgraphicsexpose.height,
...@@ -228,4 +218,3 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn ) ...@@ -228,4 +218,3 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
} }
...@@ -4796,8 +4796,8 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO ...@@ -4796,8 +4796,8 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
descr.xSrc = xSrc; descr.xSrc = xSrc;
descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy) descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)
: ySrc - startscan; : ySrc - startscan;
descr.xDest = dc->DCOrgX + XLPTODP( dc, xDest ); descr.xDest = physDev->org.x + XLPTODP( dc, xDest );
descr.yDest = dc->DCOrgY + YLPTODP( dc, yDest ) + descr.yDest = physDev->org.y + YLPTODP( dc, yDest ) +
(tmpheight >= 0 ? oldcy-cy : 0); (tmpheight >= 0 ? oldcy-cy : 0);
descr.width = cx; descr.width = cx;
descr.height = cy; descr.height = cy;
...@@ -5178,7 +5178,8 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD ...@@ -5178,7 +5178,8 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
} }
/* perform the copy */ /* perform the copy */
X11DRV_DIB_DoCopyDIBSection(bmp, FALSE, colorMap, nColorMap, X11DRV_DIB_DoCopyDIBSection(bmp, FALSE, colorMap, nColorMap,
physDevDst->drawable, xSrc, ySrc, xDest, yDest, physDevDst->drawable, xSrc, ySrc,
physDevDst->org.x + xDest, physDevDst->org.y + yDest,
width, height); width, height);
/* free color mapping */ /* free color mapping */
if (aColorMap) if (aColorMap)
......
...@@ -87,7 +87,7 @@ void X11DRV_GDI_Finalize(void) ...@@ -87,7 +87,7 @@ void X11DRV_GDI_Finalize(void)
/********************************************************************** /**********************************************************************
* X11DRV_CreateDC * X11DRV_CreateDC
*/ */
BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, BOOL X11DRV_CreateDC( DC *dc, X11DRV_PDEVICE **pdev, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData ) LPCSTR output, const DEVMODEA* initData )
{ {
X11DRV_PDEVICE *physDev; X11DRV_PDEVICE *physDev;
...@@ -99,7 +99,7 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -99,7 +99,7 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
ERR("Can't allocate physDev\n"); ERR("Can't allocate physDev\n");
return FALSE; return FALSE;
} }
dc->physDev = (PHYSDEV)physDev; *pdev = physDev;
physDev->hdc = dc->hSelf; physDev->hdc = dc->hSelf;
physDev->dc = dc; /* FIXME */ physDev->dc = dc; /* FIXME */
...@@ -112,6 +112,8 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -112,6 +112,8 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
physDev->drawable = root_window; physDev->drawable = root_window;
dc->bitsPerPixel = screen_depth; dc->bitsPerPixel = screen_depth;
} }
physDev->org.x = physDev->org.y = 0;
physDev->drawable_org.x = physDev->drawable_org.y = 0;
physDev->current_pf = 0; physDev->current_pf = 0;
physDev->used_visuals = 0; physDev->used_visuals = 0;
...@@ -131,8 +133,6 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -131,8 +133,6 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
*/ */
BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev ) BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev )
{ {
DC *dc = physDev->dc;
if(physDev->xrender) if(physDev->xrender)
X11DRV_XRender_DeleteDC( physDev ); X11DRV_XRender_DeleteDC( physDev );
wine_tsx11_lock(); wine_tsx11_lock();
...@@ -141,7 +141,6 @@ BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev ) ...@@ -141,7 +141,6 @@ BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev )
XFree(physDev->visuals[physDev->used_visuals]); XFree(physDev->visuals[physDev->used_visuals]);
wine_tsx11_unlock(); wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL;
return TRUE; return TRUE;
} }
......
...@@ -135,8 +135,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -135,8 +135,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
dibUpdateFlag = TRUE; dibUpdateFlag = TRUE;
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + rect.left, dc->DCOrgY + rect.top, physDev->org.x + rect.left, physDev->org.y + rect.top,
rect.right-rect.left, rect.bottom-rect.top ); rect.right-rect.left, rect.bottom-rect.top );
} }
if (!count) goto END; /* Nothing more to do */ if (!count) goto END; /* Nothing more to do */
...@@ -235,10 +235,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -235,10 +235,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{ {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, physDev->org.x + x, physDev->org.y + y - ascent,
dc->DCOrgY + y - ascent, width, ascent + descent );
width,
ascent + descent );
} }
} }
} }
...@@ -254,7 +252,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -254,7 +252,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{ {
X11DRV_cptable[pfo->fi->cptable].pDrawString( X11DRV_cptable[pfo->fi->cptable].pDrawString(
pfo, gdi_display, physDev->drawable, physDev->gc, pfo, gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y, str2b, count ); physDev->org.x + x, physDev->org.y + y, str2b, count );
} }
else /* Now the fun begins... */ else /* Now the fun begins... */
{ {
...@@ -326,7 +324,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -326,7 +324,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display, X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display,
physDev->drawable, physDev->gc, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y, items, pitem - items ); physDev->org.x + x, physDev->org.y + y, items, pitem - items );
HeapFree( GetProcessHeap(), 0, items ); HeapFree( GetProcessHeap(), 0, items );
} }
} }
...@@ -340,9 +338,9 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -340,9 +338,9 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{ {
int char_metric_offset = str2b[i].byte2 + (str2b[i].byte1 << 8) int char_metric_offset = str2b[i].byte2 + (str2b[i].byte1 << 8)
- font->min_char_or_byte2; - font->min_char_or_byte2;
int x_i = IROUND((double) (dc->DCOrgX + x) + offset * int x_i = IROUND((double) (physDev->org.x + x) + offset *
pfo->lpX11Trans->a / pfo->lpX11Trans->pixelsize ); pfo->lpX11Trans->a / pfo->lpX11Trans->pixelsize );
int y_i = IROUND((double) (dc->DCOrgY + y) - offset * int y_i = IROUND((double) (physDev->org.y + y) - offset *
pfo->lpX11Trans->b / pfo->lpX11Trans->pixelsize ); pfo->lpX11Trans->b / pfo->lpX11Trans->pixelsize );
X11DRV_cptable[pfo->fi->cptable].pDrawString( X11DRV_cptable[pfo->fi->cptable].pDrawString(
...@@ -380,8 +378,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -380,8 +378,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth, TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth,
LineSolid, CapRound, JoinBevel ); LineSolid, CapRound, JoinBevel );
TSXDrawLine( gdi_display, physDev->drawable, physDev->gc, TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y + linePos, physDev->org.x + x, physDev->org.y + y + linePos,
dc->DCOrgX + x + width, dc->DCOrgY + y + linePos ); physDev->org.x + x + width, physDev->org.y + y + linePos );
} }
if (lfStrikeOut) if (lfStrikeOut)
{ {
...@@ -393,8 +391,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, ...@@ -393,8 +391,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
TSXSetLineAttributes( gdi_display, physDev->gc, lineAscent + lineDescent, TSXSetLineAttributes( gdi_display, physDev->gc, lineAscent + lineDescent,
LineSolid, CapRound, JoinBevel ); LineSolid, CapRound, JoinBevel );
TSXDrawLine( gdi_display, physDev->drawable, physDev->gc, TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y - lineAscent, physDev->org.x + x, physDev->org.y + y - lineAscent,
dc->DCOrgX + x + width, dc->DCOrgY + y - lineAscent ); physDev->org.x + x + width, physDev->org.y + y - lineAscent );
} }
if (flags & ETO_CLIPPED) RestoreVisRgn16( dc->hSelf ); if (flags & ETO_CLIPPED) RestoreVisRgn16( dc->hSelf );
......
...@@ -131,8 +131,6 @@ typedef struct tagDC ...@@ -131,8 +131,6 @@ typedef struct tagDC
INT MapMode; INT MapMode;
INT GraphicsMode; /* Graphics mode */ INT GraphicsMode; /* Graphics mode */
INT DCOrgX; /* DC origin */
INT DCOrgY;
ABORTPROC pAbortProc; /* AbortProc for Printing */ ABORTPROC pAbortProc; /* AbortProc for Printing */
ABORTPROC16 pAbortProc16; ABORTPROC16 pAbortProc16;
INT CursPosX; /* Current position */ INT CursPosX; /* Current position */
...@@ -162,7 +160,7 @@ typedef struct tagDC_FUNCS ...@@ -162,7 +160,7 @@ typedef struct tagDC_FUNCS
BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(PHYSDEV); BOOL (*pCloseFigure)(PHYSDEV);
BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP); BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP);
BOOL (*pCreateDC)(DC *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*); BOOL (*pCreateDC)(DC *,PHYSDEV *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
HBITMAP (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD); HBITMAP (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD);
BOOL (*pDeleteBitmap)(HBITMAP); BOOL (*pDeleteBitmap)(HBITMAP);
BOOL (*pDeleteDC)(PHYSDEV); BOOL (*pDeleteDC)(PHYSDEV);
...@@ -232,6 +230,7 @@ typedef struct tagDC_FUNCS ...@@ -232,6 +230,7 @@ typedef struct tagDC_FUNCS
LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG); LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF); COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
INT (*pSetBkMode)(PHYSDEV,INT); INT (*pSetBkMode)(PHYSDEV,INT);
DWORD (*pSetDCOrg)(PHYSDEV,INT,INT);
UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*); UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT); INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID, INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
......
...@@ -82,6 +82,8 @@ typedef struct ...@@ -82,6 +82,8 @@ typedef struct
DC *dc; /* direct pointer to DC, should go away */ DC *dc; /* direct pointer to DC, should go away */
GC gc; /* X Window GC */ GC gc; /* X Window GC */
Drawable drawable; Drawable drawable;
POINT org; /* DC origin relative to drawable */
POINT drawable_org; /* Origin of drawable relative to screen */
X_PHYSFONT font; X_PHYSFONT font;
X_PHYSPEN pen; X_PHYSPEN pen;
X_PHYSBRUSH brush; X_PHYSBRUSH brush;
...@@ -193,7 +195,8 @@ extern Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc ); ...@@ -193,7 +195,8 @@ extern Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc );
extern Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc ); extern Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc );
extern RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ); extern RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp );
extern void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int org_y ); extern void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, const POINT *org,
const POINT *drawable_org );
extern void X11DRV_StartGraphicsExposures( HDC hdc ); extern void X11DRV_StartGraphicsExposures( HDC hdc );
extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn ); extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn );
......
...@@ -121,12 +121,10 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode ) ...@@ -121,12 +121,10 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
dc->hClipRgn = CreateRectRgnIndirect( &rect ); dc->hClipRgn = CreateRectRgnIndirect( &rect );
} }
OffsetRgn( dc->hClipRgn, -dc->DCOrgX, -dc->DCOrgY );
if(fnMode == RGN_COPY) if(fnMode == RGN_COPY)
retval = CombineRgn( dc->hClipRgn, hrgn, 0, fnMode ); retval = CombineRgn( dc->hClipRgn, hrgn, 0, fnMode );
else else
retval = CombineRgn( dc->hClipRgn, dc->hClipRgn, hrgn, fnMode); retval = CombineRgn( dc->hClipRgn, dc->hClipRgn, hrgn, fnMode);
OffsetRgn( dc->hClipRgn, dc->DCOrgX, dc->DCOrgY );
} }
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
...@@ -230,10 +228,10 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top, ...@@ -230,10 +228,10 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom ); ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
else else
{ {
left = dc->DCOrgX + XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right ); right = XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top ); top = YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
if (!(newRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR; if (!(newRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
else else
...@@ -279,10 +277,10 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, ...@@ -279,10 +277,10 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom ); ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
else else
{ {
left = dc->DCOrgX + XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right ); right = XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top ); top = YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
if (!dc->hClipRgn) if (!dc->hClipRgn)
{ {
...@@ -318,10 +316,10 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top, ...@@ -318,10 +316,10 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top,
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
left = dc->DCOrgX + XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right ); right = XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top ); top = YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom ); TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
...@@ -348,10 +346,10 @@ INT16 WINAPI IntersectVisRect16( HDC16 hdc, INT16 left, INT16 top, ...@@ -348,10 +346,10 @@ INT16 WINAPI IntersectVisRect16( HDC16 hdc, INT16 left, INT16 top,
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
left = dc->DCOrgX + XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right ); right = XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top ); top = YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom ); bottom = YLPTODP( dc, bottom );
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom ); TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
...@@ -388,8 +386,7 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y ) ...@@ -388,8 +386,7 @@ BOOL WINAPI PtVisible( HDC hdc, INT x, INT y )
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->hGCClipRgn) if (dc->hGCClipRgn)
{ {
ret = PtInRegion( dc->hGCClipRgn, XLPTODP(dc,x) + dc->DCOrgX, ret = PtInRegion( dc->hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
YLPTODP(dc,y) + dc->DCOrgY );
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
...@@ -424,10 +421,6 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect ) ...@@ -424,10 +421,6 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
/* copy rectangle to avoid overwriting by LPtoDP */ /* copy rectangle to avoid overwriting by LPtoDP */
tmpRect = *rect; tmpRect = *rect;
LPtoDP( hdc, (LPPOINT)&tmpRect, 2 ); LPtoDP( hdc, (LPPOINT)&tmpRect, 2 );
tmpRect.left += dc->DCOrgX;
tmpRect.right += dc->DCOrgX;
tmpRect.top += dc->DCOrgY;
tmpRect.bottom += dc->DCOrgY;
ret = RectInRegion( dc->hGCClipRgn, &tmpRect ); ret = RectInRegion( dc->hGCClipRgn, &tmpRect );
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
...@@ -444,10 +437,6 @@ INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect ) ...@@ -444,10 +437,6 @@ INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
DC *dc = DC_GetDCUpdate( hdc ); DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
ret = GetRgnBox16( dc->hGCClipRgn, rect ); ret = GetRgnBox16( dc->hGCClipRgn, rect );
rect->left -= dc->DCOrgX;
rect->right -= dc->DCOrgX;
rect->top -= dc->DCOrgY;
rect->bottom -= dc->DCOrgY;
DPtoLP16( hdc, (LPPOINT16)rect, 2 ); DPtoLP16( hdc, (LPPOINT16)rect, 2 );
TRACE("%d,%d-%d,%d\n", rect->left,rect->top,rect->right,rect->bottom ); TRACE("%d,%d-%d,%d\n", rect->left,rect->top,rect->right,rect->bottom );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
...@@ -464,10 +453,6 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect ) ...@@ -464,10 +453,6 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
DC *dc = DC_GetDCUpdate( hdc ); DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
ret = GetRgnBox( dc->hGCClipRgn, rect ); ret = GetRgnBox( dc->hGCClipRgn, rect );
rect->left -= dc->DCOrgX;
rect->right -= dc->DCOrgX;
rect->top -= dc->DCOrgY;
rect->bottom -= dc->DCOrgY;
DPtoLP( hdc, (LPPOINT)rect, 2 ); DPtoLP( hdc, (LPPOINT)rect, 2 );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
...@@ -485,14 +470,7 @@ INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn ) ...@@ -485,14 +470,7 @@ INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn )
{ {
if( dc->hClipRgn ) if( dc->hClipRgn )
{ {
/* this assumes that dc->hClipRgn is in coordinates if( CombineRgn(hRgn, dc->hClipRgn, 0, RGN_COPY) != ERROR ) ret = 1;
relative to the device (not DC origin) */
if( CombineRgn(hRgn, dc->hClipRgn, 0, RGN_COPY) != ERROR )
{
OffsetRgn( hRgn, -dc->DCOrgX, -dc->DCOrgY );
ret = 1;
}
} }
else ret = 0; else ret = 0;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
......
...@@ -107,8 +107,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs ) ...@@ -107,8 +107,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
dc->bitsPerPixel = 1; dc->bitsPerPixel = 1;
dc->MapMode = MM_TEXT; dc->MapMode = MM_TEXT;
dc->GraphicsMode = GM_COMPATIBLE; dc->GraphicsMode = GM_COMPATIBLE;
dc->DCOrgX = 0;
dc->DCOrgY = 0;
dc->pAbortProc = NULL; dc->pAbortProc = NULL;
dc->CursPosX = 0; dc->CursPosX = 0;
dc->CursPosY = 0; dc->CursPosY = 0;
...@@ -310,11 +308,6 @@ HDC16 WINAPI GetDCState16( HDC16 hdc ) ...@@ -310,11 +308,6 @@ HDC16 WINAPI GetDCState16( HDC16 hdc )
newdc->breakRem = dc->breakRem; newdc->breakRem = dc->breakRem;
newdc->MapMode = dc->MapMode; newdc->MapMode = dc->MapMode;
newdc->GraphicsMode = dc->GraphicsMode; newdc->GraphicsMode = dc->GraphicsMode;
#if 0
/* Apparently, the DC origin is not changed by [GS]etDCState */
newdc->DCOrgX = dc->DCOrgX;
newdc->DCOrgY = dc->DCOrgY;
#endif
newdc->CursPosX = dc->CursPosX; newdc->CursPosX = dc->CursPosX;
newdc->CursPosY = dc->CursPosY; newdc->CursPosY = dc->CursPosY;
newdc->ArcDirection = dc->ArcDirection; newdc->ArcDirection = dc->ArcDirection;
...@@ -403,11 +396,6 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs ) ...@@ -403,11 +396,6 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
dc->breakRem = dcs->breakRem; dc->breakRem = dcs->breakRem;
dc->MapMode = dcs->MapMode; dc->MapMode = dcs->MapMode;
dc->GraphicsMode = dcs->GraphicsMode; dc->GraphicsMode = dcs->GraphicsMode;
#if 0
/* Apparently, the DC origin is not changed by [GS]etDCState */
dc->DCOrgX = dcs->DCOrgX;
dc->DCOrgY = dcs->DCOrgY;
#endif
dc->CursPosX = dcs->CursPosX; dc->CursPosX = dcs->CursPosX;
dc->CursPosY = dcs->CursPosY; dc->CursPosY = dcs->CursPosY;
dc->ArcDirection = dcs->ArcDirection; dc->ArcDirection = dcs->ArcDirection;
...@@ -620,7 +608,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output, ...@@ -620,7 +608,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf ); debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
if (dc->funcs->pCreateDC && if (dc->funcs->pCreateDC &&
!dc->funcs->pCreateDC( dc, buf, device, output, initData )) !dc->funcs->pCreateDC( dc, &dc->physDev, buf, device, output, initData ))
{ {
WARN("creation aborted by device\n" ); WARN("creation aborted by device\n" );
GDI_FreeObject( dc->hSelf, dc ); GDI_FreeObject( dc->hSelf, dc );
...@@ -740,7 +728,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc ) ...@@ -740,7 +728,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev; if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev;
if (dc->funcs->pCreateDC && if (dc->funcs->pCreateDC &&
!dc->funcs->pCreateDC( dc, NULL, NULL, NULL, NULL )) !dc->funcs->pCreateDC( dc, &dc->physDev, NULL, NULL, NULL, NULL ))
{ {
WARN("creation aborted by device\n"); WARN("creation aborted by device\n");
GDI_FreeObject( dc->hSelf, dc ); GDI_FreeObject( dc->hSelf, dc );
...@@ -820,6 +808,7 @@ BOOL WINAPI DeleteDC( HDC hdc ) ...@@ -820,6 +808,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) ); SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
funcs = dc->funcs; funcs = dc->funcs;
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev); if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
dc->physDev = NULL;
} }
if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
...@@ -1003,8 +992,6 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp ) ...@@ -1003,8 +992,6 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
lpp->x = lpp->y = 0; lpp->x = lpp->y = 0;
if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp ); if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
lpp->x += dc->DCOrgX;
lpp->y += dc->DCOrgY;
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );
return TRUE; return TRUE;
} }
...@@ -1027,12 +1014,10 @@ DWORD WINAPI GetDCOrg16( HDC16 hdc ) ...@@ -1027,12 +1014,10 @@ DWORD WINAPI GetDCOrg16( HDC16 hdc )
*/ */
DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y ) DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
{ {
DWORD prevOrg; DWORD prevOrg = 0;
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
prevOrg = dc->DCOrgX | (dc->DCOrgY << 16); if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
dc->DCOrgX = x;
dc->DCOrgY = y;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return prevOrg; return prevOrg;
} }
......
...@@ -2920,8 +2920,6 @@ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode) ...@@ -2920,8 +2920,6 @@ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode)
GetDCOrgEx(hDC, &org); GetDCOrgEx(hDC, &org);
else else
org.x = org.y = 0; org.x = org.y = 0;
org.x -= dc->DCOrgX;
org.y -= dc->DCOrgY;
OffsetRgn (hRgn, org.x, org.y); OffsetRgn (hRgn, org.x, org.y);
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment