third_party/cairo/src/cairo-tor22-scan-converter.c
static glitter_status_t
polygon_reset (struct polygon *polygon,
	       grid_scaled_y_t ymin,
	       grid_scaled_y_t ymax)
{
    unsigned h = ymax - ymin;
    unsigned num_buckets = EDGE_Y_BUCKET_INDEX(ymax + GRID_Y-1, ymin);

    pool_reset(polygon->edge_pool.base);

    if (unlikely (h > 0x7FFFFFFFU - GRID_Y))
	goto bail_no_mem; /* even if you could, you wouldn't want to. */

    if (polygon->y_buckets != polygon->y_buckets_embedded)
	free (polygon->y_buckets);

    polygon->y_buckets =  polygon->y_buckets_embedded;
    if (num_buckets > ARRAY_LENGTH (polygon->y_buckets_embedded)) {
	polygon->y_buckets = _cairo_malloc_ab (num_buckets,
					       sizeof (struct edge *));
	if (unlikely (NULL == polygon->y_buckets))
	    goto bail_no_mem;
    }
    memset (polygon->y_buckets, 0, num_buckets * sizeof (struct edge *));

    polygon->ymin = ymin;
    polygon->ymax = ymax;
    return GLITTER_STATUS_SUCCESS;

bail_no_mem:
    polygon->ymin = 0;
    polygon->ymax = 0;
    return GLITTER_STATUS_NO_MEMORY;
}
/* Empties the polygon of all edges. The polygon is then prepared to
 * receive new edges and clip them to the vertical range
 * [ymin,ymax). */
Empties the polygon of all edges. The polygon is then prepared to
receive new edges and clip them to the vertical range
[ymin,ymax).
Empties the polygon of all edges . The polygon is then prepared to receive new edges and clip them to the vertical range [ ymin ymax ) .
static glitter_status_t
polygon_reset (struct polygon *polygon,
	       grid_scaled_y_t ymin,
	       grid_scaled_y_t ymax)
{
    unsigned h = ymax - ymin;
    unsigned num_buckets = EDGE_Y_BUCKET_INDEX(ymax + GRID_Y-1, ymin);
    pool_reset(polygon->edge_pool.base);
    if (unlikely (h > 0x7FFFFFFFU - GRID_Y))
	goto bail_no_mem; 
    if (polygon->y_buckets != polygon->y_buckets_embedded)
	free (polygon->y_buckets);
    polygon->y_buckets =  polygon->y_buckets_embedded;
    if (num_buckets > ARRAY_LENGTH (polygon->y_buckets_embedded)) {
	polygon->y_buckets = _cairo_malloc_ab (num_buckets,
					       sizeof (struct edge *));
	if (unlikely (NULL == polygon->y_buckets))
	    goto bail_no_mem;
    }
    memset (polygon->y_buckets, 0, num_buckets * sizeof (struct edge *));
    polygon->ymin = ymin;
    polygon->ymax = ymax;
    return GLITTER_STATUS_SUCCESS;
bail_no_mem:
    polygon->ymin = 0;
    polygon->ymax = 0;
    return GLITTER_STATUS_NO_MEMORY;
}
static glitter_status_t polygon_reset ( struct polygon * polygon , grid_scaled_y_t ymin , grid_scaled_y_t ymax ) { unsigned h = ymax - ymin ; unsigned num_buckets = EDGE_Y_BUCKET_INDEX ( ymax + GRID_Y - 1 , ymin ) ; pool_reset ( polygon -> edge_pool . base ) ; if ( unlikely ( h > 0x7FFFFFFFU - GRID_Y ) ) goto bail_no_mem ; if ( polygon -> y_buckets != polygon -> y_buckets_embedded ) free ( polygon -> y_buckets ) ; polygon -> y_buckets = polygon -> y_buckets_embedded ; if ( num_buckets > ARRAY_LENGTH ( polygon -> y_buckets_embedded ) ) { polygon -> y_buckets = _cairo_malloc_ab ( num_buckets , sizeof ( struct edge * ) ) ; if ( unlikely ( NULL == polygon -> y_buckets ) ) goto bail_no_mem ; } memset ( polygon -> y_buckets , 0 , num_buckets * sizeof ( struct edge * ) ) ; polygon -> ymin = ymin ; polygon -> ymax = ymax ; return GLITTER_STATUS_SUCCESS ; bail_no_mem : polygon -> ymin = 0 ; polygon -> ymax = 0 ; return GLITTER_STATUS_NO_MEMORY ; }
Empties the polygon of all edges.
Empties the polygon of all edges .
/* even if you could, you wouldn't want to. */