From 9bdd6ddccd850f8a7dd2942c0b7088b77f41af0e Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sat, 1 Oct 2016 15:27:47 +0300 Subject: [PATCH] polyfill debugging mode --- src/polyfill.c | 4 ++-- src/polytest.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/polyfill.c b/src/polyfill.c index 215cd78..3608b33 100644 --- a/src/polyfill.c +++ b/src/polyfill.c @@ -46,7 +46,7 @@ void polyfill_wire(struct pvertex *verts, int nverts) } } -#define NEXTIDX(x) ((x) ? (x) - 1 : nverts - 1) +#define NEXTIDX(x) (((x) - 1 + nverts) % nverts) #define PREVIDX(x) (((x) + 1) % nverts) #define CALC_EDGE(which) \ @@ -116,7 +116,7 @@ void polyfill_flat(struct pvertex *pv, int nverts) pixptr = (uint16_t*)fb_pixels + sline * fb_width + x; for(i=0; i