Since upgrading to Wine-20040914, we've noticed that a bug has been
introduced in gdi32.dll that causes certain pen strokes to be drawn with
thickness that is far too wide. The problem is in wine's handling of the
STROKEPATH and the STROKEANDFILLPATH emf records when playing enhanced
metafiles. Specifically, there seems to be a problem with an interaction
between wine's temporary setting of a world transform and a pen selection
that happens during processing of the record.
In cvs on the Wine HQ site, we notice that a SelectObject() for the pen
was inserted in function DC_UpdateXforms() in dlls/gdi/dc.c in revision
1.2 as follows:
===================================================================
RCS file: /home/wine/wine/dlls/gdi/dc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- wine/dlls/gdi/dc.c 2004/07/21 04:07:28 1.1
+++ wine/dlls/gdi/dc.c 2004/09/13 18:03:44 1.2
@@ -262,10 +262,13 @@ void DC_UpdateXforms( DC *dc )
dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport,
&dc->xformVport2World );
- /* Reselect the font back into the dc so that the font size
+ /* Reselect the font and pen back into the dc so that the size
gets updated. */
if(memcmp(&oldworld2vport, &dc->xformWorld2Vport,
sizeof(oldworld2vport)))
+ {
SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_FONT));
+ SelectObject(dc->hSelf, GetCurrentObject(dc->hSelf, OBJ_PEN));
+ }
}
The pen is set after the call that modifies the world transform to the
identity and before it is reset back to its normal values.
If we remove the call to SelectObject that selects the pen (shown in the
code above), the bug disappears.
Advice on the best way to proceed would be greatly appreciated.
1) Why was this change made?
2) Is the best fix simply to undo this change or is there a better
solution (e.g. fix the strokepath implementation)?