NewAllocRaster
Synopsis
planeptr = NewAllocRaster(width, height)
D0 D0 D1C Prototype
PLANEPTR NewAllocRaster(ULONG width, ULONG height);Description
A simpler way to allocate a pre-cleared bitplane. This function is faster than graphics.library/AllocRaster(), and additionally allocates a plane that is already cleared. It also simplifies deallocation, as the result can be sent directly to exec.library/FreeVec().
(V41.1) — For future compatibility reasons, the use of this function is discouraged. Always use AddBitPlanes() and RemoveBitPlanes() when possible. The same recommendation applies to graphics.library/AllocRaster() and FreeRaster().
Inputs
- width — Desired width of the plane in pixels.
- height — Desired height of the plane in pixels.
Result
- planeptr — If NULL, an error occurred. Otherwise, it is a pointer to the allocated bitplane, already cleared.
Notes
Planes created with this function must be freed manually. You CANNOT use RemoveBitPlanes() to free them.
See Also
- AddBitPlanes
exec.library/FreeVec()
Implementation
The original 68020 assembly implementation:
; (06-10-1994) --- planeptr = NewAllocRaster(width, height) (d0,d1)
_LVONewAllocRaster
movem.l d2/a6,-(sp)
add.w #$F,d0
asr.w #3,d0
bclr #0,d0
mulu.w d1,d0
addq.w #4,d0
move.l d0,d2
lea MEMF_CHIP|MEMF_CLEAR,a0
move.l a0,d1
move.l ab_ExecBase(a6),a6
jsr _LVOAllocMem(a6)
move.l d0,a0
move.l d2,(a0)+
move.l a0,d0
movem.l (sp)+,d2/a6
rts