[cairo-commit] cairo/src cairo-gstate.c, 1.172,
1.173 cairo-meta-surface-private.h, 1.4,
1.5 cairo-meta-surface.c, 1.9, 1.10 cairo-pdf-surface.c, 1.63,
1.64 cairo-ps-surface.c, 1.52, 1.53 cairo-surface.c, 1.101,
1.102 cairoint.h, 1.214, 1.215
Carl Worth
commit at pdx.freedesktop.org
Thu Oct 13 16:55:17 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv24606/src
Modified Files:
cairo-gstate.c cairo-meta-surface-private.h
cairo-meta-surface.c cairo-pdf-surface.c cairo-ps-surface.c
cairo-surface.c cairoint.h
Log Message:
2005-10-13 Carl Worth <cworth at 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.
Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- cairo-gstate.c 13 Oct 2005 14:33:07 -0000 1.172
+++ cairo-gstate.c 13 Oct 2005 23:55:14 -0000 1.173
@@ -1557,7 +1557,6 @@
_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 @@
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
Index: cairo-meta-surface-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface-private.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo-meta-surface-private.h 9 Aug 2005 20:01:14 -0000 1.4
+++ cairo-meta-surface-private.h 13 Oct 2005 23:55:14 -0000 1.5
@@ -152,4 +152,7 @@
_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 */
Index: cairo-meta-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-meta-surface.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cairo-meta-surface.c 24 Aug 2005 08:42:19 -0000 1.9
+++ cairo-meta-surface.c 13 Oct 2005 23:55:14 -0000 1.10
@@ -383,7 +383,8 @@
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 @@
}
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 @@
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 @@
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;
Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- cairo-pdf-surface.c 12 Oct 2005 20:33:38 -0000 1.63
+++ cairo-pdf-surface.c 13 Oct 2005 23:55:14 -0000 1.64
@@ -1239,11 +1239,12 @@
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;
Index: cairo-ps-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ps-surface.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- cairo-ps-surface.c 10 Oct 2005 03:40:12 -0000 1.52
+++ cairo-ps-surface.c 13 Oct 2005 23:55:14 -0000 1.53
@@ -468,16 +468,31 @@
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 @@
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;
Index: cairo-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-surface.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- cairo-surface.c 29 Sep 2005 17:09:59 -0000 1.101
+++ cairo-surface.c 13 Oct 2005 23:55:14 -0000 1.102
@@ -1063,21 +1063,64 @@
return _fallback_fill_rectangles (surface, operator, color, rects, num_rects);
}
-cairo_int_status_t
+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)
+{
+ 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_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)
{
- 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;
+
+ 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,
Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.214
retrieving revision 1.215
diff -u -d -r1.214 -r1.215
--- cairoint.h 10 Oct 2005 19:45:15 -0000 1.214
+++ cairoint.h 13 Oct 2005 23:55:15 -0000 1.215
@@ -711,11 +711,12 @@
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_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,
More information about the cairo-commit
mailing list