Page 1 of 1

gpRender Rastports Layers and setting a BackFillHook

Posted: Mon Mar 16, 2015 5:46 pm
by broadblues
Part of the project I'm working invloves som e low level BOOPSI work, and I'm a little unsure of correct usage of Ratsport etc.

When rendering inside the GM_RENDER call you recive the gprender message

/* GM_RENDER */
struct gpRender
{
ULONG MethodID;
struct GadgetInfo *gpr_GInfo; /* gadget context */
struct RastPort *gpr_RPort; /* all ready for use */
LONG gpr_Redraw; /* might be a "highlight pass" */
};

which has a Rast Port inside it. gpr_RPort;

But there is also a RastPort within the GagetInfo structure.

which one should I be using?

I have been using the gpr_RPort and all has been working okay but for some more adavanced rendering I want to set a temporary backfill hook, so did the following:

Code: Select all

		oldhook = InstallLayerHook(gpr->gpr_RPort->Layer,icd->icd_TransBackFillHook);
   		
   		if(topedge > ib->Top)
   		{
	   		EraseRect(gpr->gpr_RPort,ib->Left,ib->Top,ib->Left + ib->Width -1 ,topedge -1 );
	   	}
/* snip */

	   	InstallLayerHook(gpr->gpr_RPort->Layer,oldhook);
It didn't appear to work, the EraseRect still filled the erased area with a default grey, whilst I may have made an error in my hook, this made me wonder which RastPort I should be using in this case or should I be using the Layer refrenced in the gadget info structure.

So the question is why might the change of backfill hook not have worked in the gpReender->gp_RPort (has it even got a Layer?) and am I correct in thinking that's the one I should be using.

Re: gpRender Rastports Layers and setting a BackFillHook

Posted: Tue Mar 17, 2015 2:03 am
by broadblues
Bah Hook didn't work because I hadn't allocated it :oops: :oops: :oops:

/me slinks away in embarassment....

Re: gpRender Rastports Layers and setting a BackFillHook

Posted: Tue Mar 17, 2015 2:54 am
by LyleHaze
correct usage of Ratsport etc.
Is that where the user stores their Mouse?
:)