INLINE polygon_info *allocate_polygon(poly_manager *poly, int miny, int maxy) { /* wait for a work item if we have to */ if (poly->polygon_next + 1 > poly->polygon_count) { poly_wait(poly, "Out of polygons"); #if KEEP_STATISTICS poly->polygon_waits++; #endif } else if (poly->unit_next + (maxy - miny) / SCANLINES_PER_BUCKET + 2 > poly->unit_count) { poly_wait(poly, "Out of work units"); #if KEEP_STATISTICS poly->unit_waits++; #endif } #if KEEP_STATISTICS poly->polygon_max = MAX(poly->polygon_max, poly->polygon_next + 1); #endif return poly->polygon[poly->polygon_next++]; }
void *poly_get_extra_data(poly_manager *poly) { /* wait for a work item if we have to */ if (poly->extra_next + 1 > poly->extra_count) { poly_wait(poly, "Out of extra data"); #if KEEP_STATISTICS poly->extra_waits++; #endif } /* return a pointer to the extra data for the next item */ #if KEEP_STATISTICS poly->extra_max = MAX(poly->extra_max, poly->extra_next + 1); #endif return poly->extra[poly->extra_next++]; }
static void poly_state_presave(poly_manager *poly) { poly_wait(poly, "pre-save"); }
static STATE_PRESAVE( poly_state_presave ) { poly_manager *poly = (poly_manager *)param; poly_wait(poly, "pre-save"); }