mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 02:58:02 +02:00
[in-fill] Add the implicit close-path during move-to.
When interpreting a fixed-path for a fill operation, any move-to implicitly closes the current path.
This commit is contained in:
parent
59de6fb89e
commit
b8991a1c69
4 changed files with 25 additions and 25 deletions
|
|
@ -1060,7 +1060,7 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
|
|||
return status;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
void
|
||||
_cairo_gstate_in_fill (cairo_gstate_t *gstate,
|
||||
cairo_path_fixed_t *path,
|
||||
double x,
|
||||
|
|
@ -1069,11 +1069,11 @@ _cairo_gstate_in_fill (cairo_gstate_t *gstate,
|
|||
{
|
||||
_cairo_gstate_user_to_backend (gstate, &x, &y);
|
||||
|
||||
return _cairo_path_fixed_in_fill (path,
|
||||
gstate->fill_rule,
|
||||
gstate->tolerance,
|
||||
x, y,
|
||||
inside_ret);
|
||||
_cairo_path_fixed_in_fill (path,
|
||||
gstate->fill_rule,
|
||||
gstate->tolerance,
|
||||
x, y,
|
||||
inside_ret);
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
|
|
|
|||
|
|
@ -136,9 +136,14 @@ _cairo_in_fill_move_to (void *closure, cairo_point_t *point)
|
|||
{
|
||||
cairo_in_fill_t *in_fill = closure;
|
||||
|
||||
if (! in_fill->has_current_point)
|
||||
in_fill->first_point = *point;
|
||||
/* implicit close path */
|
||||
if (in_fill->has_current_point) {
|
||||
_cairo_in_fill_add_edge (in_fill,
|
||||
&in_fill->current_point,
|
||||
&in_fill->first_point);
|
||||
}
|
||||
|
||||
in_fill->first_point = *point;
|
||||
in_fill->current_point = *point;
|
||||
in_fill->has_current_point = TRUE;
|
||||
|
||||
|
|
@ -153,7 +158,10 @@ _cairo_in_fill_line_to (void *closure, cairo_point_t *point)
|
|||
if (in_fill->has_current_point)
|
||||
_cairo_in_fill_add_edge (in_fill, &in_fill->current_point, point);
|
||||
|
||||
return _cairo_in_fill_move_to (in_fill, point);
|
||||
in_fill->current_point = *point;
|
||||
in_fill->has_current_point = TRUE;
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -215,7 +223,7 @@ _cairo_in_fill_close_path (void *closure)
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
void
|
||||
_cairo_path_fixed_in_fill (cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance,
|
||||
|
|
@ -235,8 +243,7 @@ _cairo_path_fixed_in_fill (cairo_path_fixed_t *path,
|
|||
_cairo_in_fill_curve_to,
|
||||
_cairo_in_fill_close_path,
|
||||
&in_fill);
|
||||
if (status)
|
||||
goto BAIL;
|
||||
assert (status == CAIRO_STATUS_SUCCESS);
|
||||
|
||||
switch (fill_rule) {
|
||||
case CAIRO_FILL_RULE_EVEN_ODD:
|
||||
|
|
@ -251,9 +258,5 @@ _cairo_path_fixed_in_fill (cairo_path_fixed_t *path,
|
|||
break;
|
||||
}
|
||||
|
||||
status = CAIRO_STATUS_SUCCESS;
|
||||
|
||||
BAIL:
|
||||
_cairo_in_fill_fini (&in_fill);
|
||||
return status;
|
||||
}
|
||||
|
|
|
|||
11
src/cairo.c
11
src/cairo.c
|
|
@ -2269,17 +2269,14 @@ cairo_in_stroke (cairo_t *cr, double x, double y)
|
|||
cairo_bool_t
|
||||
cairo_in_fill (cairo_t *cr, double x, double y)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_bool_t inside = FALSE;
|
||||
cairo_bool_t inside;
|
||||
|
||||
if (cr->status)
|
||||
return 0;
|
||||
|
||||
status = _cairo_gstate_in_fill (cr->gstate,
|
||||
cr->path,
|
||||
x, y, &inside);
|
||||
if (status)
|
||||
_cairo_set_error (cr, status);
|
||||
_cairo_gstate_in_fill (cr->gstate,
|
||||
cr->path,
|
||||
x, y, &inside);
|
||||
|
||||
return inside;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1183,7 +1183,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate,
|
|||
double y,
|
||||
cairo_bool_t *inside_ret);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
cairo_private void
|
||||
_cairo_gstate_in_fill (cairo_gstate_t *gstate,
|
||||
cairo_path_fixed_t *path,
|
||||
double x,
|
||||
|
|
@ -1537,7 +1537,7 @@ _cairo_path_fixed_is_rectangle (cairo_path_fixed_t *path,
|
|||
cairo_box_t *box);
|
||||
|
||||
/* cairo-path-in-fill.c */
|
||||
cairo_private cairo_status_t
|
||||
cairo_private void
|
||||
_cairo_path_fixed_in_fill (cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue