Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!jarthur!nntp-server.caltech.edu!palmer From: palmer@nntp-server.caltech.edu (David Palmer) Newsgroups: comp.sys.mac.programmer Subject: Re: Optimizing animation processing speed Message-ID: <1991May18.231302.16630@nntp-server.caltech.edu> Date: 18 May 91 23:13:02 GMT References: <1776@babcock.cerc.wvu.wvnet.edu> <8996@ucdavis.ucdavis.edu> Organization: California Institute of Technology, Pasadena Lines: 33 lim@iris.ucdavis.edu (Lloyd Lim) writes: >In article <1776@babcock.cerc.wvu.wvnet.edu> un020070@vaxa.wvnet.edu writes: >>[...] >> >>In this animation, I am moving icons around on the screen. I >>have two offscreen bitmaps. The first offscreen contains the >>background art, which is slow to draw; this way, I only have to >>draw it once. I continually CopyBits this whole bitmap into >>the second bitmap. I draw the icons the second bitmap, then >>copyBits the second bitmap onto the screen. This whole process >>happens every event loop. (Slow as this sounds, I have reason >>to believe that this is actually not the big time-consumer.) >But you can still speed it up. Instead of copying the whole background >over, keep track of where each icon was and just copy over little squares >of the background. You could also take all the old squares, make a region >out of them, and use that as the maskRgn in a CopyBits of the whole >background. I'm not sure which would be faster. Do an 'InvalRect()' on the place where you remove the icons, and on the new location of the icon. Then when you respond to an 'update' event, just write the background and the icons. This does what you suggested-- only writing to the invalidated regions. The Macintosh Way is to not write anything to the screen except during update events. -- David Palmer palmer@gap.cco.caltech.edu ...rutgers!cit-vax!gap.cco.caltech.edu!palmer "Operator, get me the number for 911" --Homer Simpson