1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.mcc Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
21 ***************************************************************************/
23 #include <exec/memory.h>
24 #include <proto/graphics.h>
25 #include <proto/exec.h>
27 #include "SDI_compiler.h"
35 #define USE_OS3 (((struct Library *)GfxBase)->lib_Version >= 39)
38 /// MUIG_AllocBitMap()
39 struct BitMap
* SAVEDS ASM
MUIG_AllocBitMap(REG(d0
, LONG width
), REG(d1
, LONG height
), REG(d2
, LONG depth
), REG(d3
, LONG flags
), REG(a0
, struct BitMap
*friend))
41 struct BitMap
*bm
= NULL
;
45 #if defined(__amigaos4__)
46 bm
= AllocBitMap(width
,height
,depth
,flags
,friend);
47 #elif defined(__MORPHOS__) || defined(__AROS__)
48 bm
= AllocBitMap(width
,height
,depth
,flags
| BMF_MINPLANES
| BMF_DISPLAYABLE
, friend);
54 // FindSemaphore() must be called in Forbid()den state
56 if(FindSemaphore((char *)"cybergraphics.library") != NULL
&&
57 (GetBitMapAttr(friend,BMA_FLAGS
) & BMF_INTERLEAVED
) == 0)
58 flags
|= BMF_MINPLANES
;
64 bm
= AllocBitMap(width
,height
,depth
,flags
,friend);
68 if((bm
= (struct BitMap
*)AllocVec(sizeof(*bm
), MEMF_CLEAR
)) != NULL
)
70 int i
, plsize
=RASSIZE(width
,height
);
72 InitBitMap(bm
,depth
,width
,height
);
74 if((bm
->Planes
[0] = AllocVec(plsize
*depth
,(flags
& BMF_CLEAR
) ? MEMF_CHIP
|MEMF_CLEAR
: MEMF_CHIP
))) // !!!
77 bm
->Planes
[i
] = (PLANEPTR
)(((ULONG
)bm
->Planes
[i
-1]) + plsize
);
94 void SAVEDS ASM
MUIG_FreeBitMap(REG(a0
, struct BitMap
*bm
))
98 #if defined(__amigaos4__) || defined(__MORPHOS__) || defined(__AROS__)
101 WaitBlit(); /* OCS/AGA need this before FreeBitMap() call */
109 FreeVec(bm
->Planes
[0]);