moved swf_ClipRect from src/swfbbox.c
authorkramm <kramm>
Wed, 26 Mar 2008 13:03:27 +0000 (13:03 +0000)
committerkramm <kramm>
Wed, 26 Mar 2008 13:03:27 +0000 (13:03 +0000)
lib/rfxswf.c
lib/rfxswf.h

index 1460c35..846a82d 100644 (file)
@@ -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) {
index 792ac14..42f4f23 100644 (file)
@@ -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);