Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: CopyBits in MPW C 3.0 Message-ID: <7031@hoptoad.uucp> Date: 18 Apr 89 17:34:24 GMT References: <225@uw-apl.UUCP> <6988@hoptoad.uucp> <8904171804.AA00203@vs03csc.UMD.EDU> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Distribution: na Organization: Eclectic Software, San Francisco Lines: 30 In article <6988@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >Try "CopyBits(*(BitMap **)mypixhandle, ...);" Incidentally, you >shouldn't be passing a pointer to something stored in a relocatable >handle to CopyBits or any other routine listed as allocating or >moving memory. Declare a Rect variable and assign the bounds >rectangle to that, then pass a pointer to the variable instead. In article <8904171804.AA00203@vs03csc.UMD.EDU> russotto@wam.UMD.EDU writes: >I've never had any problem passing dereferenced handles to CopyBits-- >I don't believe it is a routine that moves or purges memory (I believe >it's temp buffers are on the stack) Actually, this almost has to be >for VBL tasks to be able to draw... First, VBL tasks should not draw except to a port that has both its visRgn and clipRgn locked down. This is not a good thing to do to a GrafPort, since both of these need to be resized and that is likely to fail on a locked handle. So, VBL tasks should not draw. In general, it is possible to do any VBL-type animation using a synchronous/asynchronous design -- the async part (the VBL task) raises a flag periodically, which is checked by the sync part (application or whatever) which then does the requested drawing. Second, if it's listed as moving or allocating memory, it may not do so in the current implementation; however, an Apple system programmer might look at the list and decide to have CopyBits allocate an internal handle to use for a buffer. Compatibility means assuming the worst. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "Everything that gives us pleasure gives us pain to measure it by." -- The Residents, GOD IN THREE PERSONS