Path: utzoo!attcan!uunet!samsung!aplcen!haven!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: ARGH!! Trivial Question; Please Help Message-ID: <1990Mar13.174129.12874@eng.umd.edu> Date: 13 Mar 90 17:41:29 GMT References: <16616@well.sf.ca.us> <34996@cci632.UUCP> Sender: news@eng.umd.edu (The News System) Organization: Maryversity of Uniland, College Park Lines: 33 In article <34996@cci632.UUCP> ph@cci632.UUCP (Pete Hoch) writes: >> Nick Jackiw writes: >> _>I've been knocking myself out over a simple (stupid) question: > >Question about using PixMapHandles in Copybits. > >David Phillip Oster replies: >> The correct call is: >> HLock(Handle(srcPixMapHandle)); >> HLock(Handle(destPixMapHandle)); >> CopyBits(BitMapHandle(srcPixMapHandle)^^, >> BitMapHandle(destPixMapHandle)^^, >> srcRect, destRect, srcCopy, NIL); >> HUnlock(Handle(srcPixMapHandle)); >> HUnlock(Handle(destPixMapHandle)); > >I have some friends who disagree with this and I will try to argue >their point. Who said you have to lock the handles before calling >CopyBits? I have never seen sample code from Apple that does this. >In fact the brand new publication from Apple "Develop" has code >samples that use CopyBits with PixMapHandles and they DO NOT lock >the Handles. I think, but have no proof that CopyBits checks >the Bit/PixMap type, (it has to do this anyway) and if it is a >PixMapHandle then CopyBits takes care of the memory management >problems, (if there are any) for you. Lock the handles. Portbits is a special case-- you pass it a POINTER to a HANDLE to a PIXMAP, instead of the usual pointer to PixMap or pointer to BitMap. I think Copybits detects this situation. And before someone at DTS jumps all over me for this, I've tried it. -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?