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