X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fgfxpoly.c;h=a408618c62eeb52e8fcdb47fb0aa31717716f073;hb=d46619a310dd04066cc117e904b84785d1a0cd51;hp=65a65b75346bf7c4c8daa6cd8b39476e5cf38274;hpb=7fe3742eaa6e7613f354d250be042a0cd80b8d4c;p=swftools.git diff --git a/lib/gfxpoly.c b/lib/gfxpoly.c index 65a65b7..a408618 100644 --- a/lib/gfxpoly.c +++ b/lib/gfxpoly.c @@ -384,11 +384,13 @@ static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line, char fill) pos = 0; l2 = line; + int lastmove=-1; while(l2) { if(l2->type == gfx_moveTo) { vec[pos].code = ART_MOVETO_OPEN; vec[pos].x = l2->x; vec[pos].y = l2->y; + lastmove=pos; pos++; assert(pos<=len); } else if(l2->type == gfx_lineTo) { @@ -413,6 +415,16 @@ static ArtVpath* gfxline_to_ArtVpath(gfxline_t*line, char fill) } x = l2->x; y = l2->y; + + /* let closed line segments start w/ MOVETO instead of MOVETO_OPEN */ + if(lastmove>=0 && l2->type!=gfx_moveTo && (!l2->next || l2->next->type == gfx_moveTo)) { + if(vec[lastmove].x == l2->x && + vec[lastmove].y == l2->y) { + assert(vec[lastmove].code == ART_MOVETO_OPEN); + vec[lastmove].code = ART_MOVETO; + } + } + l2 = l2->next; } vec[pos++].code = ART_END;