X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Factive.c;h=aece368cbe67593b85dcca649a8a3ec9713223ac;hp=b0ef07ca08d8286c06554eb5833ac230bd6ba8f5;hb=64cbdc0d10e611af20d4d375ff6319793da8e6f5;hpb=ae7c92fe5721f97e786a8bbe9153eadbf292460d diff --git a/lib/gfxpoly/active.c b/lib/gfxpoly/active.c index b0ef07c..aece368 100644 --- a/lib/gfxpoly/active.c +++ b/lib/gfxpoly/active.c @@ -1,4 +1,3 @@ -#include #include "../q.h" #include "active.h" @@ -36,14 +35,19 @@ void actlist_verify(actlist_t*a, int32_t y) { segment_t*s = a->list; assert(!s || !s->left); - double lastx; + segment_t*l = 0; while(s) { if(y) { - double x = ((double)s->delta.x*(y-s->a.y)/s->delta.y)+s->a.x; - if(s!=a->list) { - assert(lastx<=x); + if(l) { + /* we need to re-evaluate the x of the previous segment. if we + try to store it, it might end up being converted to a double, + which will make it non-equal to (and possibly larger than) the + "long double" the FPU has in it's register. This only happens + when compiler optimizations are turned on. */ + assert((XPOS(s, y) - XPOS(l, y)) >= 0); + assert(XDIFF(s,l,y) >= 0); } - lastx = x; + l = s; } assert(!s->left || s->left->right == s); assert(!s->right || s->right->left == s);