X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=82511d4fe490defe08dafd5e538c3e9fe0b700fd;hb=2a477e3f4b12dd0f9175e705ce9568405e5b1f17;hp=1460c35d4d5f1e427f3288cc24ca939a4b22f0a7;hpb=6cfa6f2326b39d3dee66a27cb77ad5e8fab021a1;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 1460c35..82511d4 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) { @@ -1282,7 +1296,8 @@ int swf_WriteSWF2(writer_t*writer, SWF * swf) // Writes SWF to file, return #ifdef INSERT_RFX_TAG if ((swf->firstTag && swf->firstTag->id != ST_REFLEX) && - (!swf->firstTag->next || swf->firstTag->next->id != ST_REFLEX)) + (!swf->firstTag->next || (swf->firstTag->next->id != ST_REFLEX && + (!swf->firstTag->next->next || (swf->firstTag->next->next->id!=ST_REFLEX))))) { swf_SetBlock(swf_InsertTagBefore(swf, swf->firstTag,ST_REFLEX),(U8*)"rfx",3); }