website logo
Auteur
avatar
thellier

Forum » » OS4 sur AmigaOne X5000 » » E-UAE sur X5000


Posté : 17-11-2017 15:53 icone du post

on c'est mal compris : je voulais dire si je savais quelle partie il faut modifier (où ajouter cette fonction dans le code) alors ajouter le compositing ne serait pas difficile

Mais j'essayerai de le recompiler la semaine prochaine car je comprends pas que le rendu cybergraphics soit lent (peut être est il pas compilé dans nos versions)

Alain

Voici le code que j'utilise dans GMAP pour updater une fenetre au Compositing automatiquement (!refresh! window):

/*============================================================== ============*/
struct Rectangle winrect;
#ifdef OS4
struct Hook winhook;
/*========================================================================= =*/
/* The hook for performing compositing to a rastport. */
/* Thanks to Fredrik Wikstrom (a.k.a., salass00) for the example code... */
/* rastPort: pointer to the RastPort to render to */
/* msg: pointer to the backfill */
/*======================================================================= ===*/
ULONG compositeHookFunc(struct Hook *hook, struct RastPort *rastPort, struct BackFillMessage *msg) {
struct GM_Game   *G=(struct GM_Game *)hook->h_Data;
struct OS_Screen *S=G->screen;
struct Window *window;
struct BitMap *bm;
 
struct GM_Rect Dst; 
struct GM_Rect *Src; 
float ScaleX,ScaleY;
ULONG flags,ret;
 
 window=S->window;
 Src=&S->T-&g t;rect;
 bm=S->T->bm;

 winrect.MinX = window->BorderLeft;
 winrect.MinY = window->BorderTop;
 winrect.MaxX = window->Width  - window->BorderRight  - 1;
 winrect.MaxY = window->Height - window->BorderBottom - 1;
 
 Dst.x  = winrect.MinX;
 Dst.y  = winrect.MinY;
 Dst.w  = winrect.MaxX - winrect.MinX + 1;
 Dst.h  = winrect.MaxY - winrect.MinY + 1;
 
 ScaleX = (Dst.w + 0.5f) / Src->w;
 ScaleY = (Dst.h + 0.5f) / Src->h;
 
 if(S->filter)
  flags= COMPFLAG_SrcFilter|COMPFLAG_IgnoreDestAlpha;
 else
  flags= COMPFLAG_IgnoreDestAlpha;

 ret = CompositeTags(
 COMPOSITE_Src_Over_Dest,bm, rastPort->BitMap,
 COMPTAG_SrcWidth,  Src->w,
 COMPTAG_SrcHeight, Src->h,
 COMPTAG_ScaleX,  COMP_FLOAT_TO_FIX(ScaleX),
 COMPTAG_ScaleY,  COMP_FLOAT_TO_FIX(ScaleY), 
 COMPTAG_OffsetX, msg->Bounds.MinX - (msg->OffsetX - Dst.x),
 COMPTAG_OffsetY, msg->Bounds.MinY - (msg->OffsetY - Dst.y),
 COMPTAG_DestX,  msg->Bounds.MinX,
 COMPTAG_DestY,  msg->Bounds.MinY,
 COMPTAG_DestWidth, msg->Bounds.MaxX - msg->Bounds.MinX + 1,
 COMPTAG_DestHeight, msg->Bounds.MaxY - msg->Bounds.MinY + 1,
 COMPTAG_Flags,flags,
 TAG_END);

 return 0;
}
/*========================================================================= =*/
void  OS4SetCompositeHook(struct GM_Game   *G)
{
struct OS_Screen *S=G->screen;
struct Window *window;
 
 window=S->window;
 winrect.MinX = window->BorderLeft;
 winrect.MinY = window->BorderTop;
 winrect.MaxX = window->Width  - window->BorderRight  - 1;
 winrect.MaxY = window->Height - window->BorderBottom - 1;
 
 LockLayer(0, window->RPort->Layer);
// Need to composite onto the window's rastport. As CompositeTags() only renders to bitmaps we use DoHookClipRects() */
 winhook.h_Entry = (HOOKFUNC)compositeHookFunc;
 winhook.h_Data  = G;
 DoHookClipRects(&winhook,window->RPort,&winrect);

 UnlockLayer(window->RPort->Layer);
}
#endif 



Sam440 - Sam460 - X5000 - PowerBookG4 - WinUAE - MiniMig

Cet article provient de Le site des utilisateurs francophones actuels et futurs d'AmigaOS 4.x
https://amiga-ng.org/viewtopic.php?topic=2468&forum=21