void GFXS_BitBltType( void (*GFX_P_OSFunc)( struct Tracker_Windows *window, int dx,int dy, int x,int y, int x2,int y2 ), struct Tracker_Windows *window, int dx,int dy, int x,int y, int x2,int y2 ) { struct WBlocks *wblock=window->wblock; if(GFXS_EnsureBoundaries(window,"GFXS_BitBltType",x,y,x2,y2)==false){ OS_GFX_CancelMixColor(window); return; } if(x+dx<0){ x=dx; } if(x+dx>=wblock->a.x2){ RError("Error in function GFXS_BitBltType. x+dx>wblock->a.x2: %d,%d,%d\n",x,dx,wblock->a.x2); return; } if(x2+dx<0){ RError("Error in function GFXS_BitBltType. x2+dx<0: %d,%d\n",x2,dx); return; } if(x2+dx>=wblock->a.x2){ x2=wblock->a.x2-dx-1; } if(GFXS_EnsureBoundaries(window,"GFXS_BitBltType2",x,y,x2,y2)==false){ OS_GFX_CancelMixColor(window); return; } (*GFX_P_OSFunc)( window, dx,dy, x,y, x2,y2 ); }
void GFXS_BoxType( void (*GFX_OSFunc)( struct Tracker_Windows *window, int color, int x,int y,int x2,int y2, int where ), struct Tracker_Windows *window, int color, int x,int y,int x2,int y2, int where ) { int maxx=window->wblock->t.x2; if(x>=maxx) return; if(x>x2) return; if(y>y2) return; if(GFXS_EnsureBoundaries(window,"GFXS_BoxType",x,y,x2,y2)==false){ return; } (*GFX_OSFunc)(window,color,x,y,R_MIN(x2,maxx),y2,where); }
void GFXS_BorderType2( void (*GFX_P_OSFunc)( struct Tracker_Windows *window, int x, int y, int y2, int where ), struct Tracker_Windows *window, int x, int y, int y2, int where ) { int maxx=window->wblock->t.x2; if(x-1>maxx){ OS_GFX_CancelMixColor(window); return; } if(GFXS_EnsureBoundaries(window,"GFXS_BorderType",x,y,x+1,y2)==false){ OS_GFX_CancelMixColor(window); return; } (*GFX_P_OSFunc)(window,x,y,y2,where); }
void GFXS_BoxType( void (*GFX_OSFunc)( struct Tracker_Windows *window, enum ColorNums color, int x,int y,int x2,int y2, int where ), struct Tracker_Windows *window, enum ColorNums color, int x,int y,int x2,int y2, int where ) { int maxx=window->wblock->t.x2; if(x>=maxx || x>x2 || y>y2 || GFXS_EnsureBoundaries(window,"GFXS_BoxType",x,y,x2,y2)==false ) { OS_GFX_CancelMixColor(window); return; } (*GFX_OSFunc)(window,color,x,y,R_MIN(x2,maxx),y2,where); }
void GFXS_LineType( void (*GFX_OSFunc)( struct Tracker_Windows *window, enum ColorNums color, int x,int y,int x2,int y2, int where ), struct Tracker_Windows *window, enum ColorNums color, int x,int y,int x2,int y2, int where ) { int maxx=window->wblock->t.x2; if(GFXS_EnsureBoundaries(window,"GFXS_LineType",x,y,x2,y2)==false){ OS_GFX_CancelMixColor(window); return; } if(x2>maxx){ if(x>maxx){ OS_GFX_CancelMixColor(window); return; } y2=(y2-y)*(maxx-x)/(x2-x) + y; // x2-x is never 0 here. x2=maxx; } if(x>maxx){ y=(y-y2)*(maxx-x2)/(x-x2) + y2; // x2-x is never 0 here. x=maxx; } if(GFXS_EnsureBoundaries(window,"GFXS_LineType2",x,y,x2,y2)==false){ OS_GFX_CancelMixColor(window); return; } (*GFX_OSFunc)(window,color,x,y,x2,y2,where); }
void GFXS_BorderType( void (*GFX_P_OSFunc)( struct Tracker_Windows *window, int x, int y, int y2, int where ), struct Tracker_Windows *window, int x, int y, int y2, int where ) { int maxx=window->wblock->t.x2; if(x>maxx) return; if(GFXS_EnsureBoundaries(window,"GFXS_BorderType",x,y,x,y2)==false){ return; } (*GFX_P_OSFunc)(window,x,y,y2,where); }
void GFXS_TextType( void (*GFX_OSFunc)( struct Tracker_Windows *window, int color,const char *text, int x,int y, int width, int flags, int where ), struct Tracker_Windows *window, int color,const char *text, int x,int y, int width, int flags, int where ) { if(text==NULL){ RWarning("text==NULL\n"); return; } if(flags & TEXT_NOTEXT){ int len=strlen(text); int maxx=window->wblock->t.x2; int glen=len*window->fontwidth; if(x>=maxx) return; if(GFXS_EnsureBoundaries(window,"GFXS_TextType NOTEXT",x,y,x,y)==false){ return; } if(x+glen>=maxx){ len=(maxx-x-1)/window->fontwidth; } if(GFXS_EnsureBoundaries(window,"GFXS_TextType NOTEXT2",x,y,x,y)==false){ return; } (*GFX_OSFunc)(window,color,text,x,y,width,flags,where); }else{ int maxx=window->wblock->t.x2; int len=strlen(text); int glen=len*window->fontwidth; char *to; int newlen; if(x>=maxx) return; if(GFXS_EnsureBoundaries(window,"GFXS_TextType",x,y,x,y)==false){ return; } to=talloc_strdup(text); if(x+glen>=maxx){ newlen=(maxx-x-1)/window->fontwidth; to[newlen]=0; } if(GFXS_EnsureBoundaries(window,"GFXS_TextType",x,y,x,y)==false){ return; } (*GFX_OSFunc)(window,color,(const char*)to,x,y,width,flags,where); } }