mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 10:39:07 +02:00
observer: further classify general clips
A clip with only a single path or can be reduced to a single polygon are easier to handle than a clip containing a mixture of paths (typically ANTIALIAS_NONE vs ANTIALIAS_DEFAULT). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
76a3d0dc11
commit
d03b0057b2
4 changed files with 29 additions and 4 deletions
|
|
@ -125,3 +125,20 @@ _cairo_clip_get_polygon (const cairo_clip_t *clip,
|
|||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_clip_is_polygon (const cairo_clip_t *clip)
|
||||
{
|
||||
if (_cairo_clip_is_all_clipped (clip))
|
||||
return TRUE;
|
||||
|
||||
/* If there is no clip, we need an infinite polygon */
|
||||
if (clip == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (clip->path == NULL)
|
||||
return TRUE;
|
||||
|
||||
/* check that residual is all of the same type/tolerance */
|
||||
return can_convert_to_polygon (clip);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -204,6 +204,9 @@ _cairo_clip_copy_rectangle_list (cairo_clip_t *clip, cairo_gstate_t *gstate);
|
|||
cairo_private cairo_rectangle_list_t *
|
||||
_cairo_rectangle_list_create_in_error (cairo_status_t status);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_clip_is_polygon (const cairo_clip_t *clip);
|
||||
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_clip_get_polygon (const cairo_clip_t *clip,
|
||||
cairo_polygon_t *polygon,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ struct path {
|
|||
};
|
||||
|
||||
struct clip {
|
||||
unsigned int type[4]; /* none, region, boxes, general */
|
||||
unsigned int type[6]; /* none, region, boxes, single path, polygon, general */
|
||||
};
|
||||
|
||||
typedef struct _cairo_observation cairo_observation_t;
|
||||
|
|
|
|||
|
|
@ -197,11 +197,14 @@ add_clip (struct clip *stats,
|
|||
classify = 1;
|
||||
else if (clip->path == NULL)
|
||||
classify = 2;
|
||||
else
|
||||
else if (clip->path->prev == NULL)
|
||||
classify = 3;
|
||||
else if (_cairo_clip_is_polygon (clip))
|
||||
classify = 4;
|
||||
else
|
||||
classify = 5;
|
||||
|
||||
stats->type[classify]++;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1029,7 +1032,9 @@ print_clip (cairo_output_stream_t *stream, const struct clip *c)
|
|||
"none",
|
||||
"region",
|
||||
"boxes",
|
||||
"general path",
|
||||
"single path",
|
||||
"polygon",
|
||||
"general",
|
||||
};
|
||||
_cairo_output_stream_printf (stream, " clip:");
|
||||
print_array (stream, c->type, names, ARRAY_LENGTH (names));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue