CloneRastPort
Synopsis
clonerp = CloneRastPort(rp)
D0 A0C Prototype
struct RastPort *CloneRastPort(struct RastPort *rp);Description
Creates a copy of a RastPort structure. It allocates a new RastPort and copies the data from the source RastPort into the newly allocated one. Use exec.library/FreeVec() to free the memory when it is no longer needed.
Inputs
- rp — Address of the RastPort structure to be cloned.
Result
- clonerp — Address of the new RastPort structure, identical in data to the one passed in the inputs. If NULL, an error occurred.
See Also
- AllocRastPort
exec.library/FreeVec()
Implementation
The original 68020 assembly implementation:
; (25-Oct-1994) --- clonerp = CloneRastPort(rp) (a0)
_LVOCloneRastPort
movem.l d2/a3-a6,-(sp)
move.l a0,a3
move.l #4+rp_SIZEOF,d0 ; Alloc My Raster Port structure
move.l d0,d2
moveq #1,d1
swap d1
move.l ab_ExecBase(a5),a6
jsr _LVOAllocMem(a6)
tst.l d0
beq.s CRP_EXT
move.l d0,a4
move.l d2,(a4)+
move.l a4,a0
REPT (rp_SIZEOF/2)
move.w (a3)+,(a0)+
ENDR
move.l a4,d0
CRP_EXT movem.l (sp)+,d2/a3-a6
rtsLast updated on