home *** CD-ROM | disk | FTP | other *** search
- Path: ousrvr3.oulu.fi!kinnunen
- From: kinnunen@stekt.oulu.fi (Teijo Kinnunen)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Layers problem
- Date: 3 Jan 1996 12:14:17 GMT
- Organization: University of Oulu, Department of Electrical Engineering, Finland
- Message-ID: <4cdrup$gqj@ousrvr3.oulu.fi>
- NNTP-Posting-Host: stekt10.oulu.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: TIN [version 1.2 PL2]
-
- Hi everyone,
-
- I have a bizarre problem with using layers.library, which I haven't yet
- been able to solve.
-
- I need a temporary (not displayed) bitmap with clipping, so I have to use
- layers. Below's a short program that allocates a bitmap, and then creates
- a layer on it, and immediately frees everything.
-
- --- cut ---
- #include <proto/layers.h>
- #include <proto/graphics.h>
-
- void main(int argc,char **argv)
- {
- struct Layer *la;
- struct Layer_Info *li;
- struct BitMap *bmap = AllocBitMap(640,80,1,BMF_CLEAR|BMF_DISPLAYABLE,
- NULL);
- li = NewLayerInfo();
- la = CreateBehindLayer(li,bmap,0,0,639,79,LAYERSMART|LAYERBACKDROP,
- NULL);
- DeleteLayer(0,la);
- DisposeLayerInfo(li);
- FreeBitMap(bmap);
- }
- --- cut ---
- (*Ought to* work under OS 3.0/3.1, compiles with SAS/C V6.56)
-
- Anyway, it does not work. The allocation seems to work fine, but the
- FreeBitMap() call corrupts memory. (At least if the program is run a
- couple of times. Enforcer can be used, but Mungwall causes the bug to
- vanish.)
-
- Is there anything wrong in the above piece of code, or have I found a
- bug in OS 3.1? I'd appreciate if someone who's more clever than me
- could shed some light on the matter...
-
- - Teijo
-
- --
- o------------------------------------------------------------------o
- / Teijo Kinnunen - Valkkyla 7 as 413 - 90100 OULU - FINLAND /
- / Student at University of Oulu, Dept. of Electrical Engineering /
- / Teijo.Kinnunen@oulu.fi -- http://stekt.oulu.fi/~kinnunen/ /
- o------------------------------------------------------------------o
-