Corrections of my last patch

Felix Nawothnig felix.nawothnig at t-online.de
Sun May 15 03:42:48 CDT 2005


ChangeLog:
Keep width for cosmetic pens, don't use LPtoDP() for widths and convert 
the dashes for PS_USERSTYLE pens into device units.
-------------- next part --------------
Index: path.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/path.c,v
retrieving revision 1.7
diff -u -r1.7 path.c
--- path.c	14 May 2005 18:49:52 -0000	1.7
+++ path.c	15 May 2005 08:28:55 -0000
@@ -121,7 +121,15 @@
                dc->xformWorld2Vport.eDy;
 }
 
-
+/* Performs a world-to-viewport transformation on the specified width.
+ */
+static inline void INTERNAL_WSTODS(DC *dc, LONG *width)
+{
+    POINT pt[2] = { { 0, 0 }, { *width, 0 } };
+    LPtoDP(dc->hSelf, pt, 2);
+    *width = pt[1].x - pt[0].x;
+}
+ 
 /***********************************************************************
  *           BeginPath    (GDI32.@)
  */
@@ -1446,24 +1454,28 @@
     if(pPath->state != PATH_Closed)
         return FALSE;
 
-    /* Convert pen width to DP for MWT_IDENTITY */
+    /* Convert pen properties from logical to device units 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);
+	if(elp.elpPenStyle & PS_GEOMETRIC) {
+	    INTERNAL_WSTODS(dc, &elp.elpWidth);
+	    if(elp.elpPenStyle & PS_USERSTYLE)
+		for(i = 0; i < elp.elpNumEntries; i++)
+		    INTERNAL_WSTODS(dc, &elp.elpStyleEntry[i]);
+	}
 	lb.lbStyle = elp.elpBrushStyle;
 	lb.lbColor = elp.elpColor;
 	lb.lbHatch = elp.elpHatch;
-	hNewPen = ExtCreatePen(elp.elpPenStyle, ptPenWidth.x, &lb,
+	hNewPen = ExtCreatePen(elp.elpPenStyle, elp.elpWidth, &lb,
 	                       elp.elpNumEntries, elp.elpStyleEntry);
     } else /* OBJ_PEN */ {
 	LOGPEN lp;
 	GetObjectW(hOldPen, sizeof(LOGPEN), &lp);
-	LPtoDP(dc->hSelf, &lp.lopnWidth, 1);
+	if(lp.lopnWidth.x > 0)
+	    INTERNAL_WSTODS(dc, &lp.lopnWidth.x);
 	hNewPen = CreatePenIndirect(&lp);
     }
     SelectObject(dc->hSelf, hNewPen);
@@ -1494,8 +1506,7 @@
     
     for(i = 0; i < pPath->numEntriesUsed; i++) {
         if((i == 0 || (pPath->pFlags[i-1] & PT_CLOSEFIGURE)) &&
-	   (pPath->pFlags[i] != PT_MOVETO))
-	{
+	   (pPath->pFlags[i] != PT_MOVETO)) {
 	    ERR("Expected PT_MOVETO %s, got path flag %d\n", 
 	        i == 0 ? "as first point" : "after PT_CLOSEFIGURE",
 		(INT)pPath->pFlags[i]);


More information about the wine-patches mailing list