bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changes in -back (path.m _stroke:)


From: Alexander Malmberg
Subject: Re: changes in -back (path.m _stroke:)
Date: Sat, 15 Jan 2005 17:14:35 +0100
User-agent: Mozilla Thunderbird 0.9 (X11/20041124)

It seems that the reason I was getting trails with -xlib was that I had
a related local fix to NSFrameRect et al. (Not sure why I still got
trails with -art; presumably some testing mixup.) NSFrameRect et al are
supposed to draw the border _inside_ the rectangle, so they need to
adjust the coordinates they give to rectstroke using the line width.
rects.patch fixes that.

After fixing that, both Gorm and GWorkspace work with -art.
Unfortunately, -xlib's rectstroke is buggy in a way that neatly balances
the NSFrameRect bug (which is probably why nobody's noticed), but
xlib_rectstroke.patch fixes that.

This does change the behavior of NSFrameRect a bit, so it's possible
that drawing in other apps might be messed up. However, all uses of
these functions in -gui, and Gorm's selection rectangle drawing, were
expecting the correct behavior, and I suspect that most other users did
as well.

I'll commit this shortly.

- Alexander Malmberg


Index: Source/xlib/XGGState.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/back/Source/xlib/XGGState.m,v
retrieving revision 1.25
diff -u -r1.25 XGGState.m
--- Source/xlib/XGGState.m      30 Jul 2004 13:57:27 -0000      1.25
+++ Source/xlib/XGGState.m      15 Jan 2005 15:43:18 -0000
@@ -1489,10 +1489,6 @@
     [self setColor: &fillColor state: COLOR_STROKE];
 
   bounds = XGViewRectToX(self, NSMakeRect(x, y, w, h));
-  if (bounds.width > 0)
-    bounds.width--;
-  if (bounds.height > 0)
-    bounds.height--;
   // Hack: Only draw when alpha is not zero
   if (drawingAlpha == NO || strokeColor.field[AINDEX] != 0.0)
     XDrawRectangle(XDPY, draw, xgcntxt,

Index: Source/Functions.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/gui/Source/Functions.m,v
retrieving revision 1.32
diff -u -r1.32 Functions.m
--- Source/Functions.m  17 Oct 2004 18:52:48 -0000      1.32
+++ Source/Functions.m  15 Jan 2005 15:49:18 -0000
@@ -463,8 +463,8 @@
   DPSsetlinewidth(ctxt, 1.0);
   // FIXME
   DPSsetdash(ctxt, dot_dash, 2, 0.0);
-  DPSrectstroke(ctxt,  NSMinX(aRect), NSMinY(aRect), 
-               NSWidth(aRect), NSHeight(aRect));
+  DPSrectstroke(ctxt,  NSMinX(aRect) + 0.5, NSMinY(aRect) + 0.5,
+               NSWidth(aRect) - 1.0, NSHeight(aRect) - 1.0);
 }
 
 void NSFrameRect(const NSRect aRect)
@@ -478,8 +478,9 @@
   NSGraphicsContext *ctxt = GSCurrentContext();
   DPScurrentlinewidth(ctxt, &width);
   DPSsetlinewidth(ctxt, frameWidth);
-  DPSrectstroke(ctxt,  NSMinX(aRect), NSMinY(aRect), 
-               NSWidth(aRect), NSHeight(aRect));
+  DPSrectstroke(ctxt,  NSMinX(aRect) + frameWidth / 2.0,
+               NSMinY(aRect) + frameWidth / 2.0,
+               NSWidth(aRect) - frameWidth, NSHeight(aRect) - frameWidth);
   DPSsetlinewidth(ctxt, width);
 }
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]