Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.csd.uwm.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: turning on a pixel Message-ID: <30894@ucbvax.BERKELEY.EDU> Date: 25 Aug 89 04:23:45 GMT References: <6294@hubcap.clemson.edu> <227700031@uxa.cso.uiuc.edu> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 33 Many people think they can optimise single pixel drawing by just drawing directly into screen memory, and you can, bu tlook at the problems: (i) your drawing isn't clipped against screen boundaries, the boundaries of windows above the one you are trying to draw into, or drawing over the image of the cursor. (circa 1985) (ii) If the user has color QuickDraw, the screen could be an unusual size, shape, and depth. In addition, since a window may span multiple screens, you can't depend on the basAddr of the pixmap pointing anywhere in particular, you have to work your way down the list of gDevices, looking at screen rectangles in global coordinates. (circa 1987) (iii) If the user has 32-bit Color Quickdraw, the screen may be in another world entirely: when you call QuickDraw with 32-bit color quickdraw installed, it flips the system into 32-bit mode, thereby radically changing the memory map. If you try direct memory access through the basAddr of a gDevice directly, from an ordinary program, the system will probably crash with a bus error. (circa 1989) Notice, that Apple adds a new, unanticipatible reason not to do this every two years or so. Do everything right today to directly twiddle screen memory, and it is likely that Apple will still kill your program within two years from now. Conclusion: directly bit-twiddle an off-screen bitmap, then call CopyBits to display it for you. It will save you much prsent pain, and still more future pain. --- According to the Constitution, the Constitution is unconstitutional: --- David Phillip Oster --U.S.Constitution I.10.1: "No State shall Arpa: oster@dewey.soe.berkeley.edu --enter into any treaty, alliance, or Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu -- confederation..."