X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Fpoly.c;h=23039445a5f6b01d14cbe7eff554fa25a4d961ac;hp=8b7226999ca350fe579d8bc11691370225bd5622;hb=e5ec9f136f070b7e824e223c0b67e28efd8c70f0;hpb=163bdd5cab1758e4517e8365b3e40b5461d63640 diff --git a/lib/gfxpoly/poly.c b/lib/gfxpoly/poly.c index 8b72269..2303944 100644 --- a/lib/gfxpoly/poly.c +++ b/lib/gfxpoly/poly.c @@ -138,8 +138,12 @@ void segment_init(segment_t*s, int x1, int y1, int x2, int y2) int y = y1;y1=y2;y2=y; s->dir = DIR_UP; } else { - s->dir = DIR_HORIZONTAL; + /* up/down for horizontal segments is handled by "rotating" + them 90° anticlockwise in screen coordinates (tilt your head to + the right) */ + s->dir = DIR_UP; if(x1>x2) { + s->dir = DIR_DOWN; int x = x1;x1=x2;x2=x; int y = y1;y1=y2;y2=y; } @@ -153,7 +157,6 @@ void segment_init(segment_t*s, int x1, int y1, int x2, int y2) s->delta.x = x2-x1; s->delta.y = y2-y1; s->pos = s->a; - s->tmp = -1; s->new_point.y = y1-1; #define XDEBUG #ifdef XDEBUG @@ -208,7 +211,7 @@ void gfxpoly_enqueue(edge_t*list, heap_t*queue) s->dir==DIR_UP?"up":"down"); #endif event_t e = event_new(); - e.type = s->dir==DIR_HORIZONTAL?EVENT_HORIZONTAL:EVENT_START; + e.type = s->delta.y ? EVENT_START : EVENT_HORIZONTAL; e.p = s->a; e.s1 = s; e.s2 = 0;