diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index 20b33b14917..ea03910dbbc 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -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); diff --git a/dlls/gdi/enhmfdrv/init.c b/dlls/gdi/enhmfdrv/init.c index 84249df5cce..dac30272df0 100644 --- a/dlls/gdi/enhmfdrv/init.c +++ b/dlls/gdi/enhmfdrv/init.c @@ -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 */ diff --git a/dlls/gdi/mfdrv/init.c b/dlls/gdi/mfdrv/init.c index e2457b9241d..b67d505a5dc 100644 --- a/dlls/gdi/mfdrv/init.c +++ b/dlls/gdi/mfdrv/init.c @@ -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 */ diff --git a/dlls/gdi/win16drv/graphics.c b/dlls/gdi/win16drv/graphics.c index f3dd7d92029..321c48fca10 100644 --- a/dlls/gdi/win16drv/graphics.c +++ b/dlls/gdi/win16drv/graphics.c @@ -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; } - - - - - - - - diff --git a/dlls/gdi/win16drv/init.c b/dlls/gdi/win16drv/init.c index cb6c39deca6..225512faee8 100644 --- a/dlls/gdi/win16drv/init.c +++ b/dlls/gdi/win16drv/init.c @@ -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) diff --git a/dlls/gdi/win16drv/win16drv.h b/dlls/gdi/win16drv/win16drv.h index 6880a767444..26aa201275d 100644 --- a/dlls/gdi/win16drv/win16drv.h +++ b/dlls/gdi/win16drv/win16drv.h @@ -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 */ - diff --git a/dlls/ttydrv/dc.c b/dlls/ttydrv/dc.c index 95f9efdd230..6b17ad20320 100644 --- a/dlls/ttydrv/dc.c +++ b/dlls/ttydrv/dc.c @@ -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; +} diff --git a/dlls/ttydrv/graphics.c b/dlls/ttydrv/graphics.c index afe08d494d6..9f606940a2e 100644 --- a/dlls/ttydrv/graphics.c +++ b/dlls/ttydrv/graphics.c @@ -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; - } + if(text_align & TA_UPDATECP) GetCurrentPositionEx( physDev->hdc, &pt ); - x = XLPTODP(dc, x); - y = YLPTODP(dc, y); - - 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; diff --git a/dlls/ttydrv/ttydrv.h b/dlls/ttydrv/ttydrv.h index cc817a02318..f3ed8bb730e 100644 --- a/dlls/ttydrv/ttydrv.h +++ b/dlls/ttydrv/ttydrv.h @@ -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); diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec index 05650046d29..28c15ac6b88 100644 --- a/dlls/ttydrv/ttydrv.spec +++ b/dlls/ttydrv/ttydrv.spec @@ -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 diff --git a/dlls/ttydrv/wnd.c b/dlls/ttydrv/wnd.c index 7915d30d546..96e5d3411b7 100644 --- a/dlls/ttydrv/wnd.c +++ b/dlls/ttydrv/wnd.c @@ -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; } diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index a2d608360d1..e28be99f52d 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -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; diff --git a/dlls/wineps/wineps.spec b/dlls/wineps/wineps.spec index 4b2fbfeb21a..62db307a595 100644 --- a/dlls/wineps/wineps.spec +++ b/dlls/wineps/wineps.spec @@ -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 diff --git a/dlls/x11drv/winpos.c b/dlls/x11drv/winpos.c index 78c6628a56e..c4be59f694c 100644 --- a/dlls/x11drv/winpos.c +++ b/dlls/x11drv/winpos.c @@ -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 ); diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index 8da676abcc8..d9022b9f1e2 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -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 diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index 96a1a306d35..b29b2b968d5 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -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; diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c index 5dd2904504e..118a457704f 100644 --- a/graphics/x11drv/bitblt.c +++ b/graphics/x11drv/bitblt.c @@ -888,7 +888,8 @@ static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE /* FIXME: avoid BadMatch errors */ imageSrc = XGetImage( gdi_display, physDevSrc->drawable, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, visRectSrc->right - visRectSrc->left, visRectSrc->bottom - visRectSrc->top, AllPlanes, ZPixmap ); @@ -939,25 +940,30 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe XSetBackground( gdi_display, gc, physDevDst->textPixel ); XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, width, height, 0, 0, 1); } else XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, - visRectSrc->left, visRectSrc->top, width, height, 0, 0); + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, + width, height, 0, 0); exposures++; } else /* color -> color */ { if (dcSrc->flags & DC_MEMORY) imageSrc = XGetImage( gdi_display, physDevSrc->drawable, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, width, height, AllPlanes, ZPixmap ); else { /* Make sure we don't get a BadMatch error */ XCopyArea( gdi_display, physDevSrc->drawable, pixmap, gc, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, width, height, 0, 0); exposures++; imageSrc = XGetImage( gdi_display, pixmap, 0, 0, width, height, @@ -989,7 +995,8 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe XSetForeground( gdi_display, gc, physDevDst->backgroundPixel ); } XCopyPlane( gdi_display, physDevSrc->drawable, pixmap, gc, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, width, height, 0, 0, 1 ); exposures++; } @@ -997,7 +1004,8 @@ static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDe { /* FIXME: avoid BadMatch error */ imageSrc = XGetImage( gdi_display, physDevSrc->drawable, - visRectSrc->left, visRectSrc->top, + physDevSrc->org.x + visRectSrc->left, + physDevSrc->org.y + visRectSrc->top, width, height, AllPlanes, ZPixmap ); imageDst = X11DRV_DIB_CreateXImage( width, height, dcDst->bitsPerPixel ); for (y = 0; y < height; y++) @@ -1030,7 +1038,8 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) { XCopyArea( gdi_display, physDev->drawable, pixmap, gc, - visRectDst->left, visRectDst->top, width, height, 0, 0 ); + physDev->org.x + visRectDst->left, physDev->org.y + visRectDst->top, + width, height, 0, 0 ); exposures++; } else @@ -1040,13 +1049,16 @@ static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT if (physDev->dc->flags & DC_MEMORY) image = XGetImage( gdi_display, physDev->drawable, - visRectDst->left, visRectDst->top, + physDev->org.x + visRectDst->left, + physDev->org.y + visRectDst->top, width, height, AllPlanes, ZPixmap ); else { /* Make sure we don't get a BadMatch error */ XCopyArea( gdi_display, physDev->drawable, pixmap, gc, - visRectDst->left, visRectDst->top, width, height, 0, 0); + physDev->org.x + visRectDst->left, + physDev->org.y + visRectDst->top, + width, height, 0, 0); exposures++; image = XGetImage( gdi_display, pixmap, 0, 0, width, height, AllPlanes, ZPixmap ); @@ -1079,8 +1091,9 @@ static int BITBLT_PutDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, RECT *visRe if (!X11DRV_PALETTE_PaletteToXPixel || (physDev->dc->bitsPerPixel == 1) || (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) { - XCopyArea( gdi_display, pixmap, physDev->drawable, physDev->gc, 0, 0, - width, height, visRectDst->left, visRectDst->top ); + XCopyArea( gdi_display, pixmap, physDev->drawable, physDev->gc, 0, 0, width, height, + physDev->org.x + visRectDst->left, + physDev->org.y + visRectDst->top ); exposures++; } else @@ -1095,7 +1108,8 @@ static int BITBLT_PutDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, RECT *visRe X11DRV_PALETTE_PaletteToXPixel[XGetPixel( image, x, y )]); } XPutImage( gdi_display, physDev->drawable, physDev->gc, image, 0, 0, - visRectDst->left, visRectDst->top, width, height ); + physDev->org.x + visRectDst->left, + physDev->org.y + visRectDst->top, width, height ); XDestroyImage( image ); } return exposures; @@ -1230,8 +1244,8 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT /* Map the coordinates to device coords */ - xDst = dcDst->DCOrgX + XLPTODP( dcDst, xDst ); - yDst = dcDst->DCOrgY + YLPTODP( dcDst, yDst ); + xDst = XLPTODP( dcDst, xDst ); + yDst = YLPTODP( dcDst, yDst ); /* Here we have to round to integers, not truncate */ widthDst = MulDiv(widthDst, dcDst->vportExtX, dcDst->wndExtX); @@ -1242,14 +1256,14 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT dcDst->vportExtX, dcDst->vportExtY, dcDst->wndOrgX, dcDst->wndOrgY, dcDst->wndExtX, dcDst->wndExtY ); - TRACE(" rectdst=%d,%d-%d,%d orgdst=%d,%d\n", + TRACE(" rectdst=%d,%d-%d,%d orgdst=%ld,%ld\n", xDst, yDst, widthDst, heightDst, - dcDst->DCOrgX, dcDst->DCOrgY ); + physDevDst->org.x, physDevDst->org.y ); if (useSrc) { - xSrc = dcSrc->DCOrgX + XLPTODP( dcSrc, xSrc ); - ySrc = dcSrc->DCOrgY + YLPTODP( dcSrc, ySrc ); + xSrc = XLPTODP( dcSrc, xSrc ); + ySrc = YLPTODP( dcSrc, ySrc ); widthSrc = widthSrc * dcSrc->vportExtX / dcSrc->wndExtX; heightSrc = heightSrc * dcSrc->vportExtY / dcSrc->wndExtY; fStretch = (widthSrc != widthDst) || (heightSrc != heightDst); @@ -1258,9 +1272,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT dcSrc->vportExtX, dcSrc->vportExtY, dcSrc->wndOrgX, dcSrc->wndOrgY, dcSrc->wndExtX, dcSrc->wndExtY ); - TRACE(" rectsrc=%d,%d-%d,%d orgsrc=%d,%d\n", + TRACE(" rectsrc=%d,%d-%d,%d orgsrc=%ld,%ld\n", xSrc, ySrc, widthSrc, heightSrc, - dcSrc->DCOrgX, dcSrc->DCOrgY ); + physDevSrc->org.x, physDevSrc->org.y ); if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, widthDst, heightDst, dcSrc, xSrc, ySrc, widthSrc, heightSrc, &visRectSrc, &visRectDst )) @@ -1298,7 +1312,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); return TRUE; @@ -1323,7 +1339,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); return TRUE; } @@ -1336,7 +1354,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT wine_tsx11_lock(); XSetFunction( gdi_display, physDevDst->gc, GXxor ); XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); } return TRUE; @@ -1348,7 +1368,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT wine_tsx11_lock(); XSetFunction( gdi_display, physDevDst->gc, GXequiv ); XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); } return TRUE; @@ -1360,8 +1382,11 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT XSetFunction( gdi_display, physDevDst->gc, GXcopy ); XCopyArea( gdi_display, physDevSrc->drawable, physDevDst->drawable, physDevDst->gc, - visRectSrc.left, visRectSrc.top, - width, height, visRectDst.left, visRectDst.top ); + physDevSrc->org.x + visRectSrc.left, + physDevSrc->org.y + visRectSrc.top, + width, height, + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top ); physDevDst->exposures++; wine_tsx11_unlock(); return TRUE; @@ -1374,8 +1399,11 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT XSetFunction( gdi_display, physDevDst->gc, GXcopy ); XCopyPlane( gdi_display, physDevSrc->drawable, physDevDst->drawable, physDevDst->gc, - visRectSrc.left, visRectSrc.top, - width, height, visRectDst.left, visRectDst.top, 1 ); + physDevSrc->org.x + visRectSrc.left, + physDevSrc->org.y + visRectSrc.top, + width, height, + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, 1 ); physDevDst->exposures++; wine_tsx11_unlock(); return TRUE; @@ -1387,7 +1415,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT wine_tsx11_lock(); XSetFunction( gdi_display, physDevDst->gc, GXcopy ); XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); return TRUE; @@ -1403,7 +1433,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT XSetFillStyle( gdi_display, physDevDst->gc, FillSolid ); } XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, - visRectDst.left, visRectDst.top, width, height ); + physDevDst->org.x + visRectDst.left, + physDevDst->org.y + visRectDst.top, + width, height ); wine_tsx11_unlock(); return TRUE; } @@ -1522,17 +1554,17 @@ BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)) { /* do everything ourselves; map coordinates */ - xSrc = dcSrc->DCOrgX + XLPTODP( dcSrc, xSrc ); - ySrc = dcSrc->DCOrgY + YLPTODP( dcSrc, ySrc ); - xDst = dcDst->DCOrgX + XLPTODP( dcDst, xDst ); - yDst = dcDst->DCOrgY + YLPTODP( dcDst, yDst ); + xSrc = XLPTODP( dcSrc, xSrc ); + ySrc = YLPTODP( dcSrc, ySrc ); + xDst = XLPTODP( dcDst, xDst ); + yDst = YLPTODP( dcDst, yDst ); width = MulDiv(width, dcDst->vportExtX, dcDst->wndExtX); height = MulDiv(height, dcDst->vportExtY, dcDst->wndExtY); /* Perform basic clipping */ if (!BITBLT_GetVisRectangles( dcDst, xDst, yDst, width, height, - dcSrc, xSrc, ySrc, width, height, - &visRectSrc, &visRectDst )) + dcSrc, xSrc, ySrc, width, height, + &visRectSrc, &visRectDst )) goto END; xSrc = visRectSrc.left; @@ -1586,4 +1618,3 @@ BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, X11DRV_UnlockDIBSection( physDevDst, TRUE ); return result; } - diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c index cd74b846370..daabf3d61f5 100644 --- a/graphics/x11drv/clipping.c +++ b/graphics/x11drv/clipping.c @@ -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 ); } } - diff --git a/graphics/x11drv/dib.c b/graphics/x11drv/dib.c index 9d4e02382d1..56a48517341 100644 --- a/graphics/x11drv/dib.c +++ b/graphics/x11drv/dib.c @@ -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) diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c index 2f202492665..6c55f8b7505 100644 --- a/graphics/x11drv/graphics.c +++ b/graphics/x11drv/graphics.c @@ -85,7 +85,7 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) XGCValues val; unsigned long mask; Pixmap pixmap = 0; - DC *dc = physDev->dc; + POINT pt; if (physDev->brush.style == BS_NULL) return FALSE; if (physDev->brush.pixel == -1) @@ -108,7 +108,7 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) val.background = X11DRV_PALETTE_XPixelToPalette[val.background]; } - val.function = X11DRV_XROPfunction[dc->ROPmode-1]; + val.function = X11DRV_XROPfunction[GetROP2(physDev->hdc)-1]; /* ** Let's replace GXinvert by GXxor with (black xor white) ** This solves the selection color and leak problems in excel @@ -125,7 +125,7 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) { case FillStippled: case FillOpaqueStippled: - if (GetBkMode(dc->hSelf)==OPAQUE) val.fill_style = FillOpaqueStippled; + if (GetBkMode(physDev->hdc)==OPAQUE) val.fill_style = FillOpaqueStippled; val.stipple = physDev->brush.pixmap; mask = GCStipple; break; @@ -156,14 +156,17 @@ BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors ) mask = 0; break; } - val.ts_x_origin = dc->DCOrgX + dc->brushOrgX; - val.ts_y_origin = dc->DCOrgY + dc->brushOrgY; + GetBrushOrgEx( physDev->hdc, &pt ); + val.ts_x_origin = physDev->org.x + pt.x; + val.ts_y_origin = physDev->org.y + pt.y; val.fill_rule = (GetPolyFillMode(physDev->hdc) == WINDING) ? WindingRule : EvenOddRule; - TSXChangeGC( gdi_display, gc, + wine_tsx11_lock(); + XChangeGC( gdi_display, gc, GCFunction | GCForeground | GCBackground | GCFillStyle | GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask, &val ); - if (pixmap) TSXFreePixmap( gdi_display, pixmap ); + if (pixmap) XFreePixmap( gdi_display, pixmap ); + wine_tsx11_unlock(); return TRUE; } @@ -189,11 +192,11 @@ BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev ) BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev ) { XGCValues val; - DC *dc = physDev->dc; + UINT rop2 = GetROP2(physDev->hdc); if (physDev->pen.style == PS_NULL) return FALSE; - switch (dc->ROPmode) + switch (rop2) { case R2_BLACK : val.foreground = BlackPixel( gdi_display, DefaultScreen(gdi_display) ); @@ -214,7 +217,7 @@ BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev ) break; default : val.foreground = physDev->pen.pixel; - val.function = X11DRV_XROPfunction[dc->ROPmode-1]; + val.function = X11DRV_XROPfunction[rop2-1]; } val.background = physDev->backgroundPixel; val.fill_style = FillSolid; @@ -223,7 +226,7 @@ BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev ) (physDev->pen.style != PS_INSIDEFRAME)) { TSXSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len ); - val.line_style = (GetBkMode(dc->hSelf) == OPAQUE) ? LineDoubleDash : LineOnOffDash; + val.line_style = (GetBkMode(physDev->hdc) == OPAQUE) ? LineDoubleDash : LineOnOffDash; } else val.line_style = LineSolid; val.line_width = physDev->pen.width; @@ -297,26 +300,20 @@ BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev ) BOOL X11DRV_LineTo( X11DRV_PDEVICE *physDev, INT x, INT y ) { - DC *dc = physDev->dc; - POINT start; - POINT end; + POINT pt[2]; if (X11DRV_SetupGCForPen( physDev )) { /* Update the pixmap from the DIB section */ X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE); - start.x = dc->CursPosX; - start.y = dc->CursPosY; - end.x = x; - end.y = y; - INTERNAL_LPTODP(dc,&start); - INTERNAL_LPTODP(dc,&end); + GetCurrentPositionEx( physDev->hdc, &pt[0] ); + pt[1].x = x; + pt[1].y = y; + LPtoDP( physDev->hdc, pt, 2 ); TSXDrawLine(gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + start.x, - dc->DCOrgY + start.y, - dc->DCOrgX + end.x, - dc->DCOrgY + end.y); + physDev->org.x + pt[0].x, physDev->org.y + pt[0].y, + physDev->org.x + pt[1].x, physDev->org.y + pt[1].y ); /* Update the DIBSection from the pixmap */ X11DRV_UnlockDIBSection(physDev, TRUE); @@ -410,8 +407,8 @@ X11DRV_DrawArc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, if ((lines > 0) && X11DRV_SetupGCForBrush( physDev )) { TSXSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice); TSXFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, - right-left-1, bottom-top-1, istart_angle, idiff_angle ); + physDev->org.x + left, physDev->org.y + top, + right-left-1, bottom-top-1, istart_angle, idiff_angle ); update = TRUE; } @@ -419,20 +416,20 @@ X11DRV_DrawArc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, if (X11DRV_SetupGCForPen( physDev )){ TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right-left-1, bottom-top-1, istart_angle, idiff_angle ); if (lines) { /* use the truncated values */ start_angle=(double)istart_angle*PI/64./180.; end_angle=(double)(istart_angle+idiff_angle)*PI/64./180.; /* calculate the endpoints and round correctly */ - points[0].x = (int) floor(dc->DCOrgX + (right+left)/2.0 + + points[0].x = (int) floor(physDev->org.x + (right+left)/2.0 + cos(start_angle) * (right-left-width*2+2) / 2. + 0.5); - points[0].y = (int) floor(dc->DCOrgY + (top+bottom)/2.0 - + points[0].y = (int) floor(physDev->org.y + (top+bottom)/2.0 - sin(start_angle) * (bottom-top-width*2+2) / 2. + 0.5); - points[1].x = (int) floor(dc->DCOrgX + (right+left)/2.0 + + points[1].x = (int) floor(physDev->org.x + (right+left)/2.0 + cos(end_angle) * (right-left-width*2+2) / 2. + 0.5); - points[1].y = (int) floor(dc->DCOrgY + (top+bottom)/2.0 - + points[1].y = (int) floor(physDev->org.y + (top+bottom)/2.0 - sin(end_angle) * (bottom-top-width*2+2) / 2. + 0.5); /* OK, this stuff is optimized for Xfree86 @@ -446,8 +443,8 @@ X11DRV_DrawArc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, if (lines == 2) { INT dx1,dy1; points[3] = points[1]; - points[1].x = dc->DCOrgX + xcenter; - points[1].y = dc->DCOrgY + ycenter; + points[1].x = physDev->org.x + xcenter; + points[1].y = physDev->org.y + ycenter; points[2] = points[1]; dx1=points[1].x-points[0].x; dy1=points[1].y-points[0].y; @@ -565,14 +562,14 @@ X11DRV_Ellipse( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT botto if (X11DRV_SetupGCForBrush( physDev )) { TSXFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right-left-1, bottom-top-1, 0, 360*64 ); update = TRUE; } if (X11DRV_SetupGCForPen( physDev )) { TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right-left-1, bottom-top-1, 0, 360*64 ); update = TRUE; } @@ -634,15 +631,15 @@ X11DRV_Rectangle(X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bott if (X11DRV_SetupGCForBrush( physDev )) { TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + (width + 1) / 2, - dc->DCOrgY + top + (width + 1) / 2, + physDev->org.x + left + (width + 1) / 2, + physDev->org.y + top + (width + 1) / 2, right-left-width-1, bottom-top-width-1); update = TRUE; } if (X11DRV_SetupGCForPen( physDev )) { TSXDrawRectangle( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right-left-1, bottom-top-1 ); update = TRUE; } @@ -714,61 +711,61 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, if (ell_width > (right-left) ) if (ell_height > (bottom-top) ) XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right - left - 1, bottom - top - 1, 0, 360 * 64 ); else{ XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right - left - 1, ell_height, 0, 180 * 64 ); XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + bottom - ell_height - 1, + physDev->org.x + left, + physDev->org.y + bottom - ell_height - 1, right - left - 1, ell_height, 180 * 64, 180 * 64 ); } else if (ell_height > (bottom-top) ){ XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, ell_width, bottom - top - 1, 90 * 64, 180 * 64 ); XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width -1, dc->DCOrgY + top, + physDev->org.x + right - ell_width -1, physDev->org.y + top, ell_width, bottom - top - 1, 270 * 64, 180 * 64 ); }else{ XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, ell_width, ell_height, 90 * 64, 90 * 64 ); XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + bottom - ell_height - 1, + physDev->org.x + left, + physDev->org.y + bottom - ell_height - 1, ell_width, ell_height, 180 * 64, 90 * 64 ); XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width - 1, - dc->DCOrgY + bottom - ell_height - 1, + physDev->org.x + right - ell_width - 1, + physDev->org.y + bottom - ell_height - 1, ell_width, ell_height, 270 * 64, 90 * 64 ); XFillArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width - 1, - dc->DCOrgY + top, + physDev->org.x + right - ell_width - 1, + physDev->org.y + top, ell_width, ell_height, 0, 90 * 64 ); } if (ell_width < right - left) { XFillRectangle( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + (ell_width + 1) / 2, - dc->DCOrgY + top + 1, + physDev->org.x + left + (ell_width + 1) / 2, + physDev->org.y + top + 1, right - left - ell_width - 1, (ell_height + 1) / 2 - 1); XFillRectangle( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + (ell_width + 1) / 2, - dc->DCOrgY + bottom - (ell_height) / 2 - 1, + physDev->org.x + left + (ell_width + 1) / 2, + physDev->org.y + bottom - (ell_height) / 2 - 1, right - left - ell_width - 1, (ell_height) / 2 ); } if (ell_height < bottom - top) { XFillRectangle( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + 1, - dc->DCOrgY + top + (ell_height + 1) / 2, + physDev->org.x + left + 1, + physDev->org.y + top + (ell_height + 1) / 2, right - left - 2, bottom - top - ell_height - 1); } @@ -788,65 +785,65 @@ X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, if (ell_width > (right-left) ) if (ell_height > (bottom-top) ) XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right - left - 1, bottom -top - 1, 0 , 360 * 64 ); else{ XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, right - left - 1, ell_height - 1, 0 , 180 * 64 ); XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + bottom - ell_height, + physDev->org.x + left, + physDev->org.y + bottom - ell_height, right - left - 1, ell_height - 1, 180 * 64 , 180 * 64 ); } else if (ell_height > (bottom-top) ){ XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, ell_width - 1 , bottom - top - 1, 90 * 64 , 180 * 64 ); XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width, - dc->DCOrgY + top, + physDev->org.x + right - ell_width, + physDev->org.y + top, ell_width - 1 , bottom - top - 1, 270 * 64 , 180 * 64 ); }else{ XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + top, + physDev->org.x + left, physDev->org.y + top, ell_width - 1, ell_height - 1, 90 * 64, 90 * 64 ); XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, dc->DCOrgY + bottom - ell_height, + physDev->org.x + left, physDev->org.y + bottom - ell_height, ell_width - 1, ell_height - 1, 180 * 64, 90 * 64 ); XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width, - dc->DCOrgY + bottom - ell_height, + physDev->org.x + right - ell_width, + physDev->org.y + bottom - ell_height, ell_width - 1, ell_height - 1, 270 * 64, 90 * 64 ); XDrawArc( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - ell_width, dc->DCOrgY + top, + physDev->org.x + right - ell_width, physDev->org.y + top, ell_width - 1, ell_height - 1, 0, 90 * 64 ); } if (ell_width < right - left) { XDrawLine( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + ell_width / 2, - dc->DCOrgY + top, - dc->DCOrgX + right - (ell_width+1) / 2, - dc->DCOrgY + top); + physDev->org.x + left + ell_width / 2, + physDev->org.y + top, + physDev->org.x + right - (ell_width+1) / 2, + physDev->org.y + top); XDrawLine( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left + ell_width / 2 , - dc->DCOrgY + bottom - 1, - dc->DCOrgX + right - (ell_width+1)/ 2, - dc->DCOrgY + bottom - 1); + physDev->org.x + left + ell_width / 2 , + physDev->org.y + bottom - 1, + physDev->org.x + right - (ell_width+1)/ 2, + physDev->org.y + bottom - 1); } if (ell_height < bottom - top) { XDrawLine( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + right - 1, - dc->DCOrgY + top + ell_height / 2, - dc->DCOrgX + right - 1, - dc->DCOrgY + bottom - (ell_height+1) / 2); + physDev->org.x + right - 1, + physDev->org.y + top + ell_height / 2, + physDev->org.x + right - 1, + physDev->org.y + bottom - (ell_height+1) / 2); XDrawLine( gdi_display, physDev->drawable, physDev->gc, - dc->DCOrgX + left, - dc->DCOrgY + top + ell_height / 2, - dc->DCOrgX + left, - dc->DCOrgY + bottom - (ell_height+1) / 2); + physDev->org.x + left, + physDev->org.y + top + ell_height / 2, + physDev->org.x + left, + physDev->org.y + bottom - (ell_height+1) / 2); } update = TRUE; } @@ -867,10 +864,11 @@ COLORREF X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color ) { Pixel pixel; - DC *dc = physDev->dc; + POINT pt; - x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y ); - y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y ); + pt.x = x; + pt.y = y; + LPtoDP( physDev->hdc, &pt, 1 ); pixel = X11DRV_PALETTE_ToPhysical( physDev, color ); /* Update the pixmap from the DIB section */ @@ -880,7 +878,8 @@ X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color ) wine_tsx11_lock(); XSetForeground( gdi_display, physDev->gc, pixel ); XSetFunction( gdi_display, physDev->gc, GXcopy ); - XDrawPoint( gdi_display, physDev->drawable, physDev->gc, x, y ); + XDrawPoint( gdi_display, physDev->drawable, physDev->gc, + physDev->org.x + pt.x, physDev->org.y + y ); wine_tsx11_unlock(); /* Update the DIBSection from the pixmap */ @@ -899,18 +898,22 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y ) static Pixmap pixmap = 0; XImage * image; int pixel; + POINT pt; DC *dc = physDev->dc; + pt.x = x; + pt.y = y; + LPtoDP( physDev->hdc, &pt, 1 ); + /* Update the pixmap from the DIB section */ X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE); - x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y ); - y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y ); wine_tsx11_lock(); if (dc->flags & DC_MEMORY) { - image = XGetImage( gdi_display, physDev->drawable, x, y, 1, 1, - AllPlanes, ZPixmap ); + image = XGetImage( gdi_display, physDev->drawable, + physDev->org.x + pt.x, physDev->org.y + pt.y, + 1, 1, AllPlanes, ZPixmap ); } else { @@ -919,7 +922,7 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y ) if (!pixmap) pixmap = XCreatePixmap( gdi_display, root_window, 1, 1, dc->bitsPerPixel ); XCopyArea( gdi_display, physDev->drawable, pixmap, BITMAP_colorGC, - x, y, 1, 1, 0, 0 ); + physDev->org.x + pt.x, physDev->org.y + pt.y, 1, 1, 0, 0 ); image = XGetImage( gdi_display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap ); } pixel = XGetPixel( image, 0, 0 ); @@ -939,8 +942,6 @@ X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y ) BOOL X11DRV_PaintRgn( X11DRV_PDEVICE *physDev, HRGN hrgn ) { - DC *dc = physDev->dc; - if (X11DRV_SetupGCForBrush( physDev )) { int i; @@ -951,8 +952,8 @@ X11DRV_PaintRgn( X11DRV_PDEVICE *physDev, HRGN hrgn ) rect = (XRectangle *)data->Buffer; for (i = 0; i < data->rdh.nCount; i++) { - rect[i].x += dc->DCOrgX; - rect[i].y += dc->DCOrgY; + rect[i].x += physDev->org.x; + rect[i].y += physDev->org.y; } X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE); @@ -985,8 +986,8 @@ X11DRV_Polyline( X11DRV_PDEVICE *physDev, const POINT* pt, INT count ) } for (i = 0; i < count; i++) { - points[i].x = dc->DCOrgX + INTERNAL_XWPTODP( dc, pt[i].x, pt[i].y ); - points[i].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y ); + points[i].x = physDev->org.x + INTERNAL_XWPTODP( dc, pt[i].x, pt[i].y ); + points[i].y = physDev->org.y + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y ); } if (X11DRV_SetupGCForPen ( physDev )) @@ -1025,8 +1026,8 @@ X11DRV_Polygon( X11DRV_PDEVICE *physDev, const POINT* pt, INT count ) } for (i = 0; i < count; i++) { - points[i].x = dc->DCOrgX + INTERNAL_XWPTODP( dc, pt[i].x, pt[i].y ); - points[i].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y ); + points[i].x = physDev->org.x + INTERNAL_XWPTODP( dc, pt[i].x, pt[i].y ); + points[i].y = physDev->org.y + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y ); } points[count] = points[0]; @@ -1090,8 +1091,8 @@ X11DRV_PolyPolygon( X11DRV_PDEVICE *physDev, const POINT* pt, const INT* counts, { for (j = 0; j < counts[i]; j++) { - points[j].x = dc->DCOrgX + INTERNAL_XWPTODP( dc, pt->x, pt->y ); - points[j].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt->x, pt->y ); + points[j].x = physDev->org.x + INTERNAL_XWPTODP( dc, pt->x, pt->y ); + points[j].y = physDev->org.y + INTERNAL_YWPTODP( dc, pt->x, pt->y ); pt++; } points[j] = points[0]; @@ -1134,8 +1135,8 @@ X11DRV_PolyPolyline( X11DRV_PDEVICE *physDev, const POINT* pt, const DWORD* coun { for (j = 0; j < counts[i]; j++) { - points[j].x = dc->DCOrgX + INTERNAL_XWPTODP( dc, pt->x, pt->y ); - points[j].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt->x, pt->y ); + points[j].x = physDev->org.x + INTERNAL_XWPTODP( dc, pt->x, pt->y ); + points[j].y = physDev->org.y + INTERNAL_YWPTODP( dc, pt->x, pt->y ); pt++; } TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, @@ -1237,8 +1238,8 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color, if (GetRgnBox( dc->hGCClipRgn, &rect ) == ERROR) return FALSE; if (!(image = TSXGetImage( gdi_display, physDev->drawable, - rect.left, - rect.top, + physDev->org.x + rect.left, + physDev->org.y + rect.top, rect.right - rect.left, rect.bottom - rect.top, AllPlanes, ZPixmap ))) return FALSE; @@ -1252,8 +1253,8 @@ X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color, wine_tsx11_lock(); XSetFunction( gdi_display, physDev->gc, GXcopy ); X11DRV_InternalFloodFill(image, physDev, - XLPTODP(dc,x) + dc->DCOrgX - rect.left, - YLPTODP(dc,y) + dc->DCOrgY - rect.top, + XLPTODP(dc,x) - rect.left, + YLPTODP(dc,y) - rect.top, rect.left, rect.top, X11DRV_PALETTE_ToPhysical( physDev, color ), fillType ); @@ -1287,22 +1288,24 @@ X11DRV_SetTextColor( X11DRV_PDEVICE *physDev, COLORREF color ) } /*********************************************************************** - * X11DRV_GetDCOrgEx + * GetDCOrgEx (X11DRV.@) */ BOOL X11DRV_GetDCOrgEx( X11DRV_PDEVICE *physDev, LPPOINT lpp ) { - if (!(physDev->dc->flags & DC_MEMORY)) - { - Window root; - int x, y, w, h, border, depth; - - FIXME("this is not correct for managed windows\n"); - TSXGetGeometry( gdi_display, physDev->drawable, &root, - &x, &y, &w, &h, &border, &depth ); - lpp->x = x; - lpp->y = y; - } - else lpp->x = lpp->y = 0; + lpp->x = physDev->org.x + physDev->drawable_org.x; + lpp->y = physDev->org.y + physDev->drawable_org.y; return TRUE; } + +/*********************************************************************** + * SetDCOrg (X11DRV.@) + */ +DWORD X11DRV_SetDCOrg( X11DRV_PDEVICE *physDev, INT x, INT y ) +{ + DWORD ret = MAKELONG( physDev->org.x + physDev->drawable_org.x, + physDev->org.y + physDev->drawable_org.y ); + physDev->org.x = x - physDev->drawable_org.x; + physDev->org.y = y - physDev->drawable_org.y; + return ret; +} diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index c72e19a85f1..0e6edbe0951 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -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; } diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c index 325eac0abab..6a968f9a646 100644 --- a/graphics/x11drv/text.c +++ b/graphics/x11drv/text.c @@ -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 ); diff --git a/include/gdi.h b/include/gdi.h index 9b96f424d21..8c309b1bdbd 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -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, diff --git a/include/x11drv.h b/include/x11drv.h index ad55ba3d1dd..a0af0b34965 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -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 ); diff --git a/objects/clipping.c b/objects/clipping.c index d9af64c40e2..a40dc6f48d5 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -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 ); diff --git a/objects/dc.c b/objects/dc.c index e06d67eced6..6b99ad89c5a 100644 --- a/objects/dc.c +++ b/objects/dc.c @@ -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; } diff --git a/objects/region.c b/objects/region.c index 6b4cfe7aa53..b87615aa4c7 100644 --- a/objects/region.c +++ b/objects/region.c @@ -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;