discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSClipview patch (was Misc. comments)


From: Malmberg
Subject: Re: NSClipview patch (was Misc. comments)
Date: Sat, 20 Jan 2001 18:39:16 +0100

[snip]
> > I'd really like to remove the hack which reduces the real coordinates to
> > integers in NSClipView - but if you try removing the code/hack, and then
> > try scrolling a table view or a text view, you see it gets immediately
> > terrible.  If you have patches or fixes, they are welcome of course.
> 
> As far as I can tell, separating scroll-coordinates and
> rendering-coordinates should solve the problems (no drifting, and
> copying for performance still works). I'll see what I can do about it.

OK, it turned out that wasn't necessary. The reason for the drifting and
non-integer deltas were that the converting to/from device space was
done using the clipview's coordinate system, and it kept changing due to
the scrolling. I've attached a patch that does the converts using
_super_view instead (do you have to check that it's not nil?), and it
fixed the drifting and the distortions (at least all cases I know of).

There's still a problem with scrolling when the entire clipview isn't
visible. In that case, the NSCopyBits won't work since there'll be
nothing to copy, and display will be messed up. I've fixed this by only
copying over the part that's actually visible. This seems to fix this,
although it seems that the leftmost column isn't always updated
properly. A safer (but slower) way of doing this would be to simply not
use NSCopyBits if the entire clipview isn't visible.

- Alexander Malmberg
Index: NSClipView.m
===================================================================
RCS file: /gnustep/gnustep/core/gui/Source/NSClipView.m,v
retrieving revision 1.43
diff -u -r1.43 NSClipView.m
--- NSClipView.m        2001/01/16 12:31:22     1.43
+++ NSClipView.m        2001/01/20 15:21:17
@@ -146,6 +146,7 @@
       // then tell docview to draw the exposed parts.
       // intersection is the common rectangle
       intersection = NSIntersectionRect(originalBounds, newBounds);
+      intersection = NSIntersectionRect(intersection, [self visibleRect]);
       if (NSEqualRects(intersection, NSZeroRect))
        {
          // no intersection -- docview should draw everything
@@ -258,10 +259,10 @@
 
   // make it an integer coordinate in device space
   // to avoid some nice effects when scrolling
-  new = [self convertPoint: new toView: nil];
+  new = [_super_view convertPoint: new toView: nil];
   new.x = (int)new.x;
   new.y = (int)new.y;
-  new = [self convertPoint: new fromView: nil];
+  new = [_super_view convertPoint: new fromView: nil];
 
   return new;
 }



reply via email to

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