From dbe6ea0f365d5126d60736531b03b9a7f4feab4f Mon Sep 17 00:00:00 2001 From: kramm Date: Fri, 1 Apr 2005 07:58:39 +0000 Subject: [PATCH] * optimized moveTo * added prefix to gfxline_dump() --- lib/gfxtools.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/gfxtools.c b/lib/gfxtools.c index e075059..1e3c1aa 100644 --- a/lib/gfxtools.c +++ b/lib/gfxtools.c @@ -37,6 +37,12 @@ static void linedraw_moveTo(gfxdrawer_t*d, gfxcoord_t x, gfxcoord_t y) linedraw_internal_t*i = (linedraw_internal_t*)d->internal; gfxline_t*l = rfx_alloc(sizeof(gfxline_t)); l->type = gfx_moveTo; + if((int)((d->x * 5120) == (int)(x * 5120)) && + (int)((d->y * 5120) == (int)(y * 5120))) { + /* never mind- we're already there */ + return; + + } d->x = l->x = x; d->y = l->y = y; l->next = 0; @@ -523,15 +529,15 @@ gfxbbox_t gfxline_getbbox(gfxline_t*line) return bbox; } -void gfxline_dump(gfxline_t*line, FILE*fi) +void gfxline_dump(gfxline_t*line, FILE*fi, char*prefix) { while(line) { if(line->type == gfx_moveTo) { - fprintf(fi, "moveTo %.2f %.2f\n", line->x, line->y); + fprintf(fi, "%smoveTo %.2f %.2f\n", prefix, line->x, line->y); } else if(line->type == gfx_lineTo) { - fprintf(fi, "lineTo %.2f %.2f\n", line->x, line->y); + fprintf(fi, "%slineTo %.2f %.2f\n", prefix, line->x, line->y); } else if(line->type == gfx_splineTo) { - fprintf(fi, "splineTo (%.2f %.2f) %.2f %.2f\n", line->sx, line->sy, line->x, line->y); + fprintf(fi, "%ssplineTo (%.2f %.2f) %.2f %.2f\n", prefix, line->sx, line->sy, line->x, line->y); } line = line->next; } -- 1.7.10.4