Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Optimizing animation processing speed Message-ID: <53054@apple.Apple.COM> Date: 18 May 91 22:28:16 GMT References: <1776@babcock.cerc.wvu.wvnet.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 34 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.) Depending on how many icons you are moving, I can think of two things you could do: - if you have a small number of icons, then don't refresh the entirety of your second buffer. Just overwrite the few icons selectively. That way, you aren't refreshing the majority of your second buffer that doesn't need it. - if you have a large number of icons, then the overhead of calling QuickDraw a large number of times my actaully slow you down enough that a single Copybits call to copy the entire buffer is faster. However, if your buffers are bitmaps with the same dimensions, or PixMaps with the same dimensions and color table information, then try using BlockMove instead of CopyBits. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "But where the senses fail us, reason must step in." - Galileo