2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/graphics.h>
8 #include <proto/layers.h>
9 #include <proto/exec.h>
10 #include <graphics/rpattr.h>
11 #include "intuition_intern.h"
13 /*****************************************************************************
16 #include <graphics/rastport.h>
17 #include <intuition/cghooks.h>
18 #include <proto/intuition.h>
20 AROS_LH1(struct RastPort
*, ObtainGIRPort
,
23 AROS_LHA(struct GadgetInfo
*, gInfo
, A0
),
26 struct IntuitionBase
*, IntuitionBase
, 93, Intuition
)
29 This function sets up a RastPort for exclusive use by custom
30 gadget hook routines. Call this function each time a hook
31 routine needs to render into the gadget and ReleaseGIRPort()
32 immediately afterwards.
35 gInfo - Pointer to GadgetInfo structure, as passed to each
36 custom gadget hook function.
39 Pointer to a RastPort you can render to. NULL if you aren't
40 allowed to render into this gadget.
43 If a routine passes a RastPort, eg. GM_RENDER, ObtainGIRPort()
56 29-10-95 digulla automatically created from
57 intuition_lib.fd and clib/intuition_protos.h
59 *****************************************************************************/
62 AROS_LIBBASE_EXT_DECL(struct IntuitionBase
*,IntuitionBase
)
66 DEBUG_OBTAINGIRPORT(dprintf("ObtainGIRPort: GInfo 0x%lx Task 0x%lx <%s>\n",
67 gInfo
, FindTask(NULL
),
68 FindTask(NULL
)->tc_Node
.ln_Name
? FindTask(NULL
)->tc_Node
.ln_Name
: "NULL"));
70 if (gInfo
&& gInfo
->gi_RastPort
)
72 rp
= CloneRastPort (gInfo
->gi_RastPort
);
77 /*bug("+++++++++++++ OBTAIN rp=%p lay=%p font=%p origfont=%p\n",rp,rp->Layer,rp->Font,gInfo->gi_RastPort->Font);*/
81 LockLayer(0,rp
->Layer
);
83 if (((GetPrivIBase(IntuitionBase
)->BackupLayerContext
.nestcount
)++) == 0)
85 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.scroll_x
= rp
->Layer
->Scroll_X
;
86 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.scroll_y
= rp
->Layer
->Scroll_Y
;
88 rp
->Layer
->Scroll_X
= 0;
89 rp
->Layer
->Scroll_Y
= 0;
91 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.clipregion
= InstallClipRegion(rp
->Layer
, NULL
);
94 SetWriteMask(rp
, 0xFF);
96 SetRPAttrs(rp
,RPTAG_DrMd
,JAM1
,RPTAG_PenMode
,TRUE
,TAG_DONE
);
98 SetRPAttrs(rp
,RPTAG_DrMd
,JAM1
,TAG_DONE
);
99 #endif /* __MORPHOS__ */
103 DEBUG_OBTAINGIRPORT(dprintf("ObtainGIRPort: RPort 0x%lx\n", rp
));
112 } /* ObtainGIRPort */