[comp.sys.amiga.tech] Who frees CUSTOMBITMAPs?

brett@smosjc.UUCP (Brett Coon) (01/08/91)

When you open a screen with the CUSTOMBITMAP flag set in the NewScreen struc-
ture, will CloseScreen free the bitmap memory?  If so, how can I prevent this
from happenning so that I can free the memory myself at a later time?

On a related topic, is it correct that memory must be freed in the same block
sizes in which it is allocated?  I.E. if I use AllocRaster to allocate a 
640x200 bitmap, I can't free it as two 320x200 bitmaps, right?

Finally, if I want to open a 320x200 pixel screen that shows 1/2 of a 640x200
pixel bitmap, is it correct that I should specify 320x200 in the NewScreen
structure but 640x200 in my (custom) BitMap structure?  I tried specifying
640x200 in both (but not setting the HIRES flag in NewScreen), and it appears
to have opened an overscan screen, which is not what I want.  I'd prefer not
to play with the RasInfo and related structures any more than I have to, so
I'm looking for a combination of settings that will open the appropriate
screen directly.

Thanks,
-brett

-- 
|Brett Coon           |  uunet!smosjc!brett                       |
|S-MOS Systems, Inc.  |  "Very exciting... as a luggage problem." |
|San Jose, CA         |            -Joe Vs. The Volcano           |

peter@sugar.hackercorp.com (Peter da Silva) (01/08/91)

In article <324@smosjc.UUCP> brett@smosjc.UUCP (Brett Coon) writes:
> When you open a screen with the CUSTOMBITMAP flag set in the NewScreen struc-
> ture, will CloseScreen free the bitmap memory?

No.

> On a related topic, is it correct that memory must be freed in the same block
> sizes in which it is allocated?

In a manner of speaking: you must free the same requests that were made.
-- 
Peter da Silva.   `-_-'
<peter@sugar.hackercorp.com>.

markv@kuhub.cc.ukans.edu (01/09/91)

In article <324@smosjc.UUCP>, brett@smosjc.UUCP (Brett Coon) writes:
> When you open a screen with the CUSTOMBITMAP flag set in the NewScreen struc-
> ture, will CloseScreen free the bitmap memory?  If so, how can I prevent this
> from happenning so that I can free the memory myself at a later time?

No, Intuition does NOT free memory on a CUSTOMBITMAP screen, its up to
you.  That includes both the Bitmap struct and the actual raster.
 
> On a related topic, is it correct that memory must be freed in the same block
> sizes in which it is allocated?  I.E. if I use AllocRaster to allocate a 
> 640x200 bitmap, I can't free it as two 320x200 bitmaps, right?

To be on the safe side in all cases the answer is yes.  The reason is
to insure future compatibilty with new or replacement functions that
might want to do resource tracking, etc.

> Finally, if I want to open a 320x200 pixel screen that shows 1/2 of a 640x200
> pixel bitmap, is it correct that I should specify 320x200 in the NewScreen
> structure but 640x200 in my (custom) BitMap structure?

You can not do this at the SCREEN level.  When you set the resolution
on the NewScreen structure, you are setting the HARDWARE resolution.
The bitmap for the screen must be equal in size to the screen.  The
system is trying to fit your 640 pixels on the display in LORES via
overscan.

The better way to do this is open a conventional screen, then open a
SuperBitMap window.  If it's a borderless backdrop window, the visual
effect will be the same, but you'll have the advantage of a window for
its IDCMP, and you can easily scroll the bitmap with ScrollVPort().
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mark Gooderum			Only...		\    Good Cheer !!!
Academic Computing Services	       ///	  \___________________________
University of Kansas		     ///  /|         __    _
Bix:	  markgood	      \\\  ///  /__| |\/| | | _   /_\  makes it
Bitnet:   MARKV@UKANVAX		\/\/  /    | |  | | |__| /   \ possible...
Internet: markv@kuhub.cc.ukans.edu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~