Lines Matching defs:polygon

172 /* A collection of sorted and vertically clipped edges of the polygon.
173 * Edges are moved from the polygon to an active list while scan
175 struct polygon {
180 * into bucket EDGE_BUCKET_INDEX(edge->ytop, polygon->ymin) when
181 * it is added to the polygon. */
190 /* A cell records the effect on pixel coverage of polygon edges
194 * Consider the effects of a polygon edge on the coverage of a pixel
226 * The heights and areas are signed, with left edges of the polygon
261 struct polygon polygon[1];
425 polygon_fini(struct polygon *polygon)
427 if (polygon->y_buckets != polygon->y_buckets_embedded)
428 free(polygon->y_buckets);
430 if (polygon->edges != polygon->edges_embedded)
431 free(polygon->edges);
435 polygon_init(struct polygon *polygon, int num_edges, int ymin, int ymax)
442 polygon->edges = polygon->edges_embedded;
443 polygon->y_buckets = polygon->y_buckets_embedded;
445 polygon->num_edges = 0;
446 if (num_edges > (int)ARRAY_SIZE(polygon->edges_embedded)) {
447 polygon->edges = malloc(sizeof(struct edge)*num_edges);
448 if (unlikely(NULL == polygon->edges))
452 if (num_buckets >= ARRAY_SIZE(polygon->y_buckets_embedded)) {
453 polygon->y_buckets = malloc((1+num_buckets)*sizeof(struct edge *));
454 if (unlikely(NULL == polygon->y_buckets))
457 memset(polygon->y_buckets, 0, num_buckets * sizeof(struct edge *));
458 polygon->y_buckets[num_buckets] = (void *)-1;
460 polygon->ymin = ymin;
461 polygon->ymax = ymax;
465 polygon_fini(polygon);
470 _polygon_insert_edge_into_its_y_bucket(struct polygon *polygon, struct edge *e)
472 unsigned ix = EDGE_Y_BUCKET_INDEX(e->ytop, polygon->ymin);
473 struct edge **ptail = &polygon->y_buckets[ix];
474 assert(e->ytop < polygon->ymax);
508 polygon_add_edge(struct polygon *polygon,
513 struct edge *e = &polygon->edges[polygon->num_edges];
514 const int ymin = polygon->ymin;
515 const int ymax = polygon->ymax;
602 _polygon_insert_edge_into_its_y_bucket(polygon, e);
603 polygon->num_edges++;
607 polygon_add_line(struct polygon *polygon,
612 struct edge *e = &polygon->edges[polygon->num_edges];
633 if (ytop < polygon->ymin)
634 ytop = polygon->ymin;
637 if (ybot > polygon->ymax)
638 ybot = polygon->ymax;
702 if (polygon->num_edges > 0) {
703 struct edge *prev = &polygon->edges[polygon->num_edges-1];
714 polygon->ymin);
715 polygon->y_buckets[ix] = prev->next;
716 polygon->num_edges--;
721 _polygon_insert_edge_into_its_y_bucket(polygon, e);
722 polygon->num_edges++;
995 polygon_fini(converter->polygon);
1014 if (!polygon_init(converter->polygon, num_edges,
1026 polygon_add_edge(tor->polygon, t, &t->left, 1, dx, dy);
1027 polygon_add_edge(tor->polygon, t, &t->right, -1, dx, dy);
1183 struct polygon *polygon = converter->polygon;
1199 if (polygon->y_buckets[i] == NULL) {
1201 for (; polygon->y_buckets[j] == NULL; j++)
1224 polygon->y_buckets[i] != NULL));
1228 while (polygon->y_buckets[j] == NULL &&
1242 fill_buckets(active, polygon->y_buckets[i], (i+converter->extents.y1)*SAMPLES_Y, buckets);
1511 struct polygon *polygon = converter->polygon;
1533 if (!polygon->y_buckets[i]) {
1535 for (; !polygon->y_buckets[j]; j++)
1550 polygon->y_buckets[i] != NULL));
1557 while (polygon->y_buckets[j] == NULL &&
1572 fill_buckets(active, polygon->y_buckets[i], (i+converter->extents.y1)*SAMPLES_Y, buckets);
3323 polygon_add_line(tor.polygon,
3328 polygon_add_line(tor.polygon,
3335 polygon_add_line(tor.polygon,
3342 polygon_add_line(tor.polygon,
3345 assert(tor.polygon->num_edges <= 2*thread->count);
3466 polygon_add_line(tor.polygon,
3471 polygon_add_line(tor.polygon,
3478 polygon_add_line(tor.polygon,
3485 polygon_add_line(tor.polygon,
3488 assert(tor.polygon->num_edges <= 2*count);
3606 polygon_add_line(tor.polygon, &p1, &p2, dx, dy);
3612 polygon_add_line(tor.polygon, &p1, &p2, dx, dy);