13 0, 1, 2, 3, 4, 5, 6, 7,
14 8, 9, 10, 11, 12, 13, 14, 15,
15 16, 17, 18, 19, 20, 21, 22, 23,
16 24, 25, 26, 27, 28, 29, 30, 31,
17 32, 33, 34, 35, 36, 37, 38, 39,
18 40, 41, 42, 43, 44, 45, 46, 47,
19 48, 49, 50, 51, 52, 53, 54, 55,
20 56, 57, 58, 59, 60, 61, 62, 63,
21 64, 65, 66, 67, 68, 69, 70, 71,
22 72, 73, 74, 75, 76, 77, 78, 79,
23 80, 81, 82, 83, 84, 85, 86, 87,
24 88, 89, 90, 91, 92, 93, 94, 95,
25 96, 97, 98, 99, 100, 101, 102, 103,
26 104, 105, 106, 107, 108, 109, 110, 111,
27 112, 113, 114, 115, 116, 117, 118, 119,
28 120, 121, 122, 123, 124, 125, 126, 127,
29 128, 129, 130, 131, 132, 133, 134, 135,
30 136, 137, 138, 139, 140, 141, 142, 143,
31 144, 145, 146, 147, 148, 149, 150, 151,
32 152, 153, 154, 155, 156, 157, 158, 159,
33 160, 161, 162, 163, 164, 165, 166, 167,
34 168, 169, 170, 171, 172, 173, 174, 175,
35 176, 177, 178, 179, 180, 181, 182, 183,
36 184, 185, 186, 187, 188, 189, 190, 191,
37 192, 193, 194, 195, 196, 197, 198, 199,
38 200, 201, 202, 203, 204, 205, 206, 207,
39 208, 209, 210, 211, 212, 213, 214, 215,
40 216, 217, 218, 219, 220, 221, 222, 223,
41 224, 225, 226, 227, 228, 229, 230, 231,
42 232, 233, 234, 235, 236, 237, 238, 239,
43 240, 241, 242, 243, 244, 245, 246, 247,
44 248, 249, 250, 251, 252, 253, 254, 255
47 255, 255, 255, 255, 255, 255, 255, 254, 254, 253, 252, 251,
48 250, 250, 248, 247, 246, 245, 243, 242, 241, 239, 237, 236,
49 234, 232, 230, 228, 226, 224, 221, 219, 217, 215, 212, 210,
50 207, 204, 202, 198, 196, 193, 190, 187, 184, 181, 178, 175,
51 171, 168, 165, 161, 158, 154, 150, 147, 143, 139, 136, 131,
52 128, 124, 120, 116, 112, 108, 104, 100, 96, 92, 88, 83,
53 79, 74, 71, 66, 62, 58, 53, 49, 45, 40, 36, 31,
54 27, 22, 18, 13, 9, 4, 0, 4, 9, 13, 18, 22,
55 27, 31, 36, 40, 45, 49, 53, 58, 62, 66, 71, 75,
56 79, 83, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,
57 128, 131, 136, 139, 143, 147, 150, 154, 158, 161, 165, 168,
58 171, 175, 178, 181, 184, 187, 190, 193, 196, 198, 202, 204,
59 207, 210, 212, 215, 217, 219, 221, 224, 226, 228, 230, 232,
60 234, 236, 237, 239, 241, 242, 243, 245, 246, 247, 248, 250,
61 250, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255,
62 255, 255, 255, 255, 255, 255, 255, 254, 254, 253, 252, 251,
63 250, 250, 248, 247, 246, 245, 243, 242, 241, 239, 237, 236,
64 234, 232, 230, 228, 226, 224, 221, 219, 217, 215, 212, 210,
65 207, 204, 202, 198, 196, 193, 190, 187, 184, 181, 178, 175,
66 171, 168, 165, 161, 158, 154, 150, 147, 143, 139, 136, 131,
67 128, 124, 120, 116, 112, 108, 104, 100, 96, 92, 88, 83,
68 79, 74, 71, 66, 62, 58, 53, 49, 45, 40, 36, 31,
69 27, 22, 18, 13, 9, 4, 0, 4, 9, 13, 18, 22,
70 27, 31, 36, 40, 45, 49, 53, 58, 62, 66, 71, 75,
71 79, 83, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124,
72 128, 131, 136, 139, 143, 147, 150, 154, 158, 161, 165, 168,
73 171, 175, 178, 181, 184, 187, 190, 193, 196, 198, 202, 204,
74 207, 210, 212, 215, 217, 219, 221, 224, 226, 228, 230, 232,
75 234, 236, 237, 239, 241, 242, 243, 245, 246, 247, 248, 250,
76 250, 251, 252, 253, 254, 254, 255, 255, 255, 255, 255, 255
79 0, 4, 9, 13, 18, 22, 27, 31, 36, 40, 45, 49,
80 53, 58, 62, 66, 71, 75, 79, 83, 88, 92, 96, 100,
81 104, 108, 112, 116, 120, 124, 128, 131, 136, 139, 143, 147,
82 150, 154, 158, 161, 165, 168, 171, 175, 178, 181, 184, 187,
83 190, 193, 196, 198, 202, 204, 207, 210, 212, 215, 217, 219,
84 221, 224, 226, 228, 230, 232, 234, 236, 237, 239, 241, 242,
85 243, 245, 246, 247, 248, 250, 250, 251, 252, 253, 254, 254,
86 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
87 255, 254, 254, 253, 252, 251, 250, 250, 248, 247, 246, 245,
88 243, 242, 241, 239, 237, 236, 234, 232, 230, 228, 226, 224,
89 221, 219, 217, 215, 212, 210, 207, 204, 202, 198, 196, 193,
90 190, 187, 184, 181, 178, 175, 171, 168, 165, 161, 158, 154,
91 150, 147, 143, 139, 136, 131, 128, 124, 120, 116, 112, 108,
92 104, 100, 96, 92, 88, 83, 79, 74, 71, 66, 62, 58,
93 53, 49, 45, 40, 36, 31, 27, 22, 18, 13, 9, 4,
94 0, 4, 9, 13, 18, 22, 27, 31, 36, 40, 45, 49,
95 53, 58, 62, 66, 71, 75, 79, 83, 88, 92, 96, 100,
96 104, 108, 112, 116, 120, 124, 128, 131, 136, 139, 143, 147,
97 150, 154, 158, 161, 165, 168, 171, 175, 178, 181, 184, 187,
98 190, 193, 196, 198, 202, 204, 207, 210, 212, 215, 217, 219,
99 221, 224, 226, 228, 230, 232, 234, 236, 237, 239, 241, 242,
100 243, 245, 246, 247, 248, 250, 250, 251, 252, 253, 254, 254,
101 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
102 255, 254, 254, 253, 252, 251, 250, 250, 248, 247, 246, 245,
103 243, 242, 241, 239, 237, 236, 234, 232, 230, 228, 226, 224,
104 221, 219, 217, 215, 212, 210, 207, 204, 202, 198, 196, 193,
105 190, 187, 184, 181, 178, 175, 171, 168, 165, 161, 158, 154,
106 150, 147, 143, 139, 136, 131, 128, 124, 120, 116, 112, 108,
107 104, 100, 96, 92, 88, 83, 79, 74, 71, 66, 62, 58,
108 53, 49, 45, 40, 36, 31, 27, 22, 18, 13, 9, 4
1114 for (i = 0; i < count; i++) {
1115 j = (i + 1) % count;
1117 if (points[i].y >= y) {
1118 polyA[countA].
x = points[i].
x;
1119 polyA[countA].
y = points[i].
y;
1121 if (points[j].y <= y)
1123 }
else if (points[j].y >= y)
1126 distance = (float)(y - points[i].y);
1127 denominator = (float)(points[j].y - points[i].y);
1128 frac = distance / denominator;
1129 distance = (float)points[i].x;
1130 denominator = (float)(points[j].x - points[i].x);
1131 x = denominator * frac + distance + 0.5f;
1132 polyA[countA].
x = x;
1133 polyA[countA].
y = y;
1141 x = viewport->
right;
1142 for (i = 0; i < countA; i++) {
1143 j = (i + 1) % countA;
1145 if (polyA[i].x <= x) {
1146 polyB[countB].
x = polyA[i].
x;
1147 polyB[countB].
y = polyA[i].
y;
1149 if (polyA[j].x >= x)
1151 }
else if (polyA[j].x <= x)
1154 distance = (float)(x - polyA[i].x);
1155 denominator = (float)(polyA[j].x - polyA[i].x);
1156 frac = distance / denominator;
1157 distance = (float)polyA[i].y;
1158 denominator = (float)(polyA[j].y - polyA[i].y);
1159 y = denominator * frac + distance + 0.5f;
1160 polyB[countB].
x = x;
1161 polyB[countB].
y = y;
1170 for (i = 0; i < countB; i++) {
1171 j = (i + 1) % countB;
1173 if (polyB[i].y <= y) {
1174 polyA[countA].
x = polyB[i].
x;
1175 polyA[countA].
y = polyB[i].
y;
1177 if (polyB[j].y >= y)
1179 }
else if (polyB[j].y <= y)
1182 distance = (float)(y - polyB[i].y);
1183 denominator = (float)(polyB[j].y - polyB[i].y);
1184 frac = distance / denominator;
1185 distance = (float)polyB[i].x;
1186 denominator = (float)(polyB[j].x - polyB[i].x);
1187 x = denominator * frac + distance + 0.5f;
1188 polyA[countA].
x = x;
1189 polyA[countA].
y = y;
1198 for (i = 0; i < countA; i++) {
1199 j = (i + 1) % countA;
1201 if (polyA[i].x >= x) {
1202 polyB[countB].
x = polyA[i].
x;
1203 polyB[countB].
y = polyA[i].
y;
1205 if (polyA[j].x <= x)
1207 }
else if (polyA[j].x >= x)
1210 distance = (float)(x - polyA[i].x);
1211 denominator = (float)(polyA[j].x - polyA[i].x);
1212 frac = distance / denominator;
1213 distance = (float)polyA[i].y;
1214 denominator = (float)(polyA[j].y - polyA[i].y);
1215 y = denominator * frac + distance + 0.5f;
1216 polyB[countB].
x = x;
1217 polyB[countB].
y = y;
1224 bottomIndex = topIndex = 0;
1227 if (polyB[topIndex].y == polyB[y].y) {
1228 if (polyB[topIndex].x > polyB[y].x)
1230 }
else if (polyB[topIndex].y > polyB[y].y)
1232 else if (polyB[bottomIndex].y < polyB[y].y)
1236 i = prev = topIndex;
1239 for (k = 0; k < countB; k++) {
1248 if (crossed == 0 && y1 < y0) {
1261 for (y = y0; y <= y1; y++)
1263 }
else if (y1 == y0) {
1280 fractionStep = 1.0f / ((y1 - y0) + 1.0f);
1283 for (y = y0; y <= y1; y++) {
1285 (x1 - x0) * frac + x0;
1286 frac += fractionStep;
1292 i = polyB[topIndex].
y * 2;
1294 for (y = polyB[topIndex].y; y < polyB[bottomIndex].
y; y++) {
1304 row += (polyB[topIndex].
y - viewport->
top) * stride;
1307 for (y = polyB[topIndex].y; y <= polyB[bottomIndex].
y; y++) {
1308 memset(row + (rowBounds[0] - x), colour, abs(rowBounds[1] - rowBounds[0]) + 1);