moved clockwise checker to gfxfillToSVP()
[swftools.git] / lib / devices / arts.c
index 68593c6..78986ec 100644 (file)
@@ -145,6 +145,20 @@ void arts_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
     internal_t*i = (internal_t*)dev->internal;
     ArtSVP* svp = gfxfillToSVP(line, 1);
     
+    if (svp->n_segs > 500)
+    {
+       int lineParts = 0;
+       gfxline_t* lineCursor = line;
+       while(lineCursor != NULL)
+       {
+           if(lineCursor->type != gfx_moveTo) ++lineParts;
+           lineCursor = lineCursor->next;
+       }
+       fprintf(stderr, "arts_fill abandonning shape with %d segments (%d line parts)\n", svp->n_segs, lineParts);
+       art_svp_free(svp);
+       return;
+    }
+
     svp = art_svp_rewind_uncrossed(art_svp_uncross(svp),ART_WIND_RULE_ODDEVEN); /*FIXME*/
 
     if(i->clip) {
@@ -164,6 +178,7 @@ void arts_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxm
     dbg("arts_fillbitmap");
     internal_t*i = (internal_t*)dev->internal;
     ArtSVP* svp = gfxfillToSVP(line, 1);
+
     if(i->clip) {
        ArtSVP*old = svp;
        svp = art_svp_intersect(svp, i->clip->svp);