fixed compiler warning
[swftools.git] / lib / devices / arts.c
index 68593c6..34f38ce 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);
@@ -203,6 +218,8 @@ void arts_addfont(struct _gfxdevice*dev, gfxfont_t*font)
 void arts_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_t*color, gfxmatrix_t*matrix)
 {
     dbg("arts_drawchar");
+    if(!font)
+       return;
     internal_t*i = (internal_t*)dev->internal;
     gfxline_t*glyph = gfxline_clone(font->glyphs[glyphnr].line);
     gfxline_transform(glyph, matrix);
@@ -235,7 +252,7 @@ void arts_drawchar(struct _gfxdevice*dev, gfxfont_t*font, int glyphnr, gfxcolor_
     gfxline_free(glyph);
 }
 
-void arts_drawlink(struct _gfxdevice*dev, gfxline_t*line, char*action)
+void arts_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action)
 {
     dbg("arts_drawlink");
     internal_t*i = (internal_t*)dev->internal;