[comp.sys.mac.programmer] help! large offscreen map

wwl90321@uxa.cso.uiuc.edu (01/15/89)

Hello out there!
I was wondering if anyone could tell me what I am missing, it's near
dawn and I can't seem to find the bug! erg!

The problem is this:
i'm doing my work offscreen and then copy bits into an onscreen window.
This works fine for window/offscreen sizes that are less than or
equal to desktop size but if I go bigger (800x800) the window shows
a mess of memory except for a nice square white area in the
upper left, from fiddling I think that somehow my offscreen is
being clipped by the desktop!  however, when I transfer control
from the window to the offscreen bitmap (with setportbits) I
have made sure that offscreen's bitmap.bounds is 800,800 I even
made theport^.portrect equal to the 800x800 before I did an
eraserect 800x800.  Am I missing a mysterious third rect that produces
the visible region? The book says never touch visrgn so I guess
I won't. Any other help would be much appreciated! please send
email. thanks!
-Mark

yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) (01/17/89)

In article <227700002@uxa.cso.uiuc.edu>, wwl90321@uxa.cso.uiuc.edu writes...

>i'm doing my work offscreen and then copy bits into an onscreen window.
>...from fiddling I think that somehow my offscreen is
>being clipped by the desktop!  
>...Am I missing a mysterious third rect that produces
>the visible region? The book says never touch visrgn so I guess
>I won't. Any other help would be much appreciated! please send
>email. thanks!

The book sez don't touch visrgn but go ahead and do it anyway. When you
do your OpenPort for your offscreen bitmap the visRgn of the port is 
init'ed to be the size of the desktop, (IM-1, p.163). But the visRgn is
only used for onscreen clipping of windows, in fact p. 149 sez, "The
visRgn has no effect on images that aren't displayed on the screen."

So the solution is to go into the grafport and reassign it to an
infinitely large region.

////////////////////////////////////////////////////////////
 Internet: yahnke@vms.macc.wisc.edu
   Bitnet: yahnke@wiscmacc(.bitnet)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

jackiw@cs.swarthmore.edu (Nick Jackiw) (01/19/89)

In article <1105@dogie.edu> yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) writes:
> In article <227700002@uxa.cso.uiuc.edu>, wwl90321@uxa.cso.uiuc.edu writes...
> 
> >...Am I missing a mysterious third rect that produces
> >the visible region? The book says never touch visrgn so I guess
> >I won't. 
> 
> The book sez don't touch visrgn but go ahead and do it anyway. 
> So the solution is to go into the grafport and reassign it to an
> infinitely large region.
> 
Now don't forget to save it before hand and restore it either immediately
after drawing to your offscreen map or immediately before copyblitzing from
your map to the screen window/port.

If you're leery about violating the rules (--and I agree with Ross that
this is probably a trivial rule, if you understand the repercussions--),
you can always create a separate grafPort to reference your offscreen
bits (with OpenPort).  This one, never touched by the Window Manager,
is your own baby.  OpenPort() will set its visRgn to "a rectangular
region coincident with screenBits.bounds," which you'll want to dispose-and-
replace (or merely resize) with an infinite region before using as a port.

Peace of mind is only SizeOf(GrafPort) bytes away...

-Nick.


-- 
+-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+
|  nicholas jackiw  | jackiw%campus.swarthmore.edu@swarthmr.bitnet           |
+-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+
                          PER ASPERA AD ASTRA