home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 21276 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.5 KB  |  68 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!sunic!kth.se!hemul.nada.kth.se!d88-jwa
  3. From: d88-jwa@hemul.nada.kth.se (Jon WΣtte)
  4. Subject: Re: Direct screen writing; getting to (x,y)
  5. Message-ID: <1993Jan12.131009.8845@kth.se>
  6. Sender: usenet@kth.se (Usenet)
  7. Nntp-Posting-Host: hemul.nada.kth.se
  8. Organization: Royal Institute of Technology, Stockholm, Sweden
  9. References: <1993Jan11.235448.22675@afterlife.ncsc.mil> <1993Jan12.021320.7406@nntp.hut.fi> <1993Jan12.081850.12759@afterlife.ncsc.mil>
  10. Date: Tue, 12 Jan 1993 13:10:09 GMT
  11. Lines: 55
  12.  
  13. In <1993Jan12.081850.12759@afterlife.ncsc.mil> mssmith@afterlife.ncsc.mil (M. Scott Smith) writes:
  14.  
  15. >  *(char *)(base_addr + x + line[y]) = color;
  16.  
  17. Why not simply make an array of the row starts?
  18. It's much faster!
  19.  
  20. >including bit depth.  What would be the easiest way to handle different
  21. >bit depths?  My primary concern for now is 8-bit.
  22.  
  23. You have to special-case each bit depth; there was a Mac programming
  24. FAQ at one time; it showed how to do this. I think the UMPG does as
  25. well.
  26.  
  27. >   Is my new routine a bit more friendly, or does it still have a problem?
  28.  
  29. It doesn't call SwapMMUMode, so it breaks.
  30.  
  31. >assume I should be calling SwapMMUMode in my PlotPoint function, right
  32. >before and after I do the plot.  Does this eat up much processor time?
  33.  
  34. Yes you should, and yes it does.
  35.  
  36. >It seems if I'm plotting hundreds of points, then making those hundreds of
  37. >calls might have a performance penalty.  But I don't know.  (And I guess
  38. >it's necessary in some cases anyway.)
  39.  
  40. You could instead do this:
  41.  
  42. Pre-calculate points to plot
  43. SwapMMUMode
  44. iterate-over-points-and-plot-them
  45. SwapMMUMode
  46.  
  47. Your function works well as a plotting function if you do this.
  48. To save time; check at the beginning wether the machine is in
  49. 32-bit mode, and only call SwapMMUMode if it isn't. (Skanky! :-)
  50.  
  51. >   Someone would do that??  How rude.  :)  Would the best strategy be to
  52. >periodically check the depth of the screen you're working with, like in the
  53. >event loop, and then to do whatever's necessary if the bit depth suddenly
  54. >changes?  (Like maybe put up a dialog that say "hey, don't do that!", or
  55. >re-compute everything.)
  56.  
  57. Actually, you should check the depth RIGHT after the call to
  58. WaitNextEvent every time. You will get update events when the
  59. resolution is changed, but other events have priority, so...
  60.  
  61. Cheers,
  62.  
  63.                             / h+
  64. -- 
  65.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  66.    This signature is kept shorter than 4 lines in the interests of UseNet
  67.    S/N ratio.
  68.