+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include "polyfill.h"
-#include "gfxutil.h"
-#include "demo.h"
-
-void (*fillfunc[])(struct pvertex*, int) = {
- polyfill_wire,
- 0, 0, 0, 0
-};
-
-void polyfill(int mode, struct pvertex *verts, int nverts)
-{
-#ifndef NDEBUG
- if(!fillfunc[mode]) {
- fprintf(stderr, "polyfill mode %d not implemented\n", mode);
- abort();
- }
-#endif
-
- fillfunc[mode](verts, nverts);
-}
-
-void polyfill_wire(struct pvertex *verts, int nverts)
-{
- int i;
- struct pvertex *v = verts;
- unsigned short color = ((v->r << 8) & 0xf800) |
- ((v->g << 3) & 0x7e0) | ((v->b >> 3) & 0x1f);
-
- for(i=0; i<nverts; i++) {
- int x0, y0, x1, y1;
- x0 = v->x >> 8;
- y0 = v->y >> 8;
- ++v;
- x1 = v->x >> 8;
- y1 = v->y >> 8;
- clip_line(&x0, &y0, &x1, &y1, 0, 0, fb_width, fb_height);
- draw_line(x0, y0, x1, y1, color);
- }
-}