X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Farts.c;h=ca03a80aa70870b230ca067a22756f6196080481;hb=0784a8a882e7b98299fb6a90f0f9a7ebb322562b;hp=68593c60797b73a1bf272999e8c0c989a4de9b50;hpb=8b7354e28b6dc5fbd3fe48bb235bf7003c66f9fd;p=swftools.git diff --git a/lib/devices/arts.c b/lib/devices/arts.c index 68593c6..ca03a80 100644 --- a/lib/devices/arts.c +++ b/lib/devices/arts.c @@ -21,13 +21,18 @@ #include #include #include +#ifndef WIN32 #include +#endif #include +#include +#include #include "../mem.h" #include "../gfxdevice.h" #include "../gfxtools.h" #include "../art/libart.h" -#include "artsutils.c" +#include "arts.h" +#include "artsutils.h" typedef struct _clip { ArtSVP*svp; @@ -41,6 +46,7 @@ typedef struct _internal { } internal_t; static int verbose = 0; + static void dbg(char*format, ...) { if(!verbose) @@ -145,6 +151,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 +184,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 +224,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 +258,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; @@ -319,6 +342,6 @@ void gfxdevice_union_init(gfxdevice_t*dev,gfxdevice_t*out) dev->finish = arts_finish; i->out = out; - i->svpunion = gfxstrokeToSVP(0, 0, 0, 0, 0); + i->svpunion = gfxstrokeToSVP(0, 0, gfx_capButt, gfx_joinMiter, 0); }