2 Copyright © 1995-2013, 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>
12 #include "intuition_intern.h"
14 /*****************************************************************************
17 #include <graphics/rastport.h>
18 #include <intuition/cghooks.h>
19 #include <proto/intuition.h>
21 AROS_LH1(struct RastPort
*, ObtainGIRPort
,
24 AROS_LHA(struct GadgetInfo
*, gInfo
, A0
),
27 struct IntuitionBase
*, IntuitionBase
, 93, Intuition
)
30 This function sets up a RastPort for exclusive use by custom
31 gadget hook routines. Call this function each time a hook
32 routine needs to render into the gadget and ReleaseGIRPort()
33 immediately afterwards.
36 gInfo - Pointer to GadgetInfo structure, as passed to each
37 custom gadget hook function.
40 Pointer to a RastPort you can render to. NULL if you aren't
41 allowed to render into this gadget.
44 If a routine passes a RastPort, eg. GM_RENDER, ObtainGIRPort()
56 *****************************************************************************/
60 struct GfxBase
*GfxBase
= GetPrivIBase(IntuitionBase
)->GfxBase
;
61 struct LayersBase
*LayersBase
= GetPrivIBase(IntuitionBase
)->LayersBase
;
64 DEBUG_OBTAINGIRPORT(dprintf("ObtainGIRPort: GInfo 0x%lx Task 0x%lx <%s>\n",
65 gInfo
, FindTask(NULL
),
66 FindTask(NULL
)->tc_Node
.ln_Name
? FindTask(NULL
)->tc_Node
.ln_Name
: "NULL"));
68 if (gInfo
&& gInfo
->gi_RastPort
)
70 rp
= CloneRastPort (gInfo
->gi_RastPort
);
74 LOCKGADGET(IntuitionBase
)
75 /*bug("+++++++++++++ OBTAIN rp=%p lay=%p font=%p origfont=%p\n",rp,rp->Layer,rp->Font,gInfo->gi_RastPort->Font);*/
79 LockLayer(0,rp
->Layer
);
81 if (((GetPrivIBase(IntuitionBase
)->BackupLayerContext
.nestcount
)++) == 0)
83 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.scroll_x
= rp
->Layer
->Scroll_X
;
84 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.scroll_y
= rp
->Layer
->Scroll_Y
;
86 rp
->Layer
->Scroll_X
= 0;
87 rp
->Layer
->Scroll_Y
= 0;
89 GetPrivIBase(IntuitionBase
)->BackupLayerContext
.clipregion
= InstallClipRegion(rp
->Layer
, NULL
);
92 SetWriteMask(rp
, 0xFF);
93 SetRPAttrs(rp
,RPTAG_DrMd
,JAM1
,RPTAG_PenMode
,TRUE
,TAG_DONE
);
97 DEBUG_OBTAINGIRPORT(dprintf("ObtainGIRPort: RPort 0x%lx\n", rp
));
106 } /* ObtainGIRPort */