2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Graphics function CloneRastPort()
8 #include "graphics_intern.h"
9 #include <exec/memory.h>
10 #include <graphics/rastport.h>
11 #include <proto/exec.h>
12 #include "gfxfuncsupport.h"
14 /*****************************************************************************
17 #include <graphics/rastport.h>
18 #include <proto/graphics.h>
20 AROS_LH1(struct RastPort
*, CloneRastPort
,
23 AROS_LHA(struct RastPort
*, rp
, A1
),
26 struct GfxBase
*, GfxBase
, 178, Graphics
)
29 This function creates a copy of a RastPort.
32 rp - The RastPort to clone.
35 A pointer to a RastPort with the same attributes as the RastPort
36 which was specified or NULL if there was not enough memory to perform
40 This function is AROS specific. For compatibility, there is a
41 function in aros.lib which does the same on Amiga.
48 CreateRastPort(), FreeRastPort()
53 29-10-95 digulla automatically created from
54 graphics_lib.fd and clib/graphics_protos.h
56 *****************************************************************************/
60 struct RastPort
* newRP
;
62 newRP
= AllocMem (sizeof (struct RastPort
), MEMF_ANY
);
66 CopyMem (rp
, newRP
, sizeof (struct RastPort
));
67 RP_BACKPOINTER(newRP
) = newRP
;
68 RP_DRIVERDATA(newRP
) = NULL
;
69 newRP
->Flags
|= RPF_SELF_CLEANUP
;
71 if (!OBTAIN_DRIVERDATA(newRP
, GfxBase
))
73 FreeMem (newRP
, sizeof (struct RastPort
));
78 /* copy rastports attributes */
79 SetFont(newRP
, rp
->Font
);
80 SetABPenDrMd(newRP
, GetAPen(rp
), GetBPen(rp
), GetDrMd(rp
));
81 Move(newRP
, rp
->cp_x
, rp
->cp_y
);
83 #warning Some attributes not copied
85 RELEASE_DRIVERDATA(newRP
, GfxBase
);