[comp.sys.mac.programmer] smooth scrolling

arenberg@earthquake.Berkeley.EDU (Jeff Arenberg) (12/07/89)

I am working on some code that updates a window from an offscreen
bitmap with scroll bars.  Currently the code that handles a scroll
looks something like :

	ScrollRect (therect, dh, dv, &rgn);
	InvalRgn (rgn);
	CopyBits (...);

The problem is that the updated edges of the window flash for every
scroll.  I know some programs don't have this effect.  Can someone
please send me the proper code to handle this operation?  As always,
thanks in advance, and please respond directly, I can't read news
often enough to stay current.

Jeff Arenberg
arenberg@ocf.berkeley.edu

ewing@tramp.Colorado.EDU (EWING DAVID JAMES) (12/09/89)

In article <1989Dec6.232002.3759@agate.berkeley.edu> arenberg@ocf.Berkeley.EDU (Jeff Arenberg) writes:
>I am working on some code that updates a window from an offscreen
>bitmap with scroll bars.  Currently the code that handles a scroll
>looks something like :
>
>	ScrollRect (therect, dh, dv, &rgn);
>	InvalRgn (rgn);
>	CopyBits (...);
>
>The problem is that the updated edges of the window flash for every
>scroll.  I know some programs don't have this effect.  ...

Don't dop the ScrollRect.  Instead, do a CopyBits to the whole window (minus
the scroll bars).  It makes a big difference.

Another option is to do a CopyBits which REPLACES the ScrollRect.  It would
look something like "CopyBits(thePort, thePort, oldRect, newRect, ...)"  This
has the advantage over ScrollRect of not whiting out the edges of the parts
of the window which will need updating.  You would then do a second CopyBits
like you do now which only updates the invalidated region.

Dave Ewing
ewing@tramp.colorado.edu  (128.138.238.33)
..!hplabs!boulder!onecom!tyvax!iftech!dave (My Mac IIx running uupc & MacOS!)
AppleLink: D2408	  (D2408@applelink.apple.com)