X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fpolyfill.c;h=911b1d7922264d725174178a7be9735585d58291;hb=09ff9fd9a87d495d8c2d55203af89d0f651b5d3a;hp=5b7098726ecf64b837f9959850f4d3f5d19bd1a4;hpb=ff8e2d7dab918d2e303f941fad00dee6bb80544e;p=gbajam22 diff --git a/src/polyfill.c b/src/polyfill.c index 5b70987..911b1d7 100644 --- a/src/polyfill.c +++ b/src/polyfill.c @@ -21,9 +21,9 @@ along with this program. If not, see . static unsigned char *fb; static int fbwidth, fbheight; -static short scantab[2][160] __attribute__((section(".iwram"))); +static short scantab[2][160]; -void polyfill_framebuffer(unsigned char *ptr, int w, int h) +void polyfill_framebuffer(void *ptr, int w, int h) { fb = ptr; fbwidth = w; @@ -34,6 +34,7 @@ void polyfill_framebuffer(unsigned char *ptr, int w, int h) #define VPREV(p) ((p) == varr ? vlast : (p) - 1) #define VSUCC(p, side) ((side) == 0 ? VNEXT(p) : VPREV(p)) +ARM_IWRAM void polyfill_flat(struct pvertex *varr, int vnum, unsigned char col) { int i, line, top, bot; @@ -87,6 +88,9 @@ void polyfill_flat(struct pvertex *varr, int vnum, unsigned char col) } } + if(top < 0) top = 0; + if(bot >= fbheight) bot = fbheight - 1; + fbptr = fb + top * fbwidth; for(i=top; i<=bot; i++) { start = scantab[0][i];