From: kramm Date: Wed, 26 Mar 2008 13:03:27 +0000 (+0000) Subject: moved swf_ClipRect from src/swfbbox.c X-Git-Tag: buttons-working~344 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=275e5c582963502291613b834c9bb99d7ec81915;ds=sidebyside moved swf_ClipRect from src/swfbbox.c --- diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 1460c35..846a82d 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -454,6 +454,20 @@ int swf_SetRect(TAG * t,SRECT * r) return 0; } +SRECT swf_ClipRect(SRECT border, SRECT r) +{ + if(r.xmax > border.xmax) r.xmax = border.xmax; + if(r.ymax > border.ymax) r.ymax = border.ymax; + if(r.xmax < border.xmin) r.xmax = border.xmin; + if(r.ymax < border.ymin) r.ymax = border.ymin; + + if(r.xmin > border.xmax) r.xmin = border.xmax; + if(r.ymin > border.ymax) r.ymin = border.ymax; + if(r.xmin < border.xmin) r.xmin = border.xmin; + if(r.ymin < border.ymin) r.ymin = border.ymin; + return r; +} + void swf_ExpandRect(SRECT*src, SPOINT add) { if((src->xmin | src->ymin | src->xmax | src->ymax)==0) { diff --git a/lib/rfxswf.h b/lib/rfxswf.h index 792ac14..42f4f23 100644 --- a/lib/rfxswf.h +++ b/lib/rfxswf.h @@ -255,6 +255,7 @@ int swf_VerifyPassword(TAG * t, const char * password); // helper functions: +SRECT swf_ClipRect(SRECT border, SRECT r); void swf_ExpandRect(SRECT*src, SPOINT add); void swf_ExpandRect2(SRECT*src, SRECT*add); void swf_ExpandRect3(SRECT*src, SPOINT center, int radius);