From 28b9965df85ddea21719de0b4d3654aff3b69c05 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Tue, 1 Jun 2010 14:41:11 -0700 Subject: [PATCH] enhanced logging --- lib/gfxpoly/poly.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/gfxpoly/poly.c b/lib/gfxpoly/poly.c index 16b8ca7..118629f 100644 --- a/lib/gfxpoly/poly.c +++ b/lib/gfxpoly/poly.c @@ -234,18 +234,20 @@ char gfxpoly_check(gfxpoly_t*poly, char updown) return 0; } } - dict_destroy(d1); if(updown) { DICT_ITERATE_ITEMS(d2, point_t*, p2, void*, c2) { int count = (ptroff_t)c2; + assert(dict_contains(d1, p2)); + int ocount = (ptroff_t)dict_lookup(d1, p2); if(count!=0) { - if(count>0) fprintf(stderr, "Error: Point (%.2f,%.2f) has %d more incoming than outgoing segments\n", p2->x * poly->gridsize, p2->y * poly->gridsize, count); - if(count<0) fprintf(stderr, "Error: Point (%.2f,%.2f) has %d more outgoing than incoming segments\n", p2->x * poly->gridsize, p2->y * poly->gridsize, -count); + if(count>0) fprintf(stderr, "Error: Point (%.2f,%.2f) has %d more incoming than outgoing segments (%d incoming, %d outgoing)\n", p2->x * poly->gridsize, p2->y * poly->gridsize, count, (ocount+count)/2, (ocount-count)/2); + if(count<0) fprintf(stderr, "Error: Point (%.2f,%.2f) has %d more outgoing than incoming segments (%d incoming, %d outgoing)\n", p2->x * poly->gridsize, p2->y * poly->gridsize, -count, (ocount+count)/2, (ocount-count)/2); dict_destroy(d2); return 0; } } } + dict_destroy(d1); dict_destroy(d2); return 1; } @@ -1218,20 +1220,19 @@ static void process_horizontals(status_t*status) windstate_t below = left?left->wind:status->windrule->start(status->context); windstate_t above = status->windrule->add(status->context, below, h->fs, h->dir, h->polygon_nr); edgestyle_t*fs = status->windrule->diff(&above, &below); + + segment_dir_t dir = above.is_filled?DIR_DOWN:DIR_UP; if(fs) { + //append_stroke(status, p1, p2, DIR_INVERT(h->dir), fs); + append_stroke(status, p1, p2, dir, fs); + } #ifdef DEBUG - fprintf(stderr, " ...storing\n"); -#endif - append_stroke(status, p1, p2, DIR_INVERT(h->dir), fs); - } else { -#ifdef DEBUG - fprintf(stderr, " ...ignoring (below: (wind_nr=%d, filled=%d), above: (wind_nr=%d, filled=%d) %s\n", - below.wind_nr, below.is_filled, - above.wind_nr, above.is_filled, - h->dir==DIR_UP?"up":"down" - ); + fprintf(stderr, " ...%s (below: (wind_nr=%d, filled=%d), above: (wind_nr=%d, filled=%d) %s\n", + fs?"storing":"ignoring", + below.wind_nr, below.is_filled, + above.wind_nr, above.is_filled, + dir==DIR_UP?"up":"down"); #endif - } x = next_x; } } -- 1.7.10.4