From 275e5c582963502291613b834c9bb99d7ec81915 Mon Sep 17 00:00:00 2001 From: kramm Date: Wed, 26 Mar 2008 13:03:27 +0000 Subject: [PATCH] moved swf_ClipRect from src/swfbbox.c --- lib/rfxswf.c | 14 ++++++++++++++ lib/rfxswf.h | 1 + 2 files changed, 15 insertions(+) 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); -- 1.7.10.4