mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 03:40:09 +01:00
Push fill_path fallbacks down from gstate into the surface where all the other fallbacks are.
Add _cairo_surface_is_meta. Add antialias to the fill_path meta-surface command. Add an antialias parameter to the backend fill_path function. Fix test description. Reviewed by: keithp
This commit is contained in:
parent
097f240c6d
commit
31a561e2c2
9 changed files with 145 additions and 54 deletions
26
ChangeLog
26
ChangeLog
|
|
@ -1,3 +1,29 @@
|
|||
2005-10-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
Reviewed by: keithp
|
||||
|
||||
* src/cairo-surface.c: (_fallback_fill_path),
|
||||
(_cairo_surface_fill_path):
|
||||
* src/cairo-gstate.c: (_cairo_gstate_fill): Push fill_path
|
||||
fallbacks down from gstate into the surface where all the other
|
||||
fallbacks are.
|
||||
|
||||
* src/cairo-meta-surface-private.h:
|
||||
* src/cairo-meta-surface.c: (_cairo_surface_is_meta):
|
||||
Add _cairo_surface_is_meta.
|
||||
|
||||
* src/cairo-meta-surface.c: (_cairo_meta_surface_fill_path),
|
||||
(_cairo_meta_surface_replay): Add antialias to the fill_path
|
||||
meta-surface command.
|
||||
|
||||
* src/cairoint.h:
|
||||
* src/cairo-pdf-surface.c: (_cairo_pdf_surface_fill_path):
|
||||
* src/cairo-ps-surface.c: (_cairo_ps_surface_fill_path),
|
||||
(_ps_output_fill_path): Add an antialias parameter to the backend
|
||||
fill_path function.
|
||||
|
||||
* test/fill-and-stroke.c: Fix test description.
|
||||
|
||||
2005-10-13 Carl Worth <cworth@cworth.org>
|
||||
|
||||
* src/cairo-gstate.c:
|
||||
|
|
|
|||
|
|
@ -1557,7 +1557,6 @@ cairo_status_t
|
|||
_cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
|
||||
{
|
||||
cairo_status_t status;
|
||||
cairo_traps_t traps;
|
||||
cairo_pattern_union_t pattern;
|
||||
|
||||
if (gstate->source->status)
|
||||
|
|
@ -1574,29 +1573,11 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
|
|||
gstate->target,
|
||||
path,
|
||||
gstate->fill_rule,
|
||||
gstate->tolerance);
|
||||
gstate->tolerance,
|
||||
&gstate->clip,
|
||||
gstate->antialias);
|
||||
|
||||
_cairo_pattern_fini (&pattern.base);
|
||||
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
|
||||
_cairo_traps_init (&traps);
|
||||
|
||||
status = _cairo_path_fixed_fill_to_traps (path,
|
||||
gstate->fill_rule,
|
||||
gstate->tolerance,
|
||||
&traps);
|
||||
if (status) {
|
||||
_cairo_traps_fini (&traps);
|
||||
return status;
|
||||
}
|
||||
|
||||
_cairo_gstate_clip_and_composite_trapezoids (gstate, &traps);
|
||||
|
||||
_cairo_traps_fini (&traps);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
return status;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
|
|
|
|||
|
|
@ -152,4 +152,7 @@ cairo_private cairo_int_status_t
|
|||
_cairo_meta_surface_replay (cairo_surface_t *surface,
|
||||
cairo_surface_t *target);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_surface_is_meta (const cairo_surface_t *surface);
|
||||
|
||||
#endif /* CAIRO_META_SURFACE_H */
|
||||
|
|
|
|||
|
|
@ -383,7 +383,8 @@ _cairo_meta_surface_fill_path (cairo_operator_t operator,
|
|||
void *abstract_surface,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance)
|
||||
double tolerance,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_meta_surface_t *meta = abstract_surface;
|
||||
cairo_command_fill_path_t *command;
|
||||
|
|
@ -404,6 +405,7 @@ _cairo_meta_surface_fill_path (cairo_operator_t operator,
|
|||
}
|
||||
command->fill_rule = fill_rule;
|
||||
command->tolerance = tolerance;
|
||||
command->antialias = antialias;
|
||||
|
||||
if (_cairo_array_append (&meta->commands, &command, 1) == NULL) {
|
||||
_cairo_path_fixed_fini (&command->path);
|
||||
|
|
@ -415,6 +417,20 @@ _cairo_meta_surface_fill_path (cairo_operator_t operator,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* _cairo_surface_is_meta:
|
||||
* @surface: a #cairo_surface_t
|
||||
*
|
||||
* Checks if a surface is a #cairo_meta_surface_t
|
||||
*
|
||||
* Return value: TRUE if the surface is a meta surface
|
||||
**/
|
||||
cairo_bool_t
|
||||
_cairo_surface_is_meta (const cairo_surface_t *surface)
|
||||
{
|
||||
return surface->backend == &cairo_meta_surface_backend;
|
||||
}
|
||||
|
||||
static const cairo_surface_backend_t cairo_meta_surface_backend = {
|
||||
_cairo_meta_surface_create_similar,
|
||||
_cairo_meta_surface_finish,
|
||||
|
|
@ -570,7 +586,9 @@ _cairo_meta_surface_replay (cairo_surface_t *surface,
|
|||
target,
|
||||
&command->fill_path.path,
|
||||
command->fill_path.fill_rule,
|
||||
command->fill_path.tolerance);
|
||||
command->fill_path.tolerance,
|
||||
&clip,
|
||||
command->fill_path.antialias);
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1239,11 +1239,12 @@ _cairo_pdf_path_close_path (void *closure)
|
|||
|
||||
static cairo_int_status_t
|
||||
_cairo_pdf_surface_fill_path (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_pattern_t *pattern,
|
||||
void *abstract_dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance)
|
||||
double tolerance,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_pdf_surface_t *surface = abstract_dst;
|
||||
cairo_pdf_document_t *document = surface->document;
|
||||
|
|
|
|||
|
|
@ -468,16 +468,31 @@ _cairo_ps_surface_fill_path (cairo_operator_t operator,
|
|||
void *abstract_dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance)
|
||||
double tolerance,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_ps_surface_t *surface = abstract_dst;
|
||||
|
||||
/* XXX: This is rather fragile here. We want to call back up into
|
||||
* cairo-surface in order for it to farm things out to the
|
||||
* appropriate backend fill_path function. But that requires
|
||||
* having a clip parameter. We take advantage of the fact that we
|
||||
* "know" that the clip is only used for fallbacks and we "know"
|
||||
* that the meta surface backend never uses a fallback for
|
||||
* fill_path.
|
||||
*
|
||||
* Clearly there's an organizational problem here.
|
||||
*/
|
||||
assert (_cairo_surface_is_meta (surface->current_page));
|
||||
|
||||
return _cairo_surface_fill_path (operator,
|
||||
pattern,
|
||||
surface->current_page,
|
||||
path,
|
||||
fill_rule,
|
||||
tolerance);
|
||||
tolerance,
|
||||
NULL, /* See comment above. */
|
||||
antialias);
|
||||
}
|
||||
|
||||
static const cairo_surface_backend_t cairo_ps_surface_backend = {
|
||||
|
|
@ -1341,7 +1356,8 @@ _ps_output_fill_path (cairo_operator_t operator,
|
|||
void *abstract_dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance)
|
||||
double tolerance,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
ps_output_surface_t *surface = abstract_dst;
|
||||
cairo_output_stream_t *stream = surface->parent->stream;
|
||||
|
|
|
|||
|
|
@ -1063,21 +1063,64 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
|
|||
return _fallback_fill_rectangles (surface, operator, color, rects, num_rects);
|
||||
}
|
||||
|
||||
cairo_int_status_t
|
||||
_cairo_surface_fill_path (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance)
|
||||
static cairo_status_t
|
||||
_fallback_fill_path (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance,
|
||||
cairo_clip_t *clip,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
if (dst->backend->fill_path)
|
||||
return dst->backend->fill_path (operator, pattern, dst, path,
|
||||
fill_rule, tolerance);
|
||||
else
|
||||
return CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
cairo_status_t status;
|
||||
cairo_traps_t traps;
|
||||
|
||||
_cairo_traps_init (&traps);
|
||||
|
||||
status = _cairo_path_fixed_fill_to_traps (path,
|
||||
fill_rule,
|
||||
tolerance,
|
||||
&traps);
|
||||
if (status) {
|
||||
_cairo_traps_fini (&traps);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _cairo_surface_clip_and_composite_trapezoids (pattern,
|
||||
operator,
|
||||
dst,
|
||||
&traps,
|
||||
clip,
|
||||
antialias);
|
||||
|
||||
_cairo_traps_fini (&traps);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
cairo_status_t
|
||||
_cairo_surface_fill_path (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance,
|
||||
cairo_clip_t *clip,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
||||
if (dst->backend->fill_path) {
|
||||
status = dst->backend->fill_path (operator, pattern, dst, path,
|
||||
fill_rule, tolerance, antialias);
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
return status;
|
||||
}
|
||||
|
||||
return _fallback_fill_path (operator, pattern, dst, path,
|
||||
fill_rule, tolerance, clip, antialias);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
_fallback_composite_trapezoids (cairo_operator_t operator,
|
||||
|
|
|
|||
|
|
@ -711,11 +711,12 @@ struct _cairo_surface_backend {
|
|||
|
||||
cairo_int_status_t
|
||||
(*fill_path) (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
void *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_pattern_t *pattern,
|
||||
void *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance);
|
||||
double tolerance,
|
||||
cairo_antialias_t antialias);
|
||||
|
||||
void
|
||||
(*get_font_options) (void *surface,
|
||||
|
|
@ -1544,13 +1545,15 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface,
|
|||
cairo_rectangle_t *rects,
|
||||
int num_rects);
|
||||
|
||||
cairo_private cairo_int_status_t
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_fill_path (cairo_operator_t operator,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_pattern_t *pattern,
|
||||
cairo_surface_t *dst,
|
||||
cairo_path_fixed_t *path,
|
||||
cairo_fill_rule_t fill_rule,
|
||||
double tolerance);
|
||||
double tolerance,
|
||||
cairo_clip_t *clip,
|
||||
cairo_antialias_t antialias);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
_cairo_surface_composite_trapezoids (cairo_operator_t operator,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
cairo_test_t test = {
|
||||
"fill-and-stroke",
|
||||
"Tests calls to various set_source functions",
|
||||
"Tests using cairo_fill_preserve/cairo_stroke to fill/stroke the same path",
|
||||
2 * SIZE + 4 * PAD, SIZE + 2 * PAD
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue