X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfxpoly%2Fxrow.c;h=48fe7ad40eb8bd3133969803745d0a3d4e113065;hp=123e00c77e61eb2e812ccfa2db90a46ff760f054;hb=f5626be739a1e1b61f89d7a389be3c4b5d4d9128;hpb=0185c09ff339aaf744142f96d22e1b145334539d diff --git a/lib/gfxpoly/xrow.c b/lib/gfxpoly/xrow.c index 123e00c..48fe7ad 100644 --- a/lib/gfxpoly/xrow.c +++ b/lib/gfxpoly/xrow.c @@ -1,3 +1,5 @@ +#include +#include #include "../mem.h" #include "xrow.h" @@ -11,6 +13,9 @@ xrow_t* xrow_new() void xrow_add(xrow_t*r, int32_t x) { + if(r->num && r->lastx==x) + return; + r->lastx = x; if(r->num >= r->size) { r->size *= 2; r->x = rfx_realloc(r->x, sizeof(r->x[0])*r->size); @@ -22,7 +27,7 @@ int compare_int32(const void*_i1,const void*_i2) { int32_t*i1 = (int32_t*)_i1; int32_t*i2 = (int32_t*)_i2; - return i1-i2; + return *i1-*i2; } void xrow_sort(xrow_t*r) @@ -46,6 +51,18 @@ void xrow_reset(xrow_t*r) r->num = 0; } +void xrow_dump(xrow_t*xrow) +{ + fprintf(stderr, "x: "); + int t; + for(t=0;tnum;t++) { + if(t) + fprintf(stderr, ", "); + fprintf(stderr, "%d", xrow->x[t]); + } + fprintf(stderr, "\n"); +} + void xrow_destroy(xrow_t*r) { if(r->x) {