Path: utzoo!attcan!uunet!ogicse!caesar.cs.montana.edu!uakari.primate.wisc.edu!brutus.cs.uiuc.edu!wuarchive!udel!rochester!rit!cci632!ph From: ph@cci632.UUCP (Pete Hoch) Newsgroups: comp.sys.mac.programmer Subject: Re: ARGH!! Trivial Question; Please Help Summary: CopyBits and PixMapHandles. Message-ID: <34996@cci632.UUCP> Date: 12 Mar 90 22:57:36 GMT References: <16616@well.sf.ca.us> Organization: Computer Consoles Inc. an STC Company, Rochester, NY Lines: 38 > 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. An example: CopyBits( myOffscreen^.portBits, thePort^.portBits, ... The global thePort may be pointing to a GrafPort or to a CGrafPort I don't know which, therefore CopyBits must take care of it for me. As I said before, I do not believe this but my friends do. Unfortunately I have not been able to convince them. So any ideas why this is wrong? Or is it right? Pete Hoch