[GDI] Convert pen width to DP in StrokePath
Felix Nawothnig
felix.nawothnig at t-online.de
Sat May 14 05:23:17 CDT 2005
Since StrokePath() uses MWT_IDENTITY to avoid costly (?) LP->DP->LP
convertions we have to convert the pen width to DP before calling the
drawing functions. (see http://bugs.winehq.org/show_bug.cgi?id=11)
(This patch does apply on path.c with and without my last patch applied)
ChangeLog:
Convert pen width to DP in StrokePath()
-------------- next part --------------
? .mapping.c.swp
Index: path.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/path.c,v
retrieving revision 1.5
diff -u -r1.5 path.c
--- path.c 24 Mar 2005 21:01:38 -0000 1.5
+++ path.c 14 May 2005 10:09:40 -0000
@@ -1436,6 +1436,8 @@
SIZE szViewportExt, szWindowExt;
DWORD mapMode, graphicsMode;
XFORM xform;
+ HGDIOBJ hOldPen;
+ HPEN hNewPen;
BOOL ret = TRUE;
if(dc->funcs->pStrokePath)
@@ -1444,6 +1446,28 @@
if(pPath->state != PATH_Closed)
return FALSE;
+ /* Convert pen width to DP for MWT_IDENTITY */
+ hOldPen = GetCurrentObject(dc->hSelf, OBJ_PEN);
+ if(GetObjectType(hOldPen) == OBJ_EXTPEN) {
+ POINT ptPenWidth;
+ EXTLOGPEN elp;
+ LOGBRUSH lb;
+ GetObjectW(hOldPen, sizeof(EXTLOGPEN), &elp);
+ ptPenWidth.x = elp.elpWidth;
+ LPtoDP(dc->hSelf, &ptPenWidth, 1);
+ lb.lbStyle = elp.elpBrushStyle;
+ lb.lbColor = elp.elpColor;
+ lb.lbHatch = elp.elpHatch;
+ hNewPen = ExtCreatePen(elp.elpPenStyle, ptPenWidth.x, &lb,
+ elp.elpNumEntries, elp.elpStyleEntry);
+ } else /* OBJ_PEN */ {
+ LOGPEN lp;
+ GetObjectW(hOldPen, sizeof(LOGPEN), &lp);
+ LPtoDP(dc->hSelf, &lp.lopnWidth, 1);
+ hNewPen = CreatePenIndirect(&lp);
+ }
+ SelectObject(dc->hSelf, hNewPen);
+
/* Save the mapping mode info */
mapMode=GetMapMode(dc->hSelf);
GetViewportExtEx(dc->hSelf, &szViewportExt);
@@ -1522,6 +1546,11 @@
DPtoLP(dc->hSelf, &pt, 1);
MoveToEx(dc->hSelf, pt.x, pt.y, NULL);
}
+
+ /* Restore old pen */
+ DeleteObject(hNewPen);
+ SelectObject(dc->hSelf, hOldPen);
+
return ret;
}
More information about the wine-patches
mailing list