Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!rutgers!att!pegasus!ech From: ech@pegasus.ATT.COM (Edward C Horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: Text Drawing at speeds greater than 1200baud Message-ID: <2534@pegasus.ATT.COM> Date: 21 Jan 89 20:04:38 GMT References: <1728@helios.ee.lbl.gov> Organization: AT&T ISL Middletown NJ USA Lines: 30 In article <24307@apple.Apple.COM> parent@Apple.COM (Sean Parent) writes: >There is no way to tell for sure that there are not any windows in front of >your window. The system owns the screen. From article <1728@helios.ee.lbl.gov>, by beard@ux1.lbl.gov (Patrick C Beard): > Not true. It is very easy. Just look at the visRgn of the window in > question. Clip your optimized drawing directly to the screen to this and > you won't get in trouble. I know, I've done it. It is dirty pool, but > it does work. There is NOTHING "dirty pool" about this technique: the visRgn is, quite precisely, the visible region of your port, and IM-I (Quickdraw) makes it very clear that your drawing will be clipped to the visRgn (among other things). Limiting drawing to the visRgn is a perfectly wonderful (and safe, presumably forever) means of limiting the cost of updates. Multifinder takes the responsibility of removing the visRgn of each layer from that of the layers beneath. Makes sense, ne? You never HAVE to draw anything that doesn't intersect the visRgn, nor will it ever do you any good to draw stuff that isn't in the visRgn. Also, please note that BeginUpdate "saves" the visRgn, and sets the visRgn to the intersection of the visRgn and the updateRgn. EndUpdate restores the visRgn. So Beard's "trick" properly limits the work you have to do whenever there's an update event. No trick, no dirty pool: good programming practice! =Ned Horvath=