summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-09-30 08:54:19 +0200
committerBenjamin Otte <otte@gnome.org>2009-09-30 08:58:19 +0200
commit6809e1216119e16c5be236418dc560d2e9bf854d (patch)
treed76fc38a8377e3134743659a590bfb514a1eefe0
parentf8c49b4187a32b60408b23b2c2abce1778a8dc95 (diff)
[API] Make _cairo_meta_surface_replay() private again
Replaying a meta surface can be achieved by using it as a source for a cairo_paint() so exporting a separate API is unnecesary and confusing. So after consulting Chris and Carl, we decided to remove the function again.
-rw-r--r--NEWS1
-rw-r--r--src/cairo-meta-surface-private.h5
-rw-r--r--src/cairo-meta-surface.c39
-rw-r--r--src/cairo-paginated-surface.c4
-rw-r--r--src/cairo-script-surface.c6
-rw-r--r--src/cairo-surface.c4
-rw-r--r--src/cairo-svg-surface.c2
-rw-r--r--src/cairo-type3-glyph-surface.c4
-rw-r--r--src/cairo-user-font.c2
-rw-r--r--src/cairo-vg-surface.c2
-rw-r--r--src/cairo-xml-surface.c2
-rw-r--r--src/cairo.h4
-rw-r--r--test/cairo-test-trace.c8
-rw-r--r--util/cairo-trace/trace.c22
14 files changed, 40 insertions, 65 deletions
diff --git a/NEWS b/NEWS
index 0acb77d7..6fdd0647 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,6 @@ API additions:
cairo_meta_surface_create()
cairo_meta_surface_ink_extents()
- cairo_meta_surface_replay()
Finally exporting the internal meta-surface so that applications
have a method to record and replay a sequence of drawing commands.
diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
index edfb20c3..6790eab7 100644
--- a/src/cairo-meta-surface-private.h
+++ b/src/cairo-meta-surface-private.h
@@ -138,12 +138,15 @@ typedef struct _cairo_meta_surface {
} cairo_meta_surface_t;
slim_hidden_proto (cairo_meta_surface_create);
-slim_hidden_proto (cairo_meta_surface_replay);
cairo_private cairo_int_status_t
_cairo_meta_surface_get_path (cairo_surface_t *surface,
cairo_path_fixed_t *path);
+cairo_private cairo_status_t
+_cairo_meta_surface_replay (cairo_surface_t *surface,
+ cairo_surface_t *target);
+
cairo_private cairo_status_t
_cairo_meta_surface_replay_analyze_meta_pattern (cairo_surface_t *surface,
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index dcff8163..8abb9aba 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -40,15 +40,21 @@
/* A meta surface is a surface that records all drawing operations at
* the highest level of the surface backend interface, (that is, the
* level of paint, mask, stroke, fill, and show_text_glyphs). The meta
- * surface can then be "replayed" against any target surface with:
+ * surface can then be "replayed" against any target surface by using it
+ * as a source surface.
*
+ * If you want to replay a surface so that the results in target will be
+ * identical to the results that would have been obtained if the original
+ * operations applied to the meta surface had instead been applied to the
+ * target surface, you can use code like this:
* <informalexample><programlisting>
- * cairo_meta_surface_replay (meta, target);
- * </programlisting></informalexample>
+ * cairo_t *cr;
*
- * after which the results in target will be identical to the results
- * that would have been obtained if the original operations applied to
- * the meta surface had instead been applied to the target surface.
+ * cr = cairo_create (target);
+ * cairo_set_source_surface (cr, meta, 0.0, 0.0);
+ * cairo_paint (cr);
+ * cairo_destroy (cr);
+ * </programlisting></informalexample>
*
* A meta surface is logically unbounded, i.e. it has no implicit constraint
* on the size of the drawing surface. However, in practice this is rarely
@@ -97,15 +103,7 @@ static const cairo_surface_backend_t cairo_meta_surface_backend;
* Creates a meta-surface which can be used to record all drawing operations
* at the highest level (that is, the level of paint, mask, stroke, fill
* and show_text_glyphs). The meta surface can then be "replayed" against
- * any target surface with:
- *
- * <informalexample><programlisting>
- * cairo_meta_surface_replay (meta, target);
- * </programlisting></informalexample>
- *
- * after which the results in target will be identical to the results
- * that would have been obtained if the original operations applied to
- * the meta surface had instead been applied to the target surface.
+ * any target surface by using it as a source to drawing operations.
*
* The recording phase of the meta surface is careful to snapshot all
* necessary objects (paths, patterns, etc.), in order to achieve
@@ -264,7 +262,7 @@ _cairo_meta_surface_acquire_source_image (void *abstract_surface,
-surface->extents.x,
-surface->extents.y);
- status = cairo_meta_surface_replay (&surface->base, image);
+ status = _cairo_meta_surface_replay (&surface->base, image);
if (unlikely (status)) {
cairo_surface_destroy (image);
return status;
@@ -958,7 +956,7 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
}
/**
- * cairo_meta_surface_replay:
+ * _cairo_meta_surface_replay:
* @surface: the #cairo_meta_surface_t
* @target: a target #cairo_surface_t onto which to replay the operations
* @width_pixels: width of the surface, in pixels
@@ -968,11 +966,9 @@ _cairo_meta_surface_replay_internal (cairo_surface_t *surface,
* after which the results in target will be identical to the results
* that would have been obtained if the original operations applied to
* the meta surface had instead been applied to the target surface.
- *
- * Since 1.10
**/
cairo_status_t
-cairo_meta_surface_replay (cairo_surface_t *surface,
+_cairo_meta_surface_replay (cairo_surface_t *surface,
cairo_surface_t *target)
{
return _cairo_meta_surface_replay_internal (surface,
@@ -980,7 +976,6 @@ cairo_meta_surface_replay (cairo_surface_t *surface,
CAIRO_META_REPLAY,
CAIRO_META_REGION_ALL);
}
-slim_hidden_def (cairo_meta_surface_replay);
/* Replay meta to surface. When the return status of each operation is
* one of %CAIRO_STATUS_SUCCESS, %CAIRO_INT_STATUS_UNSUPPORTED, or
@@ -1029,7 +1024,7 @@ _meta_surface_get_ink_bbox (cairo_meta_surface_t *surface,
if (transform != NULL)
_cairo_analysis_surface_set_ctm (analysis_surface, transform);
- status = cairo_meta_surface_replay (&surface->base, analysis_surface);
+ status = _cairo_meta_surface_replay (&surface->base, analysis_surface);
_cairo_analysis_surface_get_bounding_box (analysis_surface, bbox);
cairo_surface_destroy (analysis_surface);
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 34c46765..680bcf53 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -217,7 +217,7 @@ _cairo_paginated_surface_acquire_source_image (void *abstract_surface,
extents.width,
extents.height);
- status = cairo_meta_surface_replay (surface->meta, image);
+ status = _cairo_meta_surface_replay (surface->meta, image);
if (unlikely (status)) {
cairo_surface_destroy (image);
return status;
@@ -261,7 +261,7 @@ _paint_fallback_image (cairo_paginated_surface_t *surface,
* so we have to do the scaling manually. */
cairo_surface_set_device_offset (image, -x*x_scale, -y*y_scale);
- status = cairo_meta_surface_replay (surface->meta, image);
+ status = _cairo_meta_surface_replay (surface->meta, image);
if (unlikely (status))
goto CLEANUP_IMAGE;
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index 29d2da04..93b09da8 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -972,7 +972,7 @@ _emit_meta_surface_pattern (cairo_script_surface_t *surface,
old_cr = surface->cr;
_cairo_script_implicit_context_init (&surface->cr);
- status = cairo_meta_surface_replay (&source->base, &similar->base);
+ status = _cairo_meta_surface_replay (&source->base, &similar->base);
surface->cr = old_cr;
if (unlikely (status)) {
@@ -2655,7 +2655,7 @@ _emit_scaled_glyph_vector (cairo_script_surface_t *surface,
old_cr = surface->cr;
_cairo_script_implicit_context_init (&surface->cr);
- status = cairo_meta_surface_replay (scaled_glyph->meta_surface,
+ status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
&surface->base);
surface->cr = old_cr;
@@ -3430,7 +3430,7 @@ cairo_script_from_meta_surface (cairo_script_context_t *context,
return surface->status;
cairo_surface_set_device_offset (surface, -extents.x, -extents.y);
- status = cairo_meta_surface_replay (meta, surface);
+ status = _cairo_meta_surface_replay (meta, surface);
cairo_surface_destroy (surface);
return status;
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d66e9301..fd4e01b0 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1450,7 +1450,7 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface,
cairo_surface_set_device_offset (similar, -src_x, -src_y);
- status = cairo_meta_surface_replay (src, similar);
+ status = _cairo_meta_surface_replay (src, similar);
if (unlikely (status)) {
cairo_surface_destroy (similar);
return status;
@@ -1465,7 +1465,7 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface,
if (unlikely (similar->status))
return similar->status;
- status = cairo_meta_surface_replay (src, similar);
+ status = _cairo_meta_surface_replay (src, similar);
if (unlikely (status)) {
cairo_surface_destroy (similar);
return status;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 8be5eed9..26ae3d9d 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1300,7 +1300,7 @@ _cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
-source->extents_pixels.x,
-source->extents_pixels.y);
- status = cairo_meta_surface_replay (&source->base, paginated_surface);
+ status = _cairo_meta_surface_replay (&source->base, paginated_surface);
if (unlikely (status)) {
cairo_surface_destroy (paginated_surface);
return status;
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index f55b12ac..f7699b8b 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -449,7 +449,7 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
goto cleanup;
}
- status = cairo_meta_surface_replay (scaled_glyph->meta_surface,
+ status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
&surface->base);
if (unlikely (status))
goto cleanup;
@@ -544,7 +544,7 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
_cairo_type3_glyph_surface_set_stream (surface, mem_stream);
_cairo_output_stream_printf (surface->stream, "q\n");
- status = cairo_meta_surface_replay (scaled_glyph->meta_surface,
+ status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
&surface->base);
status2 = _cairo_pdf_operators_flush (&surface->pdf_operators);
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 42e8bae2..1cd5ffcc 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -202,7 +202,7 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
cairo_surface_set_device_offset (surface,
- _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.x),
- _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y));
- status = cairo_meta_surface_replay (meta_surface, surface);
+ status = _cairo_meta_surface_replay (meta_surface, surface);
if (unlikely (status)) {
cairo_surface_destroy(surface);
diff --git a/src/cairo-vg-surface.c b/src/cairo-vg-surface.c
index 232450d5..de22c10d 100644
--- a/src/cairo-vg-surface.c
+++ b/src/cairo-vg-surface.c
@@ -870,7 +870,7 @@ _vg_clone_meta_surface (cairo_vg_context_t *context,
extents.width, extents.height);
cairo_surface_set_device_offset (&clone->base, -extents.x, -extents.y);
- status = cairo_meta_surface_replay (surface, &clone->base);
+ status = _cairo_meta_surface_replay (surface, &clone->base);
if (unlikely (status)) {
cairo_surface_destroy (&clone->base);
return (cairo_vg_surface_t *) _cairo_surface_create_in_error (status);
diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index 61e8f61a..c40f61fc 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -1131,7 +1131,7 @@ cairo_xml_for_meta_surface (cairo_xml_t *xml,
_cairo_xml_indent (xml, 2);
cairo_surface_set_device_offset (surface, -extents.x, -extents.y);
- status = cairo_meta_surface_replay (meta, surface);
+ status = _cairo_meta_surface_replay (meta, surface);
cairo_surface_destroy (surface);
_cairo_xml_indent (xml, -2);
diff --git a/src/cairo.h b/src/cairo.h
index 3b5eb36e..c239deac 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -2189,10 +2189,6 @@ cairo_meta_surface_ink_extents (cairo_surface_t *surface,
double *width,
double *height);
-cairo_public cairo_status_t
-cairo_meta_surface_replay (cairo_surface_t *surface,
- cairo_surface_t *target);
-
/* Tee-surface functions */
cairo_public cairo_surface_t *
diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c
index c35d6a7e..1d12f53d 100644
--- a/test/cairo-test-trace.c
+++ b/test/cairo-test-trace.c
@@ -867,7 +867,7 @@ write_trace (const char *trace, struct slave *slave)
cairo_script_context_t *ctx;
cairo_surface_t *script;
char *filename;
- cairo_status_t status;
+ cairo_t *cr;
xasprintf (&filename, "%s-fail.trace", trace);
ctx = cairo_script_context_create (filename);
@@ -877,7 +877,11 @@ write_trace (const char *trace, struct slave *slave)
cairo_script_context_destroy (ctx);
free (filename);
- status = cairo_meta_surface_replay (slave->image, script);
+ cr = cairo_create (slave->image);
+ cairo_set_source_surface (cr, script, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
cairo_surface_destroy (script);
#endif
}
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index ac88e43e..79cd6a23 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -4755,28 +4755,6 @@ cairo_meta_surface_create (cairo_content_t content,
return ret;
}
-cairo_status_t
-cairo_meta_surface_replay (cairo_surface_t *meta, cairo_surface_t *target)
-{
- cairo_status_t ret;
-
- _enter_trace ();
-
- ret = DLCALL (cairo_meta_surface_replay, meta, target);
-
- _emit_line_info ();
- if (_write_lock ()) {
-
- _emit_surface (target);
- _emit_surface (meta);
- _trace_printf ("replay");
- _consume_operand ();
- }
-
- _exit_trace ();
- return ret;
-}
-
#if CAIRO_HAS_VG_SURFACE
#include <cairo-vg.h>
cairo_surface_t *