rect.c
579 Bytes
#include "libfb.h"
/*---------------------------------------------------------------------
Make a box on the screen
---------------------------------------------------------------------*/
void
fbRect(int x0, int y0, int x1, int y1, u16 color)
{
u16* fb = (u16 *)osViGetNextFramebuffer();
int s = FB_SCREEN_WD;
int x, y;
#define swap(x,y) { int t = x; x = y; y = t; }
if (x0 > x1) swap(x0,x1);
if (y0 > y1) swap(y0,y1);
fb += y0*s;
for(y = y0; y <= y1; y++) {
for(x = x0; x <= x1; x++)
fb[x] = color;
fb += s;
}
}