X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Factive.c;h=c5f9c02f6d736e86fdfa611d67387843652a2f6f;hp=2904e08018932ce7ddcde140d89fcc4ed4315c7e;hb=a9634f803811f39e67114955c3e9c30ae247a669;hpb=580c48fef10df9184cf2728338e89f7db0fef2f5 diff --git a/lib/gfxpoly/active.c b/lib/gfxpoly/active.c index 2904e08..c5f9c02 100644 --- a/lib/gfxpoly/active.c +++ b/lib/gfxpoly/active.c @@ -1,7 +1,9 @@ #include #include #include +#include "../../config.h" #include "../q.h" +#include "../types.h" #include "active.h" actlist_t* actlist_new() @@ -14,7 +16,7 @@ void actlist_destroy(actlist_t*a) free(a); } -void actlist_dump(actlist_t*a, int32_t y) +void actlist_dump(actlist_t*a, int32_t y, double gridsize) { segment_t*s = a->list; double lastx; @@ -25,14 +27,14 @@ void actlist_dump(actlist_t*a, int32_t y) double x = ((double)s->delta.x*(y-s->a.y)/s->delta.y)+s->a.x; if(s!=a->list) { if(lastx>x) - fprintf(stderr, "?%f<->%f? ", lastx, x); + fprintf(stderr, "?%.2f<->%.2f? ", lastx * gridsize, x * gridsize); } lastx = x; } - fprintf(stderr, "[%d]", s->nr); + fprintf(stderr, "[%d]", (int)s->nr); s = s->right; if(s) fprintf(stderr, " "); - else fprintf(stderr, " y=%d\n", y); + else fprintf(stderr, " y=%.2f\n", y * gridsize); } } void actlist_verify(actlist_t*a, int32_t y) @@ -95,10 +97,10 @@ segment_t* actlist_find(actlist_t*a, point_t p1, point_t p2) //double d = cmp(t, p1, p2); double d = single_cmp(t, p1); if(d>=0 && to_the_left) { - actlist_dump(a, p1.y); + actlist_dump(a, p1.y, 1); segment_t*s = a->list; while(s) { - fprintf(stderr, "[%d] %f/%f (%d,%d) -> (%d,%d)\n", s->nr, + fprintf(stderr, "[%d] %f/%f (%d,%d) -> (%d,%d)\n", SEGNR(s), single_cmp(s,p1), cmp(s,p1,p2), s->a.x, s->a.y, s->b.x, s->b.y); s = s->right; @@ -503,7 +505,11 @@ void actlist_delete(actlist_t*a, segment_t*s) } else if(!a->root->rightchild) { a->root = a->root->leftchild; } else { +#ifdef HAVE_LRAND48 if(lrand48()&1) { +#else + if(((ptroff_t)s)&16) { +#endif // free up root->left->right segment_t*t = a->root->leftchild; while(t->rightchild) {