home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / mac / programm / 15408 < prev    next >
Encoding:
Text File  |  1992-09-12  |  1.9 KB  |  47 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!terminator!krk
  3. From: krk@itl.itd.umich.edu (Kenneth Knight)
  4. Subject: Re: LockPixels() before every CopyBits()?
  5. Message-ID: <1992Sep12.222527.16562@terminator.cc.umich.edu>
  6. Sender: news@terminator.cc.umich.edu (Usenet Owner)
  7. Organization: Instructional Technology Laboratory, University of Michigan
  8. References: <1992Sep11.213220.23039@alias.com>
  9. Date: Sat, 12 Sep 1992 22:25:27 GMT
  10. Lines: 35
  11.  
  12. In article <1992Sep11.213220.23039@alias.com> Reid Ellis <rae@Alias.com> writes:
  13. >Inside Mac V says that LockPixels() must be called before drawing into
  14. >an offscreen GWorld.  And yet the examples within the next few pages
  15. >don't call LockPixels()!  What's the scoop here?
  16. >
  17. >I think I've tracked down a bug in our program where it crashes on a
  18. >Quadra 700 but not on a IIci during a call to CopyBits().  On the
  19. >Quadra, the baseAddr of one of the bitmaps was F9001000, which was way
  20. >out of line with other addresses.  I would guess it's either invalid
  21. >or the address of the built-in VRAM.  I can't find any doc that says
  22. >"The 32-bit address of the Quadra's VRAM is xxxx".
  23. >
  24. >Assuming that the address is okay, I noticed that we don't call
  25. >LockPixels() before CopyBits().  After inserting calls to LockPixels()
  26. >and UnlockPixels(), it looks something like this:
  27. >
  28. >    HLock((Handle) pixHandle1);
  29. >    HLock((Handle) pixHandle2);
  30. >    LockPixels(pixHandle1);
  31. >    LockPixels(pixHandle2);
  32. >    CopyBits((BitMap *)*pixHandle1, (BitMap *)*pixHandle2, ...);
  33. >    UnlockPixels(pixHandle2);
  34. >    UnlockPixels(pixHandle1);
  35. >    HUnlock((Handle) pixHandle2);
  36. >    HUnlock((Handle) pixHandle1);
  37. >
  38. >Now this seems to be a bit much for every call to CopyBits.  Is this
  39. >trip really necessary?  Would it be quicker to check to see is each
  40. >PixMapHandle is offscreen?
  41.  
  42. You can remove the HLock/HUnlcok calls certainly. I'd keep the LockPixels/
  43. UnlockPixels() calls in place. 
  44.  
  45.   ** Ken **
  46.  
  47.