Pen Widths, and patch etiquette

Rob Brown rob at cobbleware.com
Tue Jul 11 17:01:52 CDT 2006


Hi,

I'm trying to get Protel 99SE working under Wine. It's nearly there, in
fact it's totally usable, but some slight niggles remain (as can be seen in
the appDB). I'm a coder, and I am actively looking at the code to see what
I can do. I'm also a total newbie to Wine development, and while I'm
reading the ML archives and generally trying to sponge up as much as I can
by myself, I'd prefer a bit of advice!

My first job was to find a problem where some lines are drawn a single
pixel wide, when they should be several pixels wide. After some digging, I
found that the DC is in MM_ISOTROPIC mapping mode, and that a line with
width 1 is not being transformed. Wider lines do get transformed, and lines
of width 0 are correctly drawn a single pixel wide.

The culprit in this case is line 67 of dlls/winex11.drv/pen.c, which says

   physDev->pen.width = logpen.lopnWidth.x;
** if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width > 1))
   {
      physDev->pen.width = X11DRV_XWStoDS( physDev, physDev->pen.width );
      if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
   }

If I change that line to

   if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width > 0))

my problem goes away, but I'm concerned that it isn't appropriate for other
mapping modes. I can do something a bit more conservative like

   if ((logpen.lopnStyle & PS_GEOMETRIC) || (physDev->pen.width > 1) ||
      ((GetMapMode ( physDev->hdc ) == MM_ISOTROPIC) &&
       (physDev->pen.width == 1)))

and it Works For Me (tm).

I've tried to do some tests in Windows to see what happens in different
mapping modes, and I'm getting there, but this is new stuff for me so it's
fairly slow going. In particular, it seems that the line with in
anisotropic map mode will depend on whether the line is vertical or
horizontal etc.

So, I have a couple of questions:

1) Is the mailing list or bugzilla a better place to discuss this sort of
thing?

2) Should I continue to investigate the issue in Windows, or is there some
gdi guru out there that can save me the effort by telling me all about pen
width mapping?

3) What is the normal flow of things here: do people fix their bug
specifically and then move on, or is it preferred to investigate the issue
fully and make sure the solution is truly correct?

Thanks for your time!
Rob.




More information about the wine-devel mailing list