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 )
GET_FUNC(SetBitmapBits);
GET_FUNC(SetBkColor);
GET_FUNC(SetBkMode);
GET_FUNC(SetDCOrg);
GET_FUNC(SetDIBColorTable);
GET_FUNC(SetDIBits);
GET_FUNC(SetDIBitsToDevice);
......
......@@ -111,6 +111,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pSetBitmapBits */
EMFDRV_SetBkColor, /* pSetBkColor */
EMFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */
......
......@@ -111,6 +111,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pSetBitmapBits */
MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
......
......@@ -36,10 +36,10 @@ WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
DC *dc = physDev->dc;
POINT16 points[2];
points[0].x = dc->DCOrgX + XLPTODP( dc, dc->CursPosX );
points[0].y = dc->DCOrgY + YLPTODP( dc, dc->CursPosY );
points[1].x = dc->DCOrgX + XLPTODP( dc, x );
points[1].y = dc->DCOrgY + YLPTODP( dc, y );
points[0].x = physDev->org.x + XLPTODP( dc, dc->CursPosX );
points[0].y = physDev->org.y + YLPTODP( dc, dc->CursPosY );
points[1].x = physDev->org.x + XLPTODP( dc, x );
points[1].y = physDev->org.y + YLPTODP( dc, y );
bRet = PRTDRV_Output(physDev->segptrPDEVICE,
OS_POLYLINE, 2, points,
physDev->PenInfo,
......@@ -63,8 +63,8 @@ WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0;
POINT16 points[2];
TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
left, top, dc->DCOrgX, dc->DCOrgY);
TRACE("In WIN16DRV_Rectangle, x %d y %d DCOrgX %ld y %ld\n",
left, top, physDev->org.x, physDev->org.y);
TRACE("In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left);
......@@ -163,7 +163,8 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
BOOL bRet = 0;
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);
points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top);
......@@ -178,11 +179,3 @@ WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
win16drv_SegPtr_DrawMode, dc->hClipRgn);
return bRet;
}
......@@ -50,7 +50,7 @@ SEGPTR win16drv_SegPtr_DrawMode;
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 );
static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap );
static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
......@@ -139,6 +139,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
NULL, /* pSetDCOrg */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */
......@@ -240,8 +241,8 @@ void InitDrawMode(LPDRAWMODE lpDrawMode)
lpDrawMode->eMiterLimit = 1;
}
BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
const DEVMODEA* initData )
BOOL WIN16DRV_CreateDC( DC *dc, PHYSDEV *pdev, LPCSTR driver, LPCSTR device, LPCSTR output,
const DEVMODEA* initData )
{
LOADED_PRINTER_DRIVER *pLPD;
WORD wRet;
......@@ -254,9 +255,10 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
if (!physDev) return FALSE;
dc->physDev = (PHYSDEV)physDev;
*pdev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
physDev->org.x = physDev->org.y = 0;
pLPD = LoadPrinterDriver(driver);
if (pLPD == NULL)
......
......@@ -207,6 +207,7 @@ typedef struct
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */
HDC hdc;
DC *dc;
POINT org; /* Device origin */
DeviceCaps DevCaps; /* Device caps */
} WIN16DRV_PDEVICE;
......@@ -300,4 +301,3 @@ extern SEGPTR win16drv_SegPtr_DrawMode;
extern LPDRAWMODE win16drv_DrawModeP;
#endif /* __WINE_WIN16DRV_H */
......@@ -39,7 +39,7 @@ BOOL TTYDRV_GDI_Initialize(void)
/***********************************************************************
* 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)
{
TTYDRV_PDEVICE *physDev;
......@@ -48,15 +48,14 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
dc, debugstr_a(driver), debugstr_a(device),
debugstr_a(output), initData);
dc->physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(TTYDRV_PDEVICE));
if(!dc->physDev) {
physDev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(TTYDRV_PDEVICE));
if(!physDev) {
ERR("Can't allocate physDev\n");
return FALSE;
}
physDev = (TTYDRV_PDEVICE *) dc->physDev;
*pdev = physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
physDev->org.x = physDev->org.y = 0;
if(dc->flags & DC_MEMORY){
physDev->window = NULL;
......@@ -80,7 +79,6 @@ BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
{
TRACE("(%x)\n", physDev->hdc);
physDev->dc->physDev = NULL;
HeapFree( GetProcessHeap(), 0, physDev );
return TRUE;
}
......@@ -167,3 +165,25 @@ INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
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)
{
#ifdef WINE_CURSES
INT row1, col1, row2, col2;
DC *dc = physDev->dc;
POINT pt[2];
TRACE("(%x, %d, %d)\n", physDev->hdc, x, y);
if(!physDev->window)
return FALSE;
row1 = (dc->DCOrgY + XLPTODP(dc, dc->CursPosY)) / physDev->cellHeight;
col1 = (dc->DCOrgX + XLPTODP(dc, dc->CursPosX)) / physDev->cellWidth;
row2 = (dc->DCOrgY + XLPTODP(dc, y)) / physDev->cellHeight;
col2 = (dc->DCOrgX + XLPTODP(dc, x)) / physDev->cellWidth;
GetCurrentPositionEx( physDev->hdc, &pt[0] );
pt[1].x = x;
pt[1].y = y;
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) {
INT tmp = row1;
......@@ -190,17 +195,22 @@ BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right,
{
#ifdef WINE_CURSES
INT row1, col1, row2, col2;
DC *dc = physDev->dc;
RECT rect;
TRACE("(%x, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom);
if(!physDev->window)
return FALSE;
row1 = (dc->DCOrgY + XLPTODP(dc, top)) / physDev->cellHeight;
col1 = (dc->DCOrgX + XLPTODP(dc, left)) / physDev->cellWidth;
row2 = (dc->DCOrgY + XLPTODP(dc, bottom)) / physDev->cellHeight;
col2 = (dc->DCOrgX + XLPTODP(dc, right)) / physDev->cellWidth;
rect.left = left;
rect.top = top;
rect.right = right;
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) {
INT tmp = row1;
......@@ -259,15 +269,18 @@ COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF colo
{
#ifdef WINE_CURSES
INT row, col;
DC *dc = physDev->dc;
POINT pt;
TRACE("(%x, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color);
if(!physDev->window)
return FALSE;
row = (dc->DCOrgY + XLPTODP(dc, y)) / physDev->cellHeight;
col = (dc->DCOrgX + XLPTODP(dc, x)) / physDev->cellWidth;
pt.x = x;
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);
wrefresh(physDev->window);
......@@ -328,7 +341,8 @@ BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
INT row, col;
LPSTR ascii;
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",
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,
if(!physDev->window)
return FALSE;
pt.x = x;
pt.y = y;
/* FIXME: Is this really correct? */
if(dc->textAlign & TA_UPDATECP) {
x = dc->CursPosX;
y = dc->CursPosY;
}
x = XLPTODP(dc, x);
y = YLPTODP(dc, y);
if(text_align & TA_UPDATECP) GetCurrentPositionEx( physDev->hdc, &pt );
row = (dc->DCOrgY + y) / physDev->cellHeight;
col = (dc->DCOrgX + x) / physDev->cellWidth;
LPtoDP( physDev->hdc, &pt, 1 );
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 );
ascii = HeapAlloc( GetProcessHeap(), 0, len );
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,
HeapFree( GetProcessHeap(), 0, ascii );
wrefresh(physDev->window);
if(dc->textAlign & TA_UPDATECP) {
dc->CursPosX += count * physDev->cellWidth;
dc->CursPosY += physDev->cellHeight;
if(text_align & TA_UPDATECP)
{
pt.x += count * physDev->cellWidth;
pt.y += physDev->cellHeight;
DPtoLP( physDev->hdc, &pt, 1 );
MoveToEx( physDev->hdc, pt.x, pt.y, NULL );
}
return TRUE;
......
......@@ -61,7 +61,7 @@ typedef struct { int dummy; } WINDOW;
typedef struct {
HDC hdc;
DC *dc;
POINT org;
WINDOW *window;
int cellWidth;
int cellHeight;
......@@ -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 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_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);
......
......@@ -6,13 +6,14 @@ init TTYDRV_Init
@ 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 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 Ellipse(ptr long long long long) TTYDRV_DC_Ellipse
@ cdecl ExtFloodFill(ptr long long long long) TTYDRV_DC_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) TTYDRV_DC_ExtTextOut
@ cdecl GetBitmapBits(long ptr long) TTYDRV_GetBitmapBits
@ cdecl GetCharWidth(ptr long long ptr) TTYDRV_DC_GetCharWidth
@ cdecl GetDCOrgEx(ptr ptr) TTYDRV_GetDCOrgEx
@ cdecl GetDeviceCaps(ptr long) TTYDRV_GetDeviceCaps
@ cdecl GetPixel(ptr long long) TTYDRV_DC_GetPixel
@ cdecl GetSystemPaletteEntries(ptr long long ptr) TTYDRV_GetSystemPaletteEntries
......@@ -30,6 +31,7 @@ init TTYDRV_Init
@ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect
@ cdecl SelectFont(ptr long) TTYDRV_SelectFont
@ 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 SetPixel(ptr long long long) TTYDRV_DC_SetPixel
@ 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 )
HWND hwndLinkAfter;
#ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd );
WND *wndPtr = WIN_GetPtr( hwnd );
WINDOW *window;
INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
......@@ -70,7 +70,7 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
}
wndPtr->pDriverData = window;
}
WIN_ReleaseWndPtr( wndPtr );
WIN_ReleasePtr( wndPtr );
#else /* defined(WINE_CURSES) */
FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
......@@ -117,14 +117,14 @@ BOOL TTYDRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
BOOL TTYDRV_DestroyWindow( HWND hwnd )
{
#ifdef WINE_CURSES
WND *wndPtr = WIN_FindWndPtr( hwnd );
WND *wndPtr = WIN_GetPtr( hwnd );
WINDOW *window = wndPtr->pDriverData;
TRACE("(%x)\n", hwnd);
if (window && window != root_window) delwin(window);
wndPtr->pDriverData = NULL;
WIN_ReleaseWndPtr( wndPtr );
WIN_ReleasePtr( wndPtr );
#else /* defined(WINE_CURSES) */
FIXME("(%x): stub\n", hwnd);
#endif /* defined(WINE_CURSES) */
......@@ -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 )
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
DC *dc;
BOOL updateVisRgn;
HRGN hrgnVisible = 0;
POINT org;
......@@ -385,17 +383,9 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
org.y = wndPtr->rectClient.top;
}
if (!(dc = DC_GetDCPtr( hdc )))
{
WIN_ReleaseWndPtr( wndPtr );
return FALSE;
}
dc->DCOrgX = org.x;
dc->DCOrgY = org.y;
updateVisRgn = (dc->flags & DC_DIRTY) != 0;
GDI_ReleaseObj( hdc );
SetDCOrg16( hdc, org.x, org.y );
if (updateVisRgn)
if (SetHookFlags16( hdc, DCHF_VALIDATEVISRGN )) /* DC was dirty */
{
if (flags & DCX_PARENTCLIP)
{
......@@ -418,7 +408,6 @@ BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
else
OffsetRgn( hrgnVisible, -wndPtr->rectClient.left,
-wndPtr->rectClient.top );
OffsetRgn( hrgnVisible, org.x, org.y );
}
else
hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
......@@ -678,7 +667,6 @@ BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos )
*/
static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
{
WND *wndPtr;
UINT swpFlags = 0;
WINDOWPLACEMENT wpl;
......@@ -691,11 +679,8 @@ static UINT WINPOS_MinMaximize( HWND hwnd, UINT cmd, LPRECT rect )
/* If I glark this right, yields an immutable window*/
swpFlags = SWP_NOSIZE | SWP_NOMOVE;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
/*cmd handling goes here. see dlls/x1drv/winpos.c*/
WIN_ReleaseWndPtr( wndPtr );
return swpFlags;
}
......
......@@ -229,7 +229,7 @@ static void PSDRV_UpdateDevCaps( PSDRV_PDEVICE *physDev )
/**********************************************************************
* 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 )
{
PSDRV_PDEVICE *physDev;
......@@ -238,9 +238,9 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/* If no device name was specified, retrieve the device name
* from the DEVMODE structure from the DC's physDev.
* (See CreateCompatibleDC) */
if ( !device && dc->physDev )
if ( !device && *pdev )
{
physDev = (PSDRV_PDEVICE *)dc->physDev;
physDev = *pdev;
device = physDev->Devmode->dmPublic.dmDeviceName;
}
pi = PSDRV_FindPrinterInfo(device);
......@@ -257,7 +257,7 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
sizeof(*physDev) );
if (!physDev) return FALSE;
dc->physDev = (PHYSDEV)physDev;
*pdev = physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
......@@ -300,7 +300,6 @@ BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev )
HeapFree( PSDRV_Heap, 0, physDev->Devmode );
HeapFree( PSDRV_Heap, 0, physDev->job.output );
physDev->dc->physDev = NULL;
HeapFree( PSDRV_Heap, 0, physDev );
return TRUE;
......
......@@ -5,7 +5,7 @@ init PSDRV_Init
@ 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 CreateDC(ptr str str str ptr) PSDRV_CreateDC
@ cdecl CreateDC(ptr ptr str str str ptr) PSDRV_CreateDC
@ cdecl DeleteDC(ptr) PSDRV_DeleteDC
@ cdecl DeviceCapabilities(ptr ptr ptr long ptr ptr) PSDRV_DeviceCapabilities
@ cdecl Ellipse(ptr long long long long) PSDRV_Ellipse
......
......@@ -426,7 +426,7 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
X11DRV_WND_DATA *data = win->pDriverData;
Drawable drawable;
BOOL visible;
POINT org;
POINT org, drawable_org;
int mode = IncludeInferiors;
/* don't clip siblings if using parent clip region */
......@@ -466,7 +466,9 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
org.x = win->rectWindow.left - win->rectClient.left;
org.y = win->rectWindow.top - win->rectClient.top;
}
drawable_org = org;
MapWindowPoints( hwnd, parent, &org, 1 );
MapWindowPoints( hwnd, 0, &drawable_org, 1 );
/* have to use the parent so that we include siblings */
if (parent) drawable = X11DRV_get_client_window( parent );
else drawable = root_window;
......@@ -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;
org.x = 0;
org.y = 0;
drawable_org = org;
}
else if (flags & DCX_WINDOW)
{
drawable = data->whole_window;
org.x = win->rectWindow.left - data->whole_rect.left;
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
{
drawable = data->client_window;
org.x = 0;
org.y = 0;
drawable_org = org;
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) ||
SetHookFlags16( hdc, DCHF_VALIDATEVISRGN )) /* DC was dirty */
......@@ -509,9 +516,6 @@ BOOL X11DRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
if (flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN))
CombineRgn( visRgn, visRgn, hrgn,
(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 );
......
......@@ -8,7 +8,7 @@ init X11DRV_Init
@ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat
@ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord
@ 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 DeleteBitmap(long) X11DRV_DeleteBitmap
@ cdecl DeleteDC(ptr) X11DRV_DeleteDC
......@@ -49,6 +49,7 @@ init X11DRV_Init
@ cdecl SelectPen(ptr long) X11DRV_SelectPen
@ cdecl SetBitmapBits(long ptr long) X11DRV_SetBitmapBits
@ cdecl SetBkColor(ptr long) X11DRV_SetBkColor
@ cdecl SetDCOrg(ptr long long) X11DRV_SetDCOrg
@ cdecl SetDIBColorTable(ptr long long ptr) X11DRV_SetDIBColorTable
@ cdecl SetDIBits(ptr long long long ptr ptr long) X11DRV_SetDIBits
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice
......
......@@ -637,7 +637,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
if(flags & ETO_OPAQUE) {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
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 );
}
......@@ -735,7 +735,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
{
wine_tsx11_lock();
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();
HeapFree( GetProcessHeap(), 0, data );
}
......@@ -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) {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
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 );
}
}
......@@ -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,
dc->DCOrgY + y);
TRACE("Writing %s at %ld,%ld\n", debugstr_wn(wstr,count),
physDev->org.x + x, physDev->org.y + y);
wine_tsx11_lock();
if(!lpDx)
......@@ -819,7 +820,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->pict,
physDev->xrender->cacheEntry->font_format,
physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x, dc->DCOrgY + y,
0, 0, physDev->org.x + x, physDev->org.y + y,
glyphs, count);
else {
......@@ -830,8 +831,8 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag
physDev->xrender->pict,
physDev->xrender->cacheEntry->font_format,
physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x + xoff,
dc->DCOrgY + y + yoff,
0, 0, physDev->org.x + x + xoff,
physDev->org.y + y + yoff,
glyphs + idx, 1);
offset += INTERNAL_XWSTODS(dc, lpDx[idx]);
xoff = offset * cosEsc;
......
......@@ -117,7 +117,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn )
RGNDATA *data;
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 );
HeapFree( GetProcessHeap(), 0, data );
}
......@@ -128,27 +128,17 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn )
*
* 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 );
if (dc)
{
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/*
* This function change the coordinate system (DCOrgX,DCOrgY)
* 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->org = *org;
physDev->drawable = drawable;
physDev->drawable_org = *drawable_org;
TSXSetSubwindowMode( gdi_display, physDev->gc, mode );
if(physDev->xrender)
X11DRV_XRender_UpdateDrawable( physDev );
......@@ -202,8 +192,8 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
if (event.type == NoExpose) break;
if (event.type == GraphicsExpose)
{
int x = event.xgraphicsexpose.x - dc->DCOrgX;
int y = event.xgraphicsexpose.y - dc->DCOrgY;
int x = event.xgraphicsexpose.x - physDev->org.x;
int y = event.xgraphicsexpose.y - physDev->org.y;
TRACE( "got %d,%d %dx%d count %d\n",
x, y, event.xgraphicsexpose.width, event.xgraphicsexpose.height,
......@@ -228,4 +218,3 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
GDI_ReleaseObj( hdc );
}
}
......@@ -4796,8 +4796,8 @@ INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest, INT yDest, DWO
descr.xSrc = xSrc;
descr.ySrc = tmpheight >= 0 ? lines-(ySrc-startscan)-cy+(oldcy-cy)
: ySrc - startscan;
descr.xDest = dc->DCOrgX + XLPTODP( dc, xDest );
descr.yDest = dc->DCOrgY + YLPTODP( dc, yDest ) +
descr.xDest = physDev->org.x + XLPTODP( dc, xDest );
descr.yDest = physDev->org.y + YLPTODP( dc, yDest ) +
(tmpheight >= 0 ? oldcy-cy : 0);
descr.width = cx;
descr.height = cy;
......@@ -5178,7 +5178,8 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD
}
/* perform the copy */
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);
/* free color mapping */
if (aColorMap)
......
......@@ -87,7 +87,7 @@ void X11DRV_GDI_Finalize(void)
/**********************************************************************
* 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 )
{
X11DRV_PDEVICE *physDev;
......@@ -99,7 +99,7 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
ERR("Can't allocate physDev\n");
return FALSE;
}
dc->physDev = (PHYSDEV)physDev;
*pdev = physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc; /* FIXME */
......@@ -112,6 +112,8 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
physDev->drawable = root_window;
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->used_visuals = 0;
......@@ -131,8 +133,6 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
*/
BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev )
{
DC *dc = physDev->dc;
if(physDev->xrender)
X11DRV_XRender_DeleteDC( physDev );
wine_tsx11_lock();
......@@ -141,7 +141,6 @@ BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev )
XFree(physDev->visuals[physDev->used_visuals]);
wine_tsx11_unlock();
HeapFree( GetProcessHeap(), 0, physDev );
dc->physDev = NULL;
return TRUE;
}
......
......@@ -135,8 +135,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
dibUpdateFlag = TRUE;
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + rect.left, dc->DCOrgY + rect.top,
rect.right-rect.left, rect.bottom-rect.top );
physDev->org.x + rect.left, physDev->org.y + rect.top,
rect.right-rect.left, rect.bottom-rect.top );
}
if (!count) goto END; /* Nothing more to do */
......@@ -235,10 +235,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x,
dc->DCOrgY + y - ascent,
width,
ascent + descent );
physDev->org.x + x, physDev->org.y + y - ascent,
width, ascent + descent );
}
}
}
......@@ -254,7 +252,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
{
X11DRV_cptable[pfo->fi->cptable].pDrawString(
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... */
{
......@@ -326,7 +324,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
X11DRV_cptable[pfo->fi->cptable].pDrawText( pfo, gdi_display,
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 );
}
}
......@@ -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)
- 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 );
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 );
X11DRV_cptable[pfo->fi->cptable].pDrawString(
......@@ -380,8 +378,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
TSXSetLineAttributes( gdi_display, physDev->gc, lineWidth,
LineSolid, CapRound, JoinBevel );
TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y + linePos,
dc->DCOrgX + x + width, dc->DCOrgY + y + linePos );
physDev->org.x + x, physDev->org.y + y + linePos,
physDev->org.x + x + width, physDev->org.y + y + linePos );
}
if (lfStrikeOut)
{
......@@ -393,8 +391,8 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
TSXSetLineAttributes( gdi_display, physDev->gc, lineAscent + lineDescent,
LineSolid, CapRound, JoinBevel );
TSXDrawLine( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + x, dc->DCOrgY + y - lineAscent,
dc->DCOrgX + x + width, dc->DCOrgY + y - lineAscent );
physDev->org.x + x, physDev->org.y + y - lineAscent,
physDev->org.x + x + width, physDev->org.y + y - lineAscent );
}
if (flags & ETO_CLIPPED) RestoreVisRgn16( dc->hSelf );
......
......@@ -131,8 +131,6 @@ typedef struct tagDC
INT MapMode;
INT GraphicsMode; /* Graphics mode */
INT DCOrgX; /* DC origin */
INT DCOrgY;
ABORTPROC pAbortProc; /* AbortProc for Printing */
ABORTPROC16 pAbortProc16;
INT CursPosX; /* Current position */
......@@ -162,7 +160,7 @@ typedef struct tagDC_FUNCS
BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(PHYSDEV);
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);
BOOL (*pDeleteBitmap)(HBITMAP);
BOOL (*pDeleteDC)(PHYSDEV);
......@@ -232,6 +230,7 @@ typedef struct tagDC_FUNCS
LONG (*pSetBitmapBits)(HBITMAP,const void*,LONG);
COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
INT (*pSetBkMode)(PHYSDEV,INT);
DWORD (*pSetDCOrg)(PHYSDEV,INT,INT);
UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
......
......@@ -82,6 +82,8 @@ typedef struct
DC *dc; /* direct pointer to DC, should go away */
GC gc; /* X Window GC */
Drawable drawable;
POINT org; /* DC origin relative to drawable */
POINT drawable_org; /* Origin of drawable relative to screen */
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
......@@ -193,7 +195,8 @@ extern Pixmap X11DRV_DIB_CreatePixmapFromDIB( HGLOBAL hPackedDIB, HDC hdc );
extern Pixmap X11DRV_BITMAP_CreatePixmapFromBitmap( HBITMAP hBmp, HDC hdc );
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_EndGraphicsExposures( HDC hdc, HRGN hrgn );
......
......@@ -121,12 +121,10 @@ INT WINAPI ExtSelectClipRgn( HDC hdc, HRGN hrgn, INT fnMode )
dc->hClipRgn = CreateRectRgnIndirect( &rect );
}
OffsetRgn( dc->hClipRgn, -dc->DCOrgX, -dc->DCOrgY );
if(fnMode == RGN_COPY)
retval = CombineRgn( dc->hClipRgn, hrgn, 0, fnMode );
else
retval = CombineRgn( dc->hClipRgn, dc->hClipRgn, hrgn, fnMode);
OffsetRgn( dc->hClipRgn, dc->DCOrgX, dc->DCOrgY );
}
CLIPPING_UpdateGCRegion( dc );
......@@ -230,10 +228,10 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
else
{
left = dc->DCOrgX + XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom );
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
if (!(newRgn = CreateRectRgn( left, top, right, bottom ))) ret = ERROR;
else
......@@ -279,10 +277,10 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
else
{
left = dc->DCOrgX + XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom );
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
if (!dc->hClipRgn)
{
......@@ -318,10 +316,10 @@ INT16 WINAPI ExcludeVisRect16( HDC16 hdc, INT16 left, INT16 top,
DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
left = dc->DCOrgX + XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom );
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, 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,
DC * dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
left = dc->DCOrgX + XLPTODP( dc, left );
right = dc->DCOrgX + XLPTODP( dc, right );
top = dc->DCOrgY + YLPTODP( dc, top );
bottom = dc->DCOrgY + YLPTODP( dc, bottom );
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, 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 )
if (!dc) return FALSE;
if (dc->hGCClipRgn)
{
ret = PtInRegion( dc->hGCClipRgn, XLPTODP(dc,x) + dc->DCOrgX,
YLPTODP(dc,y) + dc->DCOrgY );
ret = PtInRegion( dc->hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
}
GDI_ReleaseObj( hdc );
return ret;
......@@ -424,10 +421,6 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
/* copy rectangle to avoid overwriting by LPtoDP */
tmpRect = *rect;
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 );
}
GDI_ReleaseObj( hdc );
......@@ -444,10 +437,6 @@ INT16 WINAPI GetClipBox16( HDC16 hdc, LPRECT16 rect )
DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
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 );
TRACE("%d,%d-%d,%d\n", rect->left,rect->top,rect->right,rect->bottom );
GDI_ReleaseObj( hdc );
......@@ -464,10 +453,6 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
DC *dc = DC_GetDCUpdate( hdc );
if (!dc) return ERROR;
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 );
GDI_ReleaseObj( hdc );
return ret;
......@@ -485,14 +470,7 @@ INT WINAPI GetClipRgn( HDC hdc, HRGN hRgn )
{
if( dc->hClipRgn )
{
/* this assumes that dc->hClipRgn is in coordinates
relative to the device (not DC origin) */
if( CombineRgn(hRgn, dc->hClipRgn, 0, RGN_COPY) != ERROR )
{
OffsetRgn( hRgn, -dc->DCOrgX, -dc->DCOrgY );
ret = 1;
}
if( CombineRgn(hRgn, dc->hClipRgn, 0, RGN_COPY) != ERROR ) ret = 1;
}
else ret = 0;
GDI_ReleaseObj( hdc );
......
......@@ -107,8 +107,6 @@ DC *DC_AllocDC( const DC_FUNCTIONS *funcs )
dc->bitsPerPixel = 1;
dc->MapMode = MM_TEXT;
dc->GraphicsMode = GM_COMPATIBLE;
dc->DCOrgX = 0;
dc->DCOrgY = 0;
dc->pAbortProc = NULL;
dc->CursPosX = 0;
dc->CursPosY = 0;
......@@ -310,11 +308,6 @@ HDC16 WINAPI GetDCState16( HDC16 hdc )
newdc->breakRem = dc->breakRem;
newdc->MapMode = dc->MapMode;
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->CursPosY = dc->CursPosY;
newdc->ArcDirection = dc->ArcDirection;
......@@ -403,11 +396,6 @@ void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs )
dc->breakRem = dcs->breakRem;
dc->MapMode = dcs->MapMode;
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->CursPosY = dcs->CursPosY;
dc->ArcDirection = dcs->ArcDirection;
......@@ -620,7 +608,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf );
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" );
GDI_FreeObject( dc->hSelf, dc );
......@@ -740,7 +728,7 @@ HDC WINAPI CreateCompatibleDC( HDC hdc )
if ((origDC = GDI_GetObjPtr( hdc, DC_MAGIC ))) dc->physDev = origDC->physDev;
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");
GDI_FreeObject( dc->hSelf, dc );
......@@ -820,6 +808,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
funcs = dc->funcs;
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
dc->physDev = NULL;
}
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
......@@ -1003,8 +992,6 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
lpp->x = lpp->y = 0;
if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
lpp->x += dc->DCOrgX;
lpp->y += dc->DCOrgY;
GDI_ReleaseObj( hDC );
return TRUE;
}
......@@ -1027,12 +1014,10 @@ DWORD WINAPI GetDCOrg16( HDC16 hdc )
*/
DWORD WINAPI SetDCOrg16( HDC16 hdc, INT16 x, INT16 y )
{
DWORD prevOrg;
DWORD prevOrg = 0;
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return 0;
prevOrg = dc->DCOrgX | (dc->DCOrgY << 16);
dc->DCOrgX = x;
dc->DCOrgY = y;
if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y );
GDI_ReleaseObj( hdc );
return prevOrg;
}
......
......@@ -2920,8 +2920,6 @@ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode)
GetDCOrgEx(hDC, &org);
else
org.x = org.y = 0;
org.x -= dc->DCOrgX;
org.y -= dc->DCOrgY;
OffsetRgn (hRgn, org.x, org.y);
GDI_ReleaseObj( hDC );
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