11 #define ror(x,n) ((x >> n) | (x << (8-n))) 13 #define pswap(tab,i,j) {int temp; temp = *((tab)+(i));\ 14 *((tab)+(i)) = *((tab)+(j));\ 15 *((tab)+(j)) = temp; } 20 static void sort(
int*,
int,
int);
34 int i, twonvert, *
line, stored = 0;
44 twonvert = poly->nvertices << 1;
46 line = (
int *) poly->xy;
48 if ((line[0] != line[twonvert-2]) || (line[1] != line[twonvert-1])) {
50 sto1 = line[twonvert];
51 sto2 = line[twonvert+1];
52 line[twonvert] = line[0];
53 line[twonvert+1] = line[1];
58 xip = line + twonvert;
77 memcpy(xllist,xilist,(
int)((
char *) xip - (
char *) xilist));
78 xlp = xllist + (int) (xip - xilist);
82 for (i = twonvert - 4; i >= 0; i -= 2) {
83 line = (
int *) poly->xy + i;
84 if (((line[1] > yu) && (line[3] < yu)) ||
85 ((line[3] > yu) && (line[1] < yu))) {
87 *xup++ = *xip++ = line[0] +
88 ((long)(yu-line[1])*(line[2]-line[0])) /
101 if (line[twonvert-3] < yu)
114 if (line[twonvert-3] > yl)
119 sort(xulist,0,(
int)(xup-xulist-1));
120 sort(xllist,0,(
int)(xlp-xllist-1));
129 line = (
int *) poly->xy;
130 line[twonvert-2] = sto1;
131 line[twonvert-1] = sto2;
139 int left,right, *
tab;
143 if (right <= left)
return;
144 i = (left + right) >> 1;
147 for (i = left + 1; i <= right; i++)
148 if (tab[i] < tab[left]) {
152 pswap(tab,left,last);
153 sort(tab,left,last-1);
154 sort(tab,last+1,right);
161 int *xll, *xul, num, yl, yu;
164 int dx, dy, dy2, dx1, dx2, errterm1, errterm2;
165 int i, s1, s2, lnum, lcnt, next, *st =
NULL;
167 unsigned char left, right, cbuf;
168 union {
unsigned short color2;
unsigned char c[2]; }
c;
180 rgen1 =
pc.
base + (long) lnum*next;
183 outpw(0x3ce,
c.color2 & 0xff00);
187 for (i = 0; i < num; i += 2) {
202 if (x2 >= x1) { dx1 = -dx1; s1 = -1; }
203 if (x4 >= x3) { dx2 = -dx2; s2 = 1; }
204 errterm1 = errterm2 = 0;
210 left = (0xff >> (x2 & 7));
211 right = ~(0xff >> (x3 & 7));
212 dx = (x3 >> 3) - (x2 >> 3) - 1;
213 if (dx < 0) { left &= right; dx = 0; right = 0; }
214 rgen = rgen0 + (x2 >> 3);
228 while (errterm1 > 0 && x1 != x2) {
232 while (errterm2 > 0 && x3 != x4) {
240 left = (0xff >> (x2 & 7));
241 right = ~(0xff >> (x3 & 7));
242 dx = (x3 >> 3) - (x2 >> 3) - 1;
243 if (dx < 0) { left &= right; dx = 0; right = 0; }
244 rgen = rgen0 + (x2 >> 3);
245 cbuf = st[lcnt++ & 7];
255 *rgen = cbuf & right;
260 while (errterm1 > 0 && x1 != x2) {
264 while (errterm2 > 0 && x3 != x4) {
281 int *xll, *xul, num, yl, yu;
284 int dy, dy2, dx1, dx2, errterm1, errterm2;
286 int i, s1, s2, lnum, lcnt, next, *st =
NULL;
287 unsigned char left, right, cbuf;
288 union {
unsigned short o[2];
long l; } p1, p2, p3, p4;
289 union {
unsigned short color2;
unsigned char c[2]; }
c;
305 p4.l = (long) lnum*next;
308 for (i = 0; i < num; i += 2) {
323 if (x2 >= x1) { dx1 = -dx1; s1 = -1; }
324 if (x4 >= x3) { dx2 = -dx2; s2 = 1; }
325 errterm1 = errterm2 = 0;
335 if (p1.o[1] != p2.o[1])
337 if ((cbuf & 0xf) != p1.o[1]) {
344 if ((
unsigned)rgen & 1) {
350 *(rgen + dx - 1) =
c.c[0];
353 *(
short far *)rgen =
c.color2;
365 if (p1.o[1] != p2.o[1]) {
366 outp(0x3cd,cbuf + 0x11);
371 *(rgen + dx - 1) =
c.c[0];
374 *(
short far *)rgen =
c.color2;
391 while (errterm1 > 0 && x1 != x2) {
395 while (errterm2 > 0 && x3 != x4) {
404 right = st[lcnt++ & 7];
405 left = 0x80 >> (x2 & 7);
409 if ((cbuf & 0xf) != p1.o[1]) {
425 if (p1.o[1] != p2.o[1]) {
426 outp(0x3cd,cbuf + 0x11);
443 while (errterm1 > 0 && x1 != x2) {
447 while (errterm2 > 0 && x3 != x4) {
463 int *xll, *xul, num, yl, yu;
466 int dx, dy, dy2, dx1, dx2, errterm1, errterm2;
467 int i, s1, s2, lnum, lcnt, next, *st =
NULL;
468 unsigned char left, right;
470 union {
unsigned short color2;
unsigned char c[2]; }
c;
485 p0 = (long) lnum*next;
487 for (i = 0; i < num; i += 2) {
502 if (x2 >= x1) { dx1 = -dx1; s1 = -1; }
503 if (x4 >= x3) { dx2 = -dx2; s2 = 1; }
504 errterm1 = errterm2 = 0;
514 if ((
unsigned)rgen & 1) {
520 *(rgen + dx - 1) =
c.c[0];
523 *(
short*)rgen =
c.color2;
537 while (errterm1 > 0 && x1 != x2) {
541 while (errterm2 > 0 && x3 != x4) {
550 right = st[lcnt++ & 7];
551 left = 0x80 >> (x2 & 7);
567 while (errterm1 > 0 && x1 != x2) {
571 while (errterm2 > 0 && x3 != x4) {
static void mode_2_zoids()
#define MFBMAXPOLYGONVERTICES
#define MFBPOLYGONBUFSIZE
long mfb_polybuffer[2 *MFBPOLYGONBUFSIZE]
static void mode_1_zoids()
while(TDesc->tSucc!=NULL)
void MFBPolygon(MFBPOLYGON *poly)