From dec2cee2fb3f8a9c0e2b1fc341f88bebfcedde84 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 2 May 2002 01:39:48 +0000 Subject: [PATCH] Removed some direct accesses to the DC structure. --- dlls/ttydrv/dc.c | 9 --- dlls/ttydrv/ttydrv.h | 1 - dlls/ttydrv/ttydrv.spec | 1 - dlls/wineps/bitblt.c | 15 ++-- dlls/wineps/bitmap.c | 15 ++-- dlls/wineps/clipping.c | 13 +--- dlls/wineps/font.c | 1 + dlls/wineps/graphics.c | 154 ++++++++++++++++++++++--------------- dlls/wineps/pen.c | 1 + dlls/wineps/psdrv.h | 6 +- dlls/wineps/text.c | 9 +-- dlls/wineps/wineps.spec | 2 +- dlls/x11drv/x11drv.spec | 2 +- graphics/x11drv/clipping.c | 9 +-- include/gdi.h | 2 +- include/x11drv.h | 2 +- objects/clipping.c | 3 +- 17 files changed, 131 insertions(+), 114 deletions(-) diff --git a/dlls/ttydrv/dc.c b/dlls/ttydrv/dc.c index e2a8b50e65..9a1c6f97c0 100644 --- a/dlls/ttydrv/dc.c +++ b/dlls/ttydrv/dc.c @@ -202,12 +202,3 @@ INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap ) return 0; } } - - -/*********************************************************************** - * TTYDRV_DC_SetDeviceClipping - */ -void TTYDRV_DC_SetDeviceClipping(TTYDRV_PDEVICE *physDev) -{ - TRACE("(%x)\n", physDev->hdc); -} diff --git a/dlls/ttydrv/ttydrv.h b/dlls/ttydrv/ttydrv.h index 5132a8f6c7..1bcc57e8a2 100644 --- a/dlls/ttydrv/ttydrv.h +++ b/dlls/ttydrv/ttydrv.h @@ -107,7 +107,6 @@ extern BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, cons extern BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines); extern BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom); extern BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height); -extern void TTYDRV_DC_SetDeviceClipping(TTYDRV_PDEVICE *physDev); extern COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color); extern BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop); INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse); diff --git a/dlls/ttydrv/ttydrv.spec b/dlls/ttydrv/ttydrv.spec index f1308955dd..c48448f67a 100644 --- a/dlls/ttydrv/ttydrv.spec +++ b/dlls/ttydrv/ttydrv.spec @@ -40,7 +40,6 @@ debug_channels (ttydrv) @ cdecl SelectBitmap(ptr long) TTYDRV_SelectBitmap @ cdecl SelectFont(ptr long) TTYDRV_SelectFont @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice -@ cdecl SetDeviceClipping(ptr) TTYDRV_DC_SetDeviceClipping @ 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/wineps/bitblt.c b/dlls/wineps/bitblt.c index 99ab2bc0d5..f19f3d0a6c 100644 --- a/dlls/wineps/bitblt.c +++ b/dlls/wineps/bitblt.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" #include "winbase.h" @@ -32,13 +31,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); */ BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD dwRop) { - DC *dc = physDev->dc; + POINT pt[2]; + + pt[0].x = x; + pt[0].y = y; + pt[1].x = x + width; + pt[1].y = y + height; + LPtoDP( physDev->hdc, pt, 2 ); switch(dwRop) { case PATCOPY: PSDRV_WriteGSave(physDev); - PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y), - XLSTODS(dc, width), YLSTODS(dc, height)); + PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); PSDRV_Brush(physDev, FALSE); PSDRV_WriteGRestore(physDev); return TRUE; @@ -49,8 +53,7 @@ BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, D PSCOLOR pscol; PSDRV_WriteGSave(physDev); - PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y), - XLSTODS(dc, width), YLSTODS(dc, height)); + PSDRV_WriteRectangle(physDev, pt[0].x, pt[0].y, pt[1].x - pt[0].x, pt[1].y - pt[0].y ); PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ? RGB(0,0,0) : RGB(0xff,0xff,0xff) ); PSDRV_WriteSetColor(physDev, &pscol); diff --git a/dlls/wineps/bitmap.c b/dlls/wineps/bitmap.c index b08d1f5c3e..c26bb4398c 100644 --- a/dlls/wineps/bitmap.c +++ b/dlls/wineps/bitmap.c @@ -171,7 +171,7 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs WORD bpp, compression; const char *ptr; INT line; - DC *dc = physDev->dc; + POINT pt[2]; TRACE("%08x (%d,%d %dx%d) -> (%d,%d %dx%d)\n", physDev->hdc, xSrc, ySrc, widthSrc, heightSrc, xDst, yDst, widthDst, heightDst); @@ -189,10 +189,15 @@ INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDs return FALSE; } - xDst = XLPTODP(dc, xDst); - yDst = YLPTODP(dc, yDst); - widthDst = XLSTODS(dc, widthDst); - heightDst = YLSTODS(dc, heightDst); + pt[0].x = xDst; + pt[0].y = yDst; + pt[1].x = xDst + widthDst; + pt[1].y = yDst + heightDst; + LPtoDP( physDev->hdc, pt, 2 ); + xDst = pt[0].x; + yDst = pt[0].y; + widthDst = pt[1].x - pt[0].x; + heightDst = pt[1].y - pt[0].y; switch(bpp) { diff --git a/dlls/wineps/clipping.c b/dlls/wineps/clipping.c index d02c919d03..bbb95abb2d 100644 --- a/dlls/wineps/clipping.c +++ b/dlls/wineps/clipping.c @@ -18,7 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" #include "winbase.h" @@ -28,21 +27,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); /*********************************************************************** * PSDRV_SetDeviceClipping */ -VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev ) +VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev, HRGN hrgn ) { CHAR szArrayName[] = "clippath"; DWORD size; RGNDATA *rgndata; - DC *dc = physDev->dc; TRACE("hdc=%04x\n", physDev->hdc); - if (dc->hGCClipRgn == 0) { - ERR("Rgn is 0. Please report this.\n"); - return; - } - - size = GetRegionData(dc->hGCClipRgn, 0, NULL); + size = GetRegionData(hrgn, 0, NULL); if(!size) { ERR("Invalid region\n"); return; @@ -54,7 +47,7 @@ VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev ) return; } - GetRegionData(dc->hGCClipRgn, size, rgndata); + GetRegionData(hrgn, size, rgndata); PSDRV_WriteInitClip(physDev); diff --git a/dlls/wineps/font.c b/dlls/wineps/font.c index 84b7598d7d..2240c81dac 100644 --- a/dlls/wineps/font.c +++ b/dlls/wineps/font.c @@ -20,6 +20,7 @@ #include #include /* for bsearch() */ #include "winspool.h" +#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" #include "winerror.h" diff --git a/dlls/wineps/graphics.c b/dlls/wineps/graphics.c index aadaa69422..7a8e63e30d 100644 --- a/dlls/wineps/graphics.c +++ b/dlls/wineps/graphics.c @@ -40,15 +40,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); */ BOOL PSDRV_LineTo(PSDRV_PDEVICE *physDev, INT x, INT y) { - DC *dc = physDev->dc; + POINT pt[2]; TRACE("%d %d\n", x, y); + GetCurrentPositionEx( physDev->hdc, pt ); + pt[1].x = x; + pt[1].y = y; + LPtoDP( physDev->hdc, pt, 2 ); + PSDRV_SetPen(physDev); - PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, dc->CursPosX, dc->CursPosY), - INTERNAL_YWPTODP(dc, dc->CursPosX, dc->CursPosY)); - PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, x, y), - INTERNAL_YWPTODP(dc, x, y)); + PSDRV_WriteMoveTo(physDev, pt[0].x, pt[0].y ); + PSDRV_WriteLineTo(physDev, pt[1].x, pt[1].y ); PSDRV_DrawLine(physDev); return TRUE; @@ -60,15 +63,18 @@ BOOL PSDRV_LineTo(PSDRV_PDEVICE *physDev, INT x, INT y) */ BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom ) { - INT width; - INT height; - DC *dc = physDev->dc; + RECT rect; TRACE("%d %d - %d %d\n", left, top, right, bottom); - width = INTERNAL_XWSTODS(dc, right - left); - height = INTERNAL_YWSTODS(dc, bottom - top); - PSDRV_WriteRectangle(physDev, INTERNAL_XWPTODP(dc, left, top), - INTERNAL_YWPTODP(dc, left, top), width, height); + + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; + LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); + + PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top ); PSDRV_Brush(physDev,0); PSDRV_SetPen(physDev); PSDRV_DrawLine(physDev); @@ -82,20 +88,29 @@ BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT BOOL PSDRV_RoundRect( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height ) { - DC *dc = physDev->dc; - - left = XLPTODP( dc, left ); - right = XLPTODP( dc, right ); - top = YLPTODP( dc, top ); - bottom = YLPTODP( dc, bottom ); - ell_width = XLSTODS( dc, ell_width ); - ell_height = YLSTODS( dc, ell_height ); - - if( left > right ) { INT tmp = left; left = right; right = tmp; } - if( top > bottom ) { INT tmp = top; top = bottom; bottom = tmp; } - - if(ell_width > right - left) ell_width = right - left; - if(ell_height > bottom - top) ell_height = bottom - top; + RECT rect[2]; + + rect[0].left = left; + rect[0].top = top; + rect[0].right = right; + rect[0].bottom = bottom; + rect[1].left = 0; + rect[1].top = 0; + rect[1].right = ell_width; + rect[1].bottom = ell_height; + LPtoDP( physDev->hdc, (POINT *)rect, 4 ); + + left = rect[0].left; + top = rect[0].top; + right = rect[0].right; + bottom = rect[0].bottom; + if (left > right) { INT tmp = left; left = right; right = tmp; } + if (top > bottom) { INT tmp = top; top = bottom; bottom = tmp; } + + ell_width = rect[1].right - rect[1].left; + ell_height = rect[1].bottom - rect[1].top; + if (ell_width > right - left) ell_width = right - left; + if (ell_height > bottom - top) ell_height = bottom - top; PSDRV_WriteMoveTo( physDev, left, top + ell_height/2 ); PSDRV_WriteArc( physDev, left + ell_width/2, top + ell_height/2, ell_width, @@ -126,15 +141,20 @@ static BOOL PSDRV_DrawArc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend, int lines ) { - DC *dc = physDev->dc; INT x, y, h, w; double start_angle, end_angle, ratio; + RECT rect; - x = XLPTODP(dc, (left + right)/2); - y = YLPTODP(dc, (top + bottom)/2); + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; + LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); - w = XLSTODS(dc, (right - left)); - h = YLSTODS(dc, (bottom - top)); + x = (rect.left + rect.right) / 2; + y = (rect.top + rect.bottom) / 2; + w = rect.right - rect.left; + h = rect.bottom - rect.top; if(w < 0) w = -w; if(h < 0) h = -h; @@ -200,15 +220,20 @@ BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom) { INT x, y, w, h; - DC *dc = physDev->dc; + RECT rect; TRACE("%d %d - %d %d\n", left, top, right, bottom); - x = XLPTODP(dc, (left + right)/2); - y = YLPTODP(dc, (top + bottom)/2); + rect.left = left; + rect.top = top; + rect.right = right; + rect.bottom = bottom; + LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); - w = XLSTODS(dc, (right - left)); - h = YLSTODS(dc, (bottom - top)); + x = (rect.left + rect.right) / 2; + y = (rect.top + rect.bottom) / 2; + w = rect.right - rect.left; + h = rect.bottom - rect.top; PSDRV_WriteNewPath(physDev); PSDRV_WriteArc(physDev, x, y, w, h, 0.0, 360.0); @@ -224,27 +249,30 @@ BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bo * PSDRV_PolyPolyline */ BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD* counts, - DWORD polylines ) + DWORD polylines ) { - DWORD polyline, line; - const POINT* pt; - DC *dc = physDev->dc; + DWORD polyline, line, total; + POINT *dev_pts, *pt; TRACE("\n"); - pt = pts; + for (polyline = total = 0; polyline < polylines; polyline++) total += counts[polyline]; + if (!(dev_pts = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*dev_pts) ))) return FALSE; + memcpy( dev_pts, pts, total * sizeof(*dev_pts) ); + LPtoDP( physDev->hdc, dev_pts, total ); + + pt = dev_pts; for(polyline = 0; polyline < polylines; polyline++) { - PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); + PSDRV_WriteMoveTo(physDev, pt->x, pt->y); pt++; - for(line = 1; line < counts[polyline]; line++) { - PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); - pt++; - } + for(line = 1; line < counts[polyline]; line++, pt++) + PSDRV_WriteLineTo(physDev, pt->x, pt->y); } + HeapFree( GetProcessHeap(), 0, dev_pts ); PSDRV_SetPen(physDev); PSDRV_DrawLine(physDev); return TRUE; -} +} /*********************************************************************** @@ -260,24 +288,27 @@ BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count ) * PSDRV_PolyPolygon */ BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts, - UINT polygons ) + UINT polygons ) { - DWORD polygon, line; - const POINT* pt; - DC *dc = physDev->dc; + DWORD polygon, line, total; + POINT *dev_pts, *pt; TRACE("\n"); - pt = pts; + for (polygon = total = 0; polygon < polygons; polygon++) total += counts[polygon]; + if (!(dev_pts = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*dev_pts) ))) return FALSE; + memcpy( dev_pts, pts, total * sizeof(*dev_pts) ); + LPtoDP( physDev->hdc, dev_pts, total ); + + pt = dev_pts; for(polygon = 0; polygon < polygons; polygon++) { - PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); + PSDRV_WriteMoveTo(physDev, pt->x, pt->y); pt++; - for(line = 1; line < counts[polygon]; line++) { - PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); - pt++; - } + for(line = 1; line < counts[polygon]; line++, pt++) + PSDRV_WriteLineTo(physDev, pt->x, pt->y); PSDRV_WriteClosePath(physDev); } + HeapFree( GetProcessHeap(), 0, dev_pts ); if(GetPolyFillMode( physDev->hdc ) == ALTERNATE) PSDRV_Brush(physDev, 1); @@ -304,12 +335,13 @@ BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count ) COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color ) { PSCOLOR pscolor; - DC *dc = physDev->dc; + POINT pt; - x = INTERNAL_XWPTODP(dc, x, y); - y = INTERNAL_YWPTODP(dc, x, y); + pt.x = x; + pt.y = y; + LPtoDP( physDev->hdc, &pt, 1 ); - PSDRV_WriteRectangle( physDev, x, y, 0, 0 ); + PSDRV_WriteRectangle( physDev, pt.x, pt.y, 0, 0 ); PSDRV_CreateColor( physDev, &pscolor, color ); PSDRV_WriteSetColor( physDev, &pscolor ); PSDRV_WriteFill( physDev ); diff --git a/dlls/wineps/pen.c b/dlls/wineps/pen.c index 87cf7e07cd..b22006d64f 100644 --- a/dlls/wineps/pen.c +++ b/dlls/wineps/pen.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" diff --git a/dlls/wineps/psdrv.h b/dlls/wineps/psdrv.h index 4ed007c266..baadff40ce 100644 --- a/dlls/wineps/psdrv.h +++ b/dlls/wineps/psdrv.h @@ -23,7 +23,6 @@ #include "windef.h" #include "wingdi.h" -#include "gdi.h" #include "wine/wingdi16.h" #include "winspool.h" @@ -268,7 +267,7 @@ typedef struct { typedef struct { HDC hdc; - DC *dc; + struct tagDC *dc; PSFONT font; /* Current PS font */ PSPEN pen; PSBRUSH brush; @@ -401,8 +400,6 @@ extern BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom ); extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev ); extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev ); -extern BOOL PSDRV_EnumDeviceFonts( PSDRV_PDEVICE *physDev, LPLOGFONTW plf, - DEVICEFONTENUMPROC proc, LPARAM lp ); extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ); @@ -428,7 +425,6 @@ extern BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT righ extern BOOL PSDRV_RoundRect(PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height); extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color ); -extern VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev ); extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color ); extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color ); extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc ); diff --git a/dlls/wineps/text.c b/dlls/wineps/text.c index 8b36fba0ee..ea820f0f88 100644 --- a/dlls/wineps/text.c +++ b/dlls/wineps/text.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include "gdi.h" #include "psdrv.h" #include "wine/debug.h" #include "winspool.h" @@ -38,7 +39,6 @@ BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, BOOL bClipped = FALSE; BOOL bOpaque = FALSE; RECT rect; - DC *dc = physDev->dc; TRACE("(x=%d, y=%d, flags=0x%08x, str=%s, count=%d, lpDx=%p)\n", x, y, flags, debugstr_wn(str, count), count, lpDx); @@ -49,11 +49,8 @@ BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags, /* set clipping and/or draw background */ if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL)) { - rect.left = INTERNAL_XWPTODP(dc, lprect->left, lprect->top); - rect.right = INTERNAL_XWPTODP(dc, lprect->right, lprect->bottom); - rect.top = INTERNAL_YWPTODP(dc, lprect->left, lprect->top); - rect.bottom = INTERNAL_YWPTODP(dc, lprect->right, lprect->bottom); - + rect = *lprect; + LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); PSDRV_WriteGSave(physDev); PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); diff --git a/dlls/wineps/wineps.spec b/dlls/wineps/wineps.spec index d9440a2093..6a8e41ed44 100644 --- a/dlls/wineps/wineps.spec +++ b/dlls/wineps/wineps.spec @@ -45,7 +45,7 @@ debug_channels (psdrv) @ cdecl SelectFont(ptr long) PSDRV_SelectFont @ cdecl SelectPen(ptr long) PSDRV_SelectPen @ cdecl SetBkColor(ptr long) PSDRV_SetBkColor -@ cdecl SetDeviceClipping(ptr) PSDRV_SetDeviceClipping +@ cdecl SetDeviceClipping(ptr long) PSDRV_SetDeviceClipping @ cdecl SetPixel(ptr long long long) PSDRV_SetPixel @ cdecl SetTextColor(ptr long) PSDRV_SetTextColor @ cdecl StartDoc(ptr ptr) PSDRV_StartDoc diff --git a/dlls/x11drv/x11drv.spec b/dlls/x11drv/x11drv.spec index d305a9a6a9..06d9921773 100644 --- a/dlls/x11drv/x11drv.spec +++ b/dlls/x11drv/x11drv.spec @@ -57,7 +57,7 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics @ 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 -@ cdecl SetDeviceClipping(ptr) X11DRV_SetDeviceClipping +@ cdecl SetDeviceClipping(ptr long) X11DRV_SetDeviceClipping @ cdecl SetDeviceGammaRamp(ptr ptr) X11DRV_SetDeviceGammaRamp @ cdecl SetPixel(ptr long long long) X11DRV_SetPixel @ cdecl SetPixelFormat(ptr long ptr) X11DRV_SetPixelFormat diff --git a/graphics/x11drv/clipping.c b/graphics/x11drv/clipping.c index 17f3af38d5..edd0987c7f 100644 --- a/graphics/x11drv/clipping.c +++ b/graphics/x11drv/clipping.c @@ -38,12 +38,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv); * * Could write using GetRegionData but this would be slower. */ -void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev ) +void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev, HRGN hrgn ) { XRectangle *pXrect; - DC *dc = physDev->dc; - RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->hGCClipRgn, REGION_MAGIC); + RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(hrgn, REGION_MAGIC); if (!obj) { ERR("Rgn is 0. Please report this.\n"); @@ -61,7 +60,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev ) if(!pXrect) { WARN("Can't alloc buffer\n"); - GDI_ReleaseObj( dc->hGCClipRgn ); + GDI_ReleaseObj( hrgn ); return; } @@ -82,7 +81,7 @@ void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev ) if(pXrect) HeapFree( GetProcessHeap(), 0, pXrect ); - GDI_ReleaseObj( dc->hGCClipRgn ); + GDI_ReleaseObj( hrgn ); } diff --git a/include/gdi.h b/include/gdi.h index 38eaf36c65..76b4cd8200 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -221,7 +221,7 @@ typedef struct tagDC_FUNCS INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT); INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID, const BITMAPINFO*,UINT); - VOID (*pSetDeviceClipping)(PHYSDEV); + VOID (*pSetDeviceClipping)(PHYSDEV,HRGN); BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID); INT (*pSetMapMode)(PHYSDEV,INT); DWORD (*pSetMapperFlags)(PHYSDEV,DWORD); diff --git a/include/x11drv.h b/include/x11drv.h index 6a6e81439e..1d1c525a5e 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -118,7 +118,6 @@ extern BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, extern BOOL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics); extern BOOL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop ); -extern VOID X11DRV_SetDeviceClipping(X11DRV_PDEVICE *physDev); extern BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, @@ -303,6 +302,7 @@ extern int X11DRV_PALETTE_mapEGAPixel[16]; extern int X11DRV_PALETTE_Init(void); extern void X11DRV_PALETTE_Cleanup(void); +extern BOOL X11DRV_IsSolidColor(COLORREF color); extern COLORREF X11DRV_PALETTE_ToLogical(int pixel); extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color); diff --git a/objects/clipping.c b/objects/clipping.c index 54138dc950..ea193910ba 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -50,7 +50,8 @@ void CLIPPING_UpdateGCRegion( DC * dc ) CombineRgn( dc->hGCClipRgn, dc->hVisRgn, 0, RGN_COPY ); else CombineRgn(dc->hGCClipRgn, dc->hClipRgn, dc->hVisRgn, RGN_AND); - if (dc->funcs->pSetDeviceClipping) dc->funcs->pSetDeviceClipping( dc->physDev ); + if (dc->funcs->pSetDeviceClipping) + dc->funcs->pSetDeviceClipping( dc->physDev, dc->hGCClipRgn ); } -- 2.32.0.93.g670b81a890