mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 09:28:03 +02:00
path: Rename fill optimization flags
Rename fill optimization flags making fill_ their common prefix.
This commit is contained in:
parent
e48cb95493
commit
e8e614db92
3 changed files with 41 additions and 29 deletions
|
|
@ -77,6 +77,13 @@ typedef struct _cairo_path_buf_fixed {
|
|||
cairo_point_t points[2 * CAIRO_PATH_BUF_SIZE];
|
||||
} cairo_path_buf_fixed_t;
|
||||
|
||||
/*
|
||||
NOTES:
|
||||
has_curve_to => !stroke_is_rectilinear
|
||||
fill_is_rectilinear => stroke_is_rectilinear
|
||||
fill_is_empty => fill_is_rectilinear
|
||||
fill_maybe_region => fill_is_rectilinear
|
||||
*/
|
||||
struct _cairo_path_fixed {
|
||||
cairo_point_t last_move_point;
|
||||
cairo_point_t current_point;
|
||||
|
|
@ -86,8 +93,8 @@ struct _cairo_path_fixed {
|
|||
unsigned int has_curve_to : 1;
|
||||
unsigned int stroke_is_rectilinear : 1;
|
||||
unsigned int fill_is_rectilinear : 1;
|
||||
unsigned int maybe_fill_region : 1;
|
||||
unsigned int is_empty_fill : 1;
|
||||
unsigned int fill_maybe_region : 1;
|
||||
unsigned int fill_is_empty : 1;
|
||||
|
||||
cairo_box_t extents;
|
||||
|
||||
|
|
@ -137,7 +144,7 @@ _cairo_path_fixed_iter_at_end (const cairo_path_fixed_iter_t *iter);
|
|||
static inline cairo_bool_t
|
||||
_cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path)
|
||||
{
|
||||
return path->is_empty_fill;
|
||||
return path->fill_is_empty;
|
||||
}
|
||||
|
||||
static inline cairo_bool_t
|
||||
|
|
@ -163,7 +170,7 @@ _cairo_path_fixed_stroke_is_rectilinear (const cairo_path_fixed_t *path)
|
|||
static inline cairo_bool_t
|
||||
_cairo_path_fixed_fill_maybe_region (const cairo_path_fixed_t *path)
|
||||
{
|
||||
if (! path->maybe_fill_region)
|
||||
if (! path->fill_maybe_region)
|
||||
return FALSE;
|
||||
|
||||
if (! path->has_current_point || path->needs_move_to)
|
||||
|
|
|
|||
|
|
@ -105,8 +105,8 @@ _cairo_path_fixed_init (cairo_path_fixed_t *path)
|
|||
path->has_curve_to = FALSE;
|
||||
path->stroke_is_rectilinear = TRUE;
|
||||
path->fill_is_rectilinear = TRUE;
|
||||
path->maybe_fill_region = TRUE;
|
||||
path->is_empty_fill = TRUE;
|
||||
path->fill_maybe_region = TRUE;
|
||||
path->fill_is_empty = TRUE;
|
||||
|
||||
path->extents.p1.x = path->extents.p1.y = 0;
|
||||
path->extents.p2.x = path->extents.p2.y = 0;
|
||||
|
|
@ -137,8 +137,8 @@ _cairo_path_fixed_init_copy (cairo_path_fixed_t *path,
|
|||
path->has_curve_to = other->has_curve_to;
|
||||
path->stroke_is_rectilinear = other->stroke_is_rectilinear;
|
||||
path->fill_is_rectilinear = other->fill_is_rectilinear;
|
||||
path->maybe_fill_region = other->maybe_fill_region;
|
||||
path->is_empty_fill = other->is_empty_fill;
|
||||
path->fill_maybe_region = other->fill_maybe_region;
|
||||
path->fill_is_empty = other->fill_is_empty;
|
||||
|
||||
path->extents = other->extents;
|
||||
|
||||
|
|
@ -453,8 +453,8 @@ _cairo_path_fixed_move_to_apply (cairo_path_fixed_t *path)
|
|||
path->has_extents = TRUE;
|
||||
}
|
||||
|
||||
if (path->maybe_fill_region) {
|
||||
path->maybe_fill_region = _cairo_fixed_is_integer (path->current_point.x) &&
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (path->current_point.x) &&
|
||||
_cairo_fixed_is_integer (path->current_point.y);
|
||||
}
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ _cairo_path_fixed_new_sub_path (cairo_path_fixed_t *path)
|
|||
/* Implicitly close for fill */
|
||||
path->fill_is_rectilinear = path->current_point.x == path->last_move_point.x ||
|
||||
path->current_point.y == path->last_move_point.y;
|
||||
path->maybe_fill_region &= path->fill_is_rectilinear;
|
||||
path->fill_maybe_region &= path->fill_is_rectilinear;
|
||||
}
|
||||
path->needs_move_to = TRUE;
|
||||
}
|
||||
|
|
@ -560,13 +560,13 @@ _cairo_path_fixed_line_to (cairo_path_fixed_t *path,
|
|||
path->stroke_is_rectilinear = path->current_point.x == x ||
|
||||
path->current_point.y == y;
|
||||
path->fill_is_rectilinear &= path->stroke_is_rectilinear;
|
||||
path->maybe_fill_region &= path->fill_is_rectilinear;
|
||||
if (path->maybe_fill_region) {
|
||||
path->maybe_fill_region = _cairo_fixed_is_integer (x) &&
|
||||
path->fill_maybe_region &= path->fill_is_rectilinear;
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (x) &&
|
||||
_cairo_fixed_is_integer (y);
|
||||
}
|
||||
if (path->is_empty_fill) {
|
||||
path->is_empty_fill = path->current_point.x == x &&
|
||||
if (path->fill_is_empty) {
|
||||
path->fill_is_empty = path->current_point.x == x &&
|
||||
path->current_point.y == y;
|
||||
}
|
||||
}
|
||||
|
|
@ -634,8 +634,8 @@ _cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
|
|||
path->has_curve_to = TRUE;
|
||||
path->stroke_is_rectilinear = FALSE;
|
||||
path->fill_is_rectilinear = FALSE;
|
||||
path->maybe_fill_region = FALSE;
|
||||
path->is_empty_fill = FALSE;
|
||||
path->fill_maybe_region = FALSE;
|
||||
path->fill_is_empty = FALSE;
|
||||
|
||||
return _cairo_path_fixed_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
|
||||
}
|
||||
|
|
@ -964,8 +964,11 @@ _cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path,
|
|||
cairo_path_buf_t *buf;
|
||||
unsigned int i;
|
||||
|
||||
if (path->maybe_fill_region) {
|
||||
path->maybe_fill_region = _cairo_fixed_is_integer (offx) &&
|
||||
/* Recompute an approximation of the flags.
|
||||
* It might be more strict than what is actually needed.
|
||||
*/
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (offx) &&
|
||||
_cairo_fixed_is_integer (offy) &&
|
||||
_cairo_fixed_is_integer (scalex) &&
|
||||
_cairo_fixed_is_integer (scaley);
|
||||
|
|
@ -1001,10 +1004,12 @@ _cairo_path_fixed_translate (cairo_path_fixed_t *path,
|
|||
if (offx == 0 && offy == 0)
|
||||
return;
|
||||
|
||||
if (path->maybe_fill_region &&
|
||||
! (_cairo_fixed_is_integer (offx) && _cairo_fixed_is_integer (offy)))
|
||||
{
|
||||
path->maybe_fill_region = FALSE;
|
||||
/* Recompute an approximation of the flags.
|
||||
* It might be more strict than what is actually needed.
|
||||
*/
|
||||
if (path->fill_maybe_region) {
|
||||
path->fill_maybe_region = _cairo_fixed_is_integer (offx) &&
|
||||
_cairo_fixed_is_integer (offy);
|
||||
}
|
||||
|
||||
path->last_move_point.x += offx;
|
||||
|
|
@ -1062,7 +1067,7 @@ _cairo_path_fixed_transform (cairo_path_fixed_t *path,
|
|||
|
||||
path->extents.p1.x = path->extents.p1.y = INT_MAX;
|
||||
path->extents.p2.x = path->extents.p2.y = INT_MIN;
|
||||
path->maybe_fill_region = FALSE;
|
||||
path->fill_maybe_region = FALSE;
|
||||
cairo_path_foreach_buf_start (buf, path) {
|
||||
for (i = 0; i < buf->num_points; i++) {
|
||||
dx = _cairo_fixed_to_double (buf->points[i].x);
|
||||
|
|
|
|||
|
|
@ -122,8 +122,8 @@ static const cairo_t _cairo_nil = {
|
|||
FALSE, /* has_curve_to */
|
||||
TRUE, /* stroke_is_rectilinear */
|
||||
TRUE, /* fill_is_rectilinear */
|
||||
FALSE, /* maybe_fill_region */
|
||||
TRUE, /* is_empty_fill */
|
||||
TRUE, /* fill_maybe_region */
|
||||
TRUE, /* fill_is_empty */
|
||||
{ {0, 0}, {0, 0}}, /* extents */
|
||||
{{{NULL,NULL}}} /* link */
|
||||
}}
|
||||
|
|
@ -145,8 +145,8 @@ static const cairo_t _cairo_nil__null_pointer = {
|
|||
FALSE, /* has_curve_to */
|
||||
TRUE, /* stroke_is_rectilinear */
|
||||
TRUE, /* fill_is_rectilinear */
|
||||
FALSE, /* maybe_fill_region */
|
||||
TRUE, /* is_empty_fill */
|
||||
TRUE, /* fill_maybe_region */
|
||||
TRUE, /* fill_is_empty */
|
||||
{ {0, 0}, {0, 0}}, /* extents */
|
||||
{{{NULL,NULL}}} /* link */
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue