[cairo-commit] boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate.h boilerplate/cairo-boilerplate-pdf.c boilerplate/cairo-boilerplate-ps.c boilerplate/cairo-boilerplate-svg.c boilerplate/cairo-boilerplate-test-surfaces.c boilerplate/cairo-boilerplate-win32-printing.c boilerplate/Makefile.win32.features build/Makefile.win32.features-h configure.ac doc/public NEWS perf/cairo-perf-micro.c perf/cairo-perf-trace.c src/cairo-analysis-surface.c src/cairo.c src/cairo.h src/cairoint.h src/cairo-meta-surface.c src/cairo-meta-surface-private.h src/cairo-paginated-private.h src/cairo-paginated-surface.c src/cairo-paginated-surface-private.h src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-recording-surface.c src/cairo-recording-surface-private.h src/cairo-scaled-font.c src/cairo-script.h src/cairo-script-surface.c src/cairo-surface.c src/cairo-svg-surface.c src/cairo-tee-surface.c src/cairo-type3-glyph-surface.c src/cairo-types-private.h src/cairo-user-font.c src/cairo-vg-surface.c src/cairo-win32-printing-surface.c src/cairo-xml.h src/cairo-xml-surface.c src/Makefile.sources src/Makefile.win32.features test/cairo-test.c test/cairo-test-trace.c test/Makefile.am test/Makefile.sources test/meta-surface-pattern.c test/meta-surface-pattern.gl.argb32.ref.png test/meta-surface-pattern.pdf.argb32.ref.png test/meta-surface-pattern.pdf.rgb24.ref.png test/meta-surface-pattern.ps2.argb32.ref.png test/meta-surface-pattern.ps2.rgb24.ref.png test/meta-surface-pattern.ps3.argb32.ref.png test/meta-surface-pattern.ps3.rgb24.ref.png test/meta-surface-pattern.quartz.ref.png test/meta-surface-pattern.quartz.rgb24.ref.png test/meta-surface-pattern.ref.png test/meta-surface-pattern.rgb24.ref.png test/meta-surface-pattern.svg.argb32.ref.png test/meta-surface-pattern.svg.rgb24.ref.png test/recording-surface-pattern.c test/recording-surface-pattern.gl.argb32.ref.png test/recording-surface-pattern.pdf.argb32.ref.png test/recording-surface-pattern.pdf.rgb24.ref.png test/recording-surface-pattern.ps2.argb32.ref.png test/recording-surface-pattern.ps2.rgb24.ref.png test/recording-surface-pattern.ps3.argb32.ref.png test/recording-surface-pattern.ps3.rgb24.ref.png test/recording-surface-pattern.quartz.ref.png test/recording-surface-pattern.quartz.rgb24.ref.png test/recording-surface-pattern.ref.png test/recording-surface-pattern.rgb24.ref.png test/recording-surface-pattern.svg.argb32.ref.png test/recording-surface-pattern.svg.rgb24.ref.png test/scale-offset-similar.meta.xfail.png test/scale-offset-similar.recording.xfail.png util/cairo-fdr util/cairo-sphinx util/cairo-trace util/trace-to-xml.c
M. Joonas Pihlaja
joonas at kemper.freedesktop.org
Wed Oct 21 17:00:28 PDT 2009
NEWS | 7
boilerplate/Makefile.win32.features | 14
boilerplate/cairo-boilerplate-pdf.c | 6
boilerplate/cairo-boilerplate-ps.c | 8
boilerplate/cairo-boilerplate-svg.c | 8
boilerplate/cairo-boilerplate-test-surfaces.c | 2
boilerplate/cairo-boilerplate-win32-printing.c | 2
boilerplate/cairo-boilerplate.c | 46
boilerplate/cairo-boilerplate.h | 2
build/Makefile.win32.features-h | 2
configure.ac | 2
dev/null |binary
doc/public/tmpl/cairo-surface.sgml | 2
perf/cairo-perf-micro.c | 4
perf/cairo-perf-trace.c | 4
src/Makefile.sources | 4
src/Makefile.win32.features | 14
src/cairo-analysis-surface.c | 48
src/cairo-meta-surface-private.h | 171 ---
src/cairo-meta-surface.c | 1096 --------------------
src/cairo-paginated-private.h | 6
src/cairo-paginated-surface-private.h | 4
src/cairo-paginated-surface.c | 92 -
src/cairo-pattern.c | 2
src/cairo-pdf-surface.c | 56 -
src/cairo-ps-surface.c | 42
src/cairo-recording-surface-private.h | 171 +++
src/cairo-recording-surface.c | 1096 ++++++++++++++++++++
src/cairo-scaled-font.c | 28
src/cairo-script-surface.c | 42
src/cairo-script.h | 4
src/cairo-surface.c | 58 -
src/cairo-svg-surface.c | 46
src/cairo-tee-surface.c | 6
src/cairo-type3-glyph-surface.c | 14
src/cairo-types-private.h | 2
src/cairo-user-font.c | 42
src/cairo-vg-surface.c | 10
src/cairo-win32-printing-surface.c | 60 -
src/cairo-xml-surface.c | 32
src/cairo-xml.h | 4
src/cairo.c | 2
src/cairo.h | 20
src/cairoint.h | 12
test/Makefile.am | 32
test/Makefile.sources | 2
test/cairo-test-trace.c | 48
test/cairo-test.c | 6
test/meta-surface-pattern.c | 121 --
test/recording-surface-pattern.c | 121 ++
test/recording-surface-pattern.gl.argb32.ref.png |binary
test/recording-surface-pattern.pdf.argb32.ref.png |binary
test/recording-surface-pattern.pdf.rgb24.ref.png |binary
test/recording-surface-pattern.ps2.argb32.ref.png |binary
test/recording-surface-pattern.ps2.rgb24.ref.png |binary
test/recording-surface-pattern.ps3.argb32.ref.png |binary
test/recording-surface-pattern.ps3.rgb24.ref.png |binary
test/recording-surface-pattern.quartz.ref.png |binary
test/recording-surface-pattern.quartz.rgb24.ref.png |binary
test/recording-surface-pattern.ref.png |binary
test/recording-surface-pattern.rgb24.ref.png |binary
test/recording-surface-pattern.svg.argb32.ref.png |binary
test/recording-surface-pattern.svg.rgb24.ref.png |binary
test/scale-offset-similar.recording.xfail.png |binary
util/cairo-fdr/fdr.c | 8
util/cairo-sphinx/sphinx.c | 38
util/cairo-trace/trace.c | 10
util/trace-to-xml.c | 4
68 files changed, 1845 insertions(+), 1838 deletions(-)
New commits:
commit 43a775f60da57206b194039cd5d8b6a735284c45
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Thu Oct 22 02:13:36 2009 +0300
[meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:
http://lists.cairographics.org/archives/cairo/2009-July/017571.html
diff --git a/NEWS b/NEWS
index f5db417..39beafe 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,10 @@
+API changes:
+
+ cairo_recording_surface_create()
+ cairo_recording_surface_ink_extents()
+
+ Renamed meta-surfaces to recording-surfaces for clarity.
+
Snapshot 1.9.4 (2009-10-15)
===========================
API additions:
diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features
index 3e922ef..5c1e011 100644
--- a/boilerplate/Makefile.win32.features
+++ b/boilerplate/Makefile.win32.features
@@ -314,13 +314,13 @@ enabled_cairo_boilerplate_headers += $(cairo_boilerplate_image_headers)
enabled_cairo_boilerplate_private += $(cairo_boilerplate_image_private)
enabled_cairo_boilerplate_sources += $(cairo_boilerplate_image_sources)
-supported_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers)
-all_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers)
-all_cairo_boilerplate_private += $(cairo_boilerplate_meta_private)
-all_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources)
-enabled_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers)
-enabled_cairo_boilerplate_private += $(cairo_boilerplate_meta_private)
-enabled_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources)
+supported_cairo_boilerplate_headers += $(cairo_boilerplate_recording_headers)
+all_cairo_boilerplate_headers += $(cairo_boilerplate_recording_headers)
+all_cairo_boilerplate_private += $(cairo_boilerplate_recording_private)
+all_cairo_boilerplate_sources += $(cairo_boilerplate_recording_sources)
+enabled_cairo_boilerplate_headers += $(cairo_boilerplate_recording_headers)
+enabled_cairo_boilerplate_private += $(cairo_boilerplate_recording_private)
+enabled_cairo_boilerplate_sources += $(cairo_boilerplate_recording_sources)
supported_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers)
all_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers)
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index 191eb1b..dd14bfa 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -30,8 +30,8 @@
#include <cairo-pdf-surface-private.h>
#include <cairo-paginated-surface-private.h>
-#if ! CAIRO_HAS_META_SURFACE
-#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#if ! CAIRO_HAS_RECORDING_SURFACE
+#define CAIRO_SURFACE_TYPE_RECORDING CAIRO_INTERNAL_SURFACE_TYPE_RECORDING
#endif
static const cairo_user_data_key_t pdf_closure_key;
@@ -241,7 +241,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"pdf", "pdf", ".pdf", NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 0,
"cairo_pdf_surface_create",
_cairo_boilerplate_pdf_create_surface,
_cairo_boilerplate_pdf_force_fallbacks,
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 899a321..2a9bc75 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -31,8 +31,8 @@
#include <cairo-ps-surface-private.h>
#include <cairo-paginated-surface-private.h>
-#if ! CAIRO_HAS_META_SURFACE
-#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#if ! CAIRO_HAS_RECORDING_SURFACE
+#define CAIRO_SURFACE_TYPE_RECORDING CAIRO_INTERNAL_SURFACE_TYPE_RECORDING
#endif
static const cairo_user_data_key_t ps_closure_key;
@@ -306,7 +306,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"ps2", "ps", ".ps", NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 0,
"cairo_ps_surface_create",
_cairo_boilerplate_ps2_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
@@ -331,7 +331,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"ps3", "ps", ".ps", NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 0,
"cairo_ps_surface_create",
_cairo_boilerplate_ps3_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index 316e33d..fb83513 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -35,8 +35,8 @@
#include <signal.h>
#endif
-#if ! CAIRO_HAS_META_SURFACE
-#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META
+#if ! CAIRO_HAS_RECORDING_SURFACE
+#define CAIRO_SURFACE_TYPE_RECORDING CAIRO_INTERNAL_SURFACE_TYPE_RECORDING
#endif
static const cairo_user_data_key_t svg_closure_key;
@@ -286,7 +286,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"svg11", "svg", NULL, NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 1,
"cairo_svg_surface_create",
_cairo_boilerplate_svg11_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
@@ -310,7 +310,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"svg12", "svg", NULL, NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 1,
"cairo_svg_surface_create",
_cairo_boilerplate_svg12_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 7a3a16b..39d4f4f 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -146,7 +146,7 @@ _cairo_boilerplate_test_paginated_create_surface (const char *name,
*
* If we didn't implement this function then the default
* cairo_surface_write_to_png would result in the paginated_surface's
- * acquire_source_image function replaying the meta-surface to an
+ * acquire_source_image function replaying the recording-surface to an
* intermediate image surface. And in that case the
* test_paginated_surface would not be involved and wouldn't be
* tested.
diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c
index ecaac5f..b5a6fed 100644
--- a/boilerplate/cairo-boilerplate-win32-printing.c
+++ b/boilerplate/cairo-boilerplate-win32-printing.c
@@ -357,7 +357,7 @@ static const cairo_boilerplate_target_t targets[] = {
},
{
"win32-printing", "win32", ".ps", NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 0,
"cairo_win32_printing_surface_create",
_cairo_boilerplate_win32_printing_create_surface,
NULL, NULL,
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 1414699..2036a0e 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -149,17 +149,17 @@ _cairo_boilerplate_image_create_surface (const char *name,
return cairo_image_surface_create (format, ceil (width), ceil (height));
}
-#if CAIRO_HAS_META_SURFACE
+#if CAIRO_HAS_RECORDING_SURFACE
static cairo_surface_t *
-_cairo_boilerplate_meta_create_surface (const char *name,
- cairo_content_t content,
- double width,
- double height,
- double max_width,
- double max_height,
- cairo_boilerplate_mode_t mode,
- int id,
- void **closure)
+_cairo_boilerplate_recording_create_surface (const char *name,
+ cairo_content_t content,
+ double width,
+ double height,
+ double max_width,
+ double max_height,
+ cairo_boilerplate_mode_t mode,
+ int id,
+ void **closure)
{
cairo_rectangle_t extents;
@@ -169,7 +169,7 @@ _cairo_boilerplate_meta_create_surface (const char *name,
extents.y = 0;
extents.width = width;
extents.height = height;
- return cairo_meta_surface_create (content, &extents);
+ return cairo_recording_surface_create (content, &extents);
}
#endif
@@ -195,9 +195,9 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src,
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
image = cairo_surface_reference (surface);
- /* open a logging channel (only interesting for meta surfaces) */
-#if CAIRO_HAS_SCRIPT_SURFACE && CAIRO_HAS_META_SURFACE
- if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_META) {
+ /* open a logging channel (only interesting for recording surfaces) */
+#if CAIRO_HAS_SCRIPT_SURFACE && CAIRO_HAS_RECORDING_SURFACE
+ if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_RECORDING) {
const char *test_name;
test_name = cairo_surface_get_user_data (src,
@@ -311,12 +311,12 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png
},
-#if CAIRO_HAS_META_SURFACE
+#if CAIRO_HAS_RECORDING_SURFACE
{
- "meta", "image", NULL, NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR_ALPHA, 0,
- "cairo_meta_surface_create",
- _cairo_boilerplate_meta_create_surface,
+ "recording", "image", NULL, NULL,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_recording_surface_create",
+ _cairo_boilerplate_recording_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png,
@@ -324,10 +324,10 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
FALSE, TRUE
},
{
- "meta", "image", NULL, NULL,
- CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
- "cairo_meta_surface_create",
- _cairo_boilerplate_meta_create_surface,
+ "recording", "image", NULL, NULL,
+ CAIRO_SURFACE_TYPE_RECORDING, CAIRO_CONTENT_COLOR, 0,
+ "cairo_recording_surface_create",
+ _cairo_boilerplate_recording_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png,
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index 82d42e8..91a23fd 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -166,7 +166,7 @@ typedef struct _cairo_boilerplate_target {
cairo_boilerplate_cleanup_t cleanup;
cairo_boilerplate_wait_t synchronize;
cairo_bool_t is_vector;
- cairo_bool_t is_meta;
+ cairo_bool_t is_recording;
} cairo_boilerplate_target_t;
const cairo_boilerplate_target_t *
diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h
index 8585498..7e49cd6 100644
--- a/build/Makefile.win32.features-h
+++ b/build/Makefile.win32.features-h
@@ -93,7 +93,7 @@ ifeq ($(CAIRO_HAS_TEST_SURFACES),1)
@echo "#define CAIRO_HAS_TEST_SURFACES 1" >> src/cairo-features.h
endif
@echo "#define CAIRO_HAS_IMAGE_SURFACE 1" >> src/cairo-features.h
- @echo "#define CAIRO_HAS_META_SURFACE 1" >> src/cairo-features.h
+ @echo "#define CAIRO_HAS_RECORDING_SURFACE 1" >> src/cairo-features.h
@echo "#define CAIRO_HAS_TEE_SURFACE 1" >> src/cairo-features.h
ifeq ($(CAIRO_HAS_XML_SURFACE),1)
@echo "#define CAIRO_HAS_XML_SURFACE 1" >> src/cairo-features.h
diff --git a/configure.ac b/configure.ac
index 12a56ad..2680f21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -617,7 +617,7 @@ CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
dnl ===========================================================================
-CAIRO_ENABLE_SURFACE_BACKEND(meta, meta, always)
+CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, always)
CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, yes, [
use_xml=$have_libz
diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml
index 00d5eff..4503e40 100644
--- a/doc/public/tmpl/cairo-surface.sgml
+++ b/doc/public/tmpl/cairo-surface.sgml
@@ -216,7 +216,7 @@ The Portable Network Graphics image file format (ISO/IEC 15948). Since 1.10
@CAIRO_SURFACE_TYPE_QUARTZ_IMAGE:
@CAIRO_SURFACE_TYPE_SCRIPT:
@CAIRO_SURFACE_TYPE_QT:
- at CAIRO_SURFACE_TYPE_META:
+ at CAIRO_SURFACE_TYPE_RECORDING:
<!-- ##### FUNCTION cairo_surface_get_type ##### -->
<para>
diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c
index f2699fe..44ed209 100644
--- a/perf/cairo-perf-micro.c
+++ b/perf/cairo-perf-micro.c
@@ -63,10 +63,10 @@ typedef struct _cairo_perf_case {
const cairo_perf_case_t perf_cases[];
/* Some targets just aren't that interesting for performance testing,
- * (not least because many of these surface types use a meta-surface
+ * (not least because many of these surface types use a recording-surface
* and as such defer the "real" rendering to later, so our timing
* loops wouldn't count the real work, just the recording by the
- * meta-surface. */
+ * recording-surface. */
static cairo_bool_t
target_is_measurable (const cairo_boilerplate_target_t *target)
{
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index d442b63..dd8cc69 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -61,10 +61,10 @@
#define CAIRO_PERF_STABLE_STD_DEV_COUNT 3
/* Some targets just aren't that interesting for performance testing,
- * (not least because many of these surface types use a meta-surface
+ * (not least because many of these surface types use a recording-surface
* and as such defer the "real" rendering to later, so our timing
* loops wouldn't count the real work, just the recording by the
- * meta-surface. */
+ * recording-surface. */
static cairo_bool_t
target_is_measurable (const cairo_boilerplate_target_t *target)
{
diff --git a/src/Makefile.sources b/src/Makefile.sources
index df95888..1e04ed2 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -67,7 +67,7 @@ cairo_private = \
cairo-image-info-private.h \
cairo-list-private.h \
cairo-malloc-private.h \
- cairo-meta-surface-private.h \
+ cairo-recording-surface-private.h \
cairo-mutex-impl-private.h \
cairo-mutex-list-private.h \
cairo-mutex-private.h \
@@ -122,7 +122,7 @@ cairo_sources = \
cairo-image-surface.c \
cairo-lzw.c \
cairo-matrix.c \
- cairo-meta-surface.c \
+ cairo-recording-surface.c \
cairo-misc.c \
cairo-mutex.c \
cairo-output-stream.c \
diff --git a/src/Makefile.win32.features b/src/Makefile.win32.features
index 4e55642..048c921 100644
--- a/src/Makefile.win32.features
+++ b/src/Makefile.win32.features
@@ -428,13 +428,13 @@ enabled_cairo_headers += $(cairo_image_headers)
enabled_cairo_private += $(cairo_image_private)
enabled_cairo_sources += $(cairo_image_sources)
-supported_cairo_headers += $(cairo_meta_headers)
-all_cairo_headers += $(cairo_meta_headers)
-all_cairo_private += $(cairo_meta_private)
-all_cairo_sources += $(cairo_meta_sources)
-enabled_cairo_headers += $(cairo_meta_headers)
-enabled_cairo_private += $(cairo_meta_private)
-enabled_cairo_sources += $(cairo_meta_sources)
+supported_cairo_headers += $(cairo_recording_headers)
+all_cairo_headers += $(cairo_recording_headers)
+all_cairo_private += $(cairo_recording_private)
+all_cairo_sources += $(cairo_recording_sources)
+enabled_cairo_headers += $(cairo_recording_headers)
+enabled_cairo_private += $(cairo_recording_private)
+enabled_cairo_sources += $(cairo_recording_sources)
supported_cairo_headers += $(cairo_tee_headers)
all_cairo_headers += $(cairo_tee_headers)
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index 5faa1b9..0ba667d 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -38,7 +38,7 @@
#include "cairo-analysis-surface-private.h"
#include "cairo-paginated-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-region-private.h"
typedef struct {
@@ -76,9 +76,9 @@ _cairo_analysis_surface_merge_status (cairo_int_status_t status_a,
status_b == CAIRO_INT_STATUS_IMAGE_FALLBACK)
return CAIRO_INT_STATUS_IMAGE_FALLBACK;
- if (status_a == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN ||
- status_b == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+ if (status_a == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN ||
+ status_b == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
if (status_a == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY ||
status_b == CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY)
@@ -92,8 +92,8 @@ _cairo_analysis_surface_merge_status (cairo_int_status_t status_a,
}
static cairo_int_status_t
-_analyze_meta_surface_pattern (cairo_analysis_surface_t *surface,
- const cairo_pattern_t *pattern)
+_analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
+ const cairo_pattern_t *pattern)
{
const cairo_surface_pattern_t *surface_pattern;
cairo_bool_t old_has_ctm;
@@ -102,7 +102,7 @@ _analyze_meta_surface_pattern (cairo_analysis_surface_t *surface,
assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
surface_pattern = (const cairo_surface_pattern_t *) pattern;
- assert (_cairo_surface_is_meta (surface_pattern->surface));
+ assert (_cairo_surface_is_recording (surface_pattern->surface));
old_ctm = surface->ctm;
old_has_ctm = surface->has_ctm;
@@ -114,7 +114,7 @@ _analyze_meta_surface_pattern (cairo_analysis_surface_t *surface,
cairo_matrix_multiply (&surface->ctm, &p2d, &surface->ctm);
surface->has_ctm = ! _cairo_matrix_is_identity (&surface->ctm);
- status = _cairo_meta_surface_replay_and_create_regions (surface_pattern->surface,
+ status = _cairo_recording_surface_replay_and_create_regions (surface_pattern->surface,
&surface->base);
surface->ctm = old_ctm;
@@ -227,7 +227,7 @@ _add_operation (cairo_analysis_surface_t *surface,
status = cairo_region_union_rectangle (&surface->fallback_region, rect);
/* The status CAIRO_INT_STATUS_IMAGE_FALLBACK is used to indicate
- * unsupported operations to the meta surface as using
+ * unsupported operations to the recording surface as using
* CAIRO_INT_STATUS_UNSUPPORTED would cause cairo-surface to
* invoke the cairo-surface-fallback path then return
* CAIRO_STATUS_SUCCESS.
@@ -315,8 +315,8 @@ _cairo_analysis_surface_paint (void *abstract_surface,
return backend_status;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- backend_status = _analyze_meta_surface_pattern (surface, source);
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ backend_status = _analyze_recording_surface_pattern (surface, source);
_cairo_analysis_surface_operation_extents (surface,
op, source, clip,
@@ -347,15 +347,15 @@ _cairo_analysis_surface_mask (void *abstract_surface,
return backend_status;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN) {
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN) {
cairo_int_status_t backend_source_status = CAIRO_STATUS_SUCCESS;
cairo_int_status_t backend_mask_status = CAIRO_STATUS_SUCCESS;
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
const cairo_surface_pattern_t *surface_pattern = (const cairo_surface_pattern_t *) source;
- if (_cairo_surface_is_meta (surface_pattern->surface)) {
+ if (_cairo_surface_is_recording (surface_pattern->surface)) {
backend_source_status =
- _analyze_meta_surface_pattern (surface, source);
+ _analyze_recording_surface_pattern (surface, source);
if (_cairo_status_is_error (backend_source_status))
return backend_source_status;
}
@@ -363,9 +363,9 @@ _cairo_analysis_surface_mask (void *abstract_surface,
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) mask;
- if (_cairo_surface_is_meta (surface_pattern->surface)) {
+ if (_cairo_surface_is_recording (surface_pattern->surface)) {
backend_mask_status =
- _analyze_meta_surface_pattern (surface, mask);
+ _analyze_recording_surface_pattern (surface, mask);
if (_cairo_status_is_error (backend_mask_status))
return backend_mask_status;
}
@@ -421,8 +421,8 @@ _cairo_analysis_surface_stroke (void *abstract_surface,
return backend_status;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- backend_status = _analyze_meta_surface_pattern (surface, source);
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ backend_status = _analyze_recording_surface_pattern (surface, source);
_cairo_analysis_surface_operation_extents (surface,
op, source, clip,
@@ -485,8 +485,8 @@ _cairo_analysis_surface_fill (void *abstract_surface,
return backend_status;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- backend_status = _analyze_meta_surface_pattern (surface, source);
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ backend_status = _analyze_recording_surface_pattern (surface, source);
_cairo_analysis_surface_operation_extents (surface,
op, source, clip,
@@ -557,8 +557,8 @@ _cairo_analysis_surface_show_glyphs (void *abstract_surface,
backend_status = CAIRO_INT_STATUS_UNSUPPORTED;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- backend_status = _analyze_meta_surface_pattern (surface, source);
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ backend_status = _analyze_recording_surface_pattern (surface, source);
_cairo_analysis_surface_operation_extents (surface,
op, source, clip,
@@ -641,8 +641,8 @@ _cairo_analysis_surface_show_text_glyphs (void *abstract_surface,
backend_status = CAIRO_STATUS_SUCCESS;
}
- if (backend_status == CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN)
- backend_status = _analyze_meta_surface_pattern (surface, source);
+ if (backend_status == CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN)
+ backend_status = _analyze_recording_surface_pattern (surface, source);
_cairo_analysis_surface_operation_extents (surface,
op, source, clip,
diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h
deleted file mode 100644
index 6790eab..0000000
--- a/src/cairo-meta-surface-private.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2005 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Red Hat, Inc.
- *
- * Contributor(s):
- * Kristian Høgsberg <krh at redhat.com>
- * Adrian Johnson <ajohnson at redneon.com>
- */
-
-#ifndef CAIRO_META_SURFACE_H
-#define CAIRO_META_SURFACE_H
-
-#include "cairoint.h"
-#include "cairo-path-fixed-private.h"
-#include "cairo-clip-private.h"
-
-typedef enum {
- /* The 5 basic drawing operations. */
- CAIRO_COMMAND_PAINT,
- CAIRO_COMMAND_MASK,
- CAIRO_COMMAND_STROKE,
- CAIRO_COMMAND_FILL,
- CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
-} cairo_command_type_t;
-
-typedef enum {
- CAIRO_META_REGION_ALL,
- CAIRO_META_REGION_NATIVE,
- CAIRO_META_REGION_IMAGE_FALLBACK
-} cairo_meta_region_type_t;
-
-typedef struct _cairo_command_header {
- cairo_command_type_t type;
- cairo_meta_region_type_t region;
- cairo_operator_t op;
- cairo_clip_t clip;
-} cairo_command_header_t;
-
-typedef struct _cairo_command_paint {
- cairo_command_header_t header;
- cairo_pattern_union_t source;
-} cairo_command_paint_t;
-
-typedef struct _cairo_command_mask {
- cairo_command_header_t header;
- cairo_pattern_union_t source;
- cairo_pattern_union_t mask;
-} cairo_command_mask_t;
-
-typedef struct _cairo_command_stroke {
- cairo_command_header_t header;
- cairo_pattern_union_t source;
- cairo_path_fixed_t path;
- cairo_stroke_style_t style;
- cairo_matrix_t ctm;
- cairo_matrix_t ctm_inverse;
- double tolerance;
- cairo_antialias_t antialias;
-} cairo_command_stroke_t;
-
-typedef struct _cairo_command_fill {
- cairo_command_header_t header;
- cairo_pattern_union_t source;
- cairo_path_fixed_t path;
- cairo_fill_rule_t fill_rule;
- double tolerance;
- cairo_antialias_t antialias;
-} cairo_command_fill_t;
-
-typedef struct _cairo_command_show_text_glyphs {
- cairo_command_header_t header;
- cairo_pattern_union_t source;
- char *utf8;
- int utf8_len;
- cairo_glyph_t *glyphs;
- unsigned int num_glyphs;
- cairo_text_cluster_t *clusters;
- int num_clusters;
- cairo_text_cluster_flags_t cluster_flags;
- cairo_scaled_font_t *scaled_font;
-} cairo_command_show_text_glyphs_t;
-
-typedef union _cairo_command {
- cairo_command_header_t header;
-
- cairo_command_paint_t paint;
- cairo_command_mask_t mask;
- cairo_command_stroke_t stroke;
- cairo_command_fill_t fill;
- cairo_command_show_text_glyphs_t show_text_glyphs;
-} cairo_command_t;
-
-typedef struct _cairo_meta_surface {
- cairo_surface_t base;
-
- cairo_content_t content;
-
- /* A meta-surface is logically unbounded, but when used as a
- * source we need to render it to an image, so we need a size at
- * which to create that image. */
- cairo_rectangle_t extents_pixels;
- cairo_rectangle_int_t extents;
- cairo_bool_t unbounded;
-
- cairo_clip_t clip;
-
- cairo_array_t commands;
- cairo_surface_t *commands_owner;
-
- int replay_start_idx;
-} cairo_meta_surface_t;
-
-slim_hidden_proto (cairo_meta_surface_create);
-
-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,
- cairo_surface_t *target);
-
-cairo_private cairo_status_t
-_cairo_meta_surface_replay_and_create_regions (cairo_surface_t *surface,
- cairo_surface_t *target);
-cairo_private cairo_status_t
-_cairo_meta_surface_replay_region (cairo_surface_t *surface,
- cairo_surface_t *target,
- cairo_meta_region_type_t region);
-
-cairo_private cairo_status_t
-_cairo_meta_surface_get_bbox (cairo_meta_surface_t *meta,
- cairo_box_t *bbox,
- const cairo_matrix_t *transform);
-
-cairo_private cairo_bool_t
-_cairo_surface_is_meta (const cairo_surface_t *surface);
-
-#endif /* CAIRO_META_SURFACE_H */
diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
deleted file mode 100644
index 8abb9ab..0000000
--- a/src/cairo-meta-surface.c
+++ /dev/null
@@ -1,1096 +0,0 @@
-/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
-/* cairo - a vector graphics library with display and print output
- *
- * Copyright © 2005 Red Hat, Inc
- * Copyright © 2007 Adrian Johnson
- *
- * This library is free software; you can redistribute it and/or
- * modify it either under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation
- * (the "LGPL") or, at your option, under the terms of the Mozilla
- * Public License Version 1.1 (the "MPL"). If you do not alter this
- * notice, a recipient may use your version of this file under either
- * the MPL or the LGPL.
- *
- * You should have received a copy of the LGPL along with this library
- * in the file COPYING-LGPL-2.1; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- * You should have received a copy of the MPL along with this library
- * in the file COPYING-MPL-1.1
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
- * OF ANY KIND, either express or implied. See the LGPL or the MPL for
- * the specific language governing rights and limitations.
- *
- * The Original Code is the cairo graphics library.
- *
- * The Initial Developer of the Original Code is Red Hat, Inc.
- *
- * Contributor(s):
- * Kristian Høgsberg <krh at redhat.com>
- * Carl Worth <cworth at cworth.org>
- * Adrian Johnson <ajohnson at redneon.com>
- */
-
-/* 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 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_t *cr;
- *
- * 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
- * useful as you wish to replay against a particular target surface with
- * known bounds. For this case, it is more efficient to specify the target
- * extents to the meta surface upon creation.
- *
- * The recording phase of the meta surface is careful to snapshot all
- * necessary objects (paths, patterns, etc.), in order to achieve
- * accurate replay. The efficiency of the meta surface could be
- * improved by improving the implementation of snapshot for the
- * various objects. For example, it would be nice to have a
- * copy-on-write implementation for _cairo_surface_snapshot.
- */
-
-/* XXX Rename to recording surface */
-
-#include "cairoint.h"
-#include "cairo-analysis-surface-private.h"
-#include "cairo-meta-surface-private.h"
-#include "cairo-clip-private.h"
-#include "cairo-surface-wrapper-private.h"
-
-typedef enum {
- CAIRO_META_REPLAY,
- CAIRO_META_CREATE_REGIONS
-} cairo_meta_replay_type_t;
-
-static const cairo_surface_backend_t cairo_meta_surface_backend;
-
-/* Currently all meta surfaces do have a size which should be passed
- * in as the maximum size of any target surface against which the
- * meta-surface will ever be replayed.
- *
- * XXX: The naming of "pixels" in the size here is a misnomer. It's
- * actually a size in whatever device-space units are desired (again,
- * according to the intended replay target).
- */
-
-/**
- * cairo_meta_surface_create:
- * @content: the content of the meta surface
- * @extents_pixels: the extents to record in pixels, can be %NULL to record
- * unbounded operations.
- *
- * 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 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
- * accurate replay.
- *
- * Since 1.10
- **/
-cairo_surface_t *
-cairo_meta_surface_create (cairo_content_t content,
- const cairo_rectangle_t *extents)
-{
- cairo_meta_surface_t *meta;
- cairo_status_t status;
-
- meta = malloc (sizeof (cairo_meta_surface_t));
- if (unlikely (meta == NULL))
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-
- _cairo_surface_init (&meta->base, &cairo_meta_surface_backend, content);
-
- meta->content = content;
-
- /* unbounded -> 'infinite' extents */
- if (extents != NULL) {
- meta->extents_pixels = *extents;
-
- /* XXX check for overflow */
- meta->extents.x = floor (extents->x);
- meta->extents.y = floor (extents->y);
- meta->extents.width = ceil (extents->x + extents->width) - meta->extents.x;
- meta->extents.height = ceil (extents->y + extents->height) - meta->extents.y;
-
- status = _cairo_clip_init_rectangle (&meta->clip, &meta->extents);
- if (unlikely (status)) {
- free (meta);
- return _cairo_surface_create_in_error (status);
- }
-
- meta->unbounded = FALSE;
- } else {
- meta->unbounded = TRUE;
- _cairo_clip_init (&meta->clip);
- }
-
- _cairo_array_init (&meta->commands, sizeof (cairo_command_t *));
- meta->commands_owner = NULL;
-
- meta->replay_start_idx = 0;
-
- return &meta->base;
-}
-slim_hidden_def (cairo_meta_surface_create);
-
-static cairo_surface_t *
-_cairo_meta_surface_create_similar (void *abstract_surface,
- cairo_content_t content,
- int width,
- int height)
-{
- cairo_rectangle_t extents;
- extents.x = extents.y = 0;
- extents.width = width;
- extents.height = height;
- return cairo_meta_surface_create (content, &extents);
-}
-
-static cairo_status_t
-_cairo_meta_surface_finish (void *abstract_surface)
-{
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_t **elements;
- int i, num_elements;
-
- if (meta->commands_owner) {
- cairo_surface_destroy (meta->commands_owner);
- return CAIRO_STATUS_SUCCESS;
- }
-
- num_elements = meta->commands.num_elements;
- elements = _cairo_array_index (&meta->commands, 0);
- for (i = 0; i < num_elements; i++) {
- cairo_command_t *command = elements[i];
-
- _cairo_clip_reset (&command->header.clip);
-
- switch (command->header.type) {
- case CAIRO_COMMAND_PAINT:
- _cairo_pattern_fini_snapshot (&command->paint.source.base);
- free (command);
- break;
-
- case CAIRO_COMMAND_MASK:
- _cairo_pattern_fini_snapshot (&command->mask.source.base);
- _cairo_pattern_fini_snapshot (&command->mask.mask.base);
- free (command);
- break;
-
- case CAIRO_COMMAND_STROKE:
- _cairo_pattern_fini_snapshot (&command->stroke.source.base);
- _cairo_path_fixed_fini (&command->stroke.path);
- _cairo_stroke_style_fini (&command->stroke.style);
- free (command);
- break;
-
- case CAIRO_COMMAND_FILL:
- _cairo_pattern_fini_snapshot (&command->fill.source.base);
- _cairo_path_fixed_fini (&command->fill.path);
- free (command);
- break;
-
- case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
- _cairo_pattern_fini_snapshot (&command->show_text_glyphs.source.base);
- free (command->show_text_glyphs.utf8);
- free (command->show_text_glyphs.glyphs);
- free (command->show_text_glyphs.clusters);
- cairo_scaled_font_destroy (command->show_text_glyphs.scaled_font);
- free (command);
- break;
-
- default:
- ASSERT_NOT_REACHED;
- }
- }
-
- _cairo_array_fini (&meta->commands);
- _cairo_clip_reset (&meta->clip);
-
- return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_status_t
-_cairo_meta_surface_acquire_source_image (void *abstract_surface,
- cairo_image_surface_t **image_out,
- void **image_extra)
-{
- cairo_status_t status;
- cairo_meta_surface_t *surface = abstract_surface;
- cairo_surface_t *image;
-
- image = _cairo_surface_has_snapshot (&surface->base,
- &_cairo_image_surface_backend,
- surface->content);
- if (image != NULL) {
- *image_out = (cairo_image_surface_t *) cairo_surface_reference (image);
- *image_extra = NULL;
- return CAIRO_STATUS_SUCCESS;
- }
-
- image = _cairo_image_surface_create_with_content (surface->content,
- surface->extents.width,
- surface->extents.height);
- if (unlikely (image->status))
- return image->status;
-
- cairo_surface_set_device_offset (image,
- -surface->extents.x,
- -surface->extents.y);
-
- status = _cairo_meta_surface_replay (&surface->base, image);
- if (unlikely (status)) {
- cairo_surface_destroy (image);
- return status;
- }
-
- status = _cairo_surface_attach_snapshot (&surface->base, image, NULL);
- if (unlikely (status)) {
- cairo_surface_destroy (image);
- return status;
- }
-
- *image_out = (cairo_image_surface_t *) image;
- *image_extra = NULL;
- return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_meta_surface_release_source_image (void *abstract_surface,
- cairo_image_surface_t *image,
- void *image_extra)
-{
- cairo_surface_destroy (&image->base);
-}
-
-static cairo_status_t
-_command_init (cairo_meta_surface_t *meta,
- cairo_command_header_t *command,
- cairo_command_type_t type,
- cairo_operator_t op,
- cairo_clip_t *clip)
-{
- cairo_status_t status = CAIRO_STATUS_SUCCESS;
-
- command->type = type;
- command->op = op;
- command->region = CAIRO_META_REGION_ALL;
- _cairo_clip_init_copy (&command->clip, clip);
- if (meta->clip.path != NULL)
- status = _cairo_clip_apply_clip (&command->clip, &meta->clip);
-
- return status;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_paint (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_clip_t *clip)
-{
- cairo_status_t status;
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_paint_t *command;
-
- command = malloc (sizeof (cairo_command_paint_t));
- if (unlikely (command == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- status = _command_init (meta,
- &command->header, CAIRO_COMMAND_PAINT, op, clip);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->source.base, source);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_array_append (&meta->commands, &command);
- if (unlikely (status))
- goto CLEANUP_SOURCE;
-
- /* An optimisation that takes care to not replay what was done
- * before surface is cleared. We don't erase recorded commands
- * since we may have earlier snapshots of this surface. */
- if (op == CAIRO_OPERATOR_CLEAR && clip == NULL)
- meta->replay_start_idx = meta->commands.num_elements;
-
- return CAIRO_STATUS_SUCCESS;
-
- CLEANUP_SOURCE:
- _cairo_pattern_fini_snapshot (&command->source.base);
- CLEANUP_COMMAND:
- free (command);
- return status;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_mask (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const cairo_pattern_t *mask,
- cairo_clip_t *clip)
-{
- cairo_status_t status;
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_mask_t *command;
-
- command = malloc (sizeof (cairo_command_mask_t));
- if (unlikely (command == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- status = _command_init (meta,
- &command->header, CAIRO_COMMAND_MASK, op, clip);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->source.base, source);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->mask.base, mask);
- if (unlikely (status))
- goto CLEANUP_SOURCE;
-
- status = _cairo_array_append (&meta->commands, &command);
- if (unlikely (status))
- goto CLEANUP_MASK;
-
- return CAIRO_STATUS_SUCCESS;
-
- CLEANUP_MASK:
- _cairo_pattern_fini_snapshot (&command->mask.base);
- CLEANUP_SOURCE:
- _cairo_pattern_fini_snapshot (&command->source.base);
- CLEANUP_COMMAND:
- free (command);
- return status;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_stroke (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- cairo_stroke_style_t *style,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip)
-{
- cairo_status_t status;
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_stroke_t *command;
-
- command = malloc (sizeof (cairo_command_stroke_t));
- if (unlikely (command == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- status = _command_init (meta,
- &command->header, CAIRO_COMMAND_STROKE, op, clip);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->source.base, source);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_path_fixed_init_copy (&command->path, path);
- if (unlikely (status))
- goto CLEANUP_SOURCE;
-
- status = _cairo_stroke_style_init_copy (&command->style, style);
- if (unlikely (status))
- goto CLEANUP_PATH;
-
- command->ctm = *ctm;
- command->ctm_inverse = *ctm_inverse;
- command->tolerance = tolerance;
- command->antialias = antialias;
-
- status = _cairo_array_append (&meta->commands, &command);
- if (unlikely (status))
- goto CLEANUP_STYLE;
-
- return CAIRO_STATUS_SUCCESS;
-
- CLEANUP_STYLE:
- _cairo_stroke_style_fini (&command->style);
- CLEANUP_PATH:
- _cairo_path_fixed_fini (&command->path);
- CLEANUP_SOURCE:
- _cairo_pattern_fini_snapshot (&command->source.base);
- CLEANUP_COMMAND:
- free (command);
- return status;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_fill (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- cairo_path_fixed_t *path,
- cairo_fill_rule_t fill_rule,
- double tolerance,
- cairo_antialias_t antialias,
- cairo_clip_t *clip)
-{
- cairo_status_t status;
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_fill_t *command;
-
- command = malloc (sizeof (cairo_command_fill_t));
- if (unlikely (command == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- status =_command_init (meta,
- &command->header, CAIRO_COMMAND_FILL, op, clip);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->source.base, source);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_path_fixed_init_copy (&command->path, path);
- if (unlikely (status))
- goto CLEANUP_SOURCE;
-
- command->fill_rule = fill_rule;
- command->tolerance = tolerance;
- command->antialias = antialias;
-
- status = _cairo_array_append (&meta->commands, &command);
- if (unlikely (status))
- goto CLEANUP_PATH;
-
- return CAIRO_STATUS_SUCCESS;
-
- CLEANUP_PATH:
- _cairo_path_fixed_fini (&command->path);
- CLEANUP_SOURCE:
- _cairo_pattern_fini_snapshot (&command->source.base);
- CLEANUP_COMMAND:
- free (command);
- return status;
-}
-
-static cairo_bool_t
-_cairo_meta_surface_has_show_text_glyphs (void *abstract_surface)
-{
- return TRUE;
-}
-
-static cairo_int_status_t
-_cairo_meta_surface_show_text_glyphs (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const char *utf8,
- int utf8_len,
- cairo_glyph_t *glyphs,
- int num_glyphs,
- const cairo_text_cluster_t *clusters,
- int num_clusters,
- cairo_text_cluster_flags_t cluster_flags,
- cairo_scaled_font_t *scaled_font,
- cairo_clip_t *clip)
-{
- cairo_status_t status;
- cairo_meta_surface_t *meta = abstract_surface;
- cairo_command_show_text_glyphs_t *command;
-
- command = malloc (sizeof (cairo_command_show_text_glyphs_t));
- if (unlikely (command == NULL))
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
-
- status = _command_init (meta,
- &command->header, CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
- op, clip);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- status = _cairo_pattern_init_snapshot (&command->source.base, source);
- if (unlikely (status))
- goto CLEANUP_COMMAND;
-
- command->utf8 = NULL;
- command->utf8_len = utf8_len;
- command->glyphs = NULL;
- command->num_glyphs = num_glyphs;
- command->clusters = NULL;
- command->num_clusters = num_clusters;
-
- if (utf8_len) {
- command->utf8 = malloc (utf8_len);
- if (unlikely (command->utf8 == NULL)) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- goto CLEANUP_ARRAYS;
- }
- memcpy (command->utf8, utf8, utf8_len);
- }
- if (num_glyphs) {
- command->glyphs = _cairo_malloc_ab (num_glyphs, sizeof (glyphs[0]));
- if (unlikely (command->glyphs == NULL)) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- goto CLEANUP_ARRAYS;
- }
- memcpy (command->glyphs, glyphs, sizeof (glyphs[0]) * num_glyphs);
- }
- if (num_clusters) {
- command->clusters = _cairo_malloc_ab (num_clusters, sizeof (clusters[0]));
- if (unlikely (command->clusters == NULL)) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- goto CLEANUP_ARRAYS;
- }
- memcpy (command->clusters, clusters, sizeof (clusters[0]) * num_clusters);
- }
-
- command->cluster_flags = cluster_flags;
-
- command->scaled_font = cairo_scaled_font_reference (scaled_font);
-
- status = _cairo_array_append (&meta->commands, &command);
- if (unlikely (status))
- goto CLEANUP_SCALED_FONT;
-
- return CAIRO_STATUS_SUCCESS;
-
- CLEANUP_SCALED_FONT:
- cairo_scaled_font_destroy (command->scaled_font);
- CLEANUP_ARRAYS:
- free (command->utf8);
- free (command->glyphs);
- free (command->clusters);
-
- _cairo_pattern_fini_snapshot (&command->source.base);
- CLEANUP_COMMAND:
- free (command);
- return status;
-}
-
-/**
- * _cairo_meta_surface_snapshot
- * @surface: a #cairo_surface_t which must be a meta surface
- *
- * Make an immutable copy of @surface. It is an error to call a
- * surface-modifying function on the result of this function.
- *
- * The caller owns the return value and should call
- * cairo_surface_destroy() when finished with it. This function will not
- * return %NULL, but will return a nil surface instead.
- *
- * Return value: The snapshot surface.
- **/
-static cairo_surface_t *
-_cairo_meta_surface_snapshot (void *abstract_other)
-{
- cairo_meta_surface_t *other = abstract_other;
- cairo_meta_surface_t *meta;
-
- meta = malloc (sizeof (cairo_meta_surface_t));
- if (unlikely (meta == NULL))
- return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-
- _cairo_surface_init (&meta->base, &cairo_meta_surface_backend,
- other->base.content);
-
- meta->extents_pixels = other->extents_pixels;
- meta->extents = other->extents;
- meta->unbounded = other->unbounded;
- meta->replay_start_idx = other->replay_start_idx;
- meta->content = other->content;
-
- _cairo_array_init_snapshot (&meta->commands, &other->commands);
- meta->commands_owner = cairo_surface_reference (&other->base);
-
- _cairo_clip_init_copy (&meta->clip, &other->clip);
-
- return &meta->base;
-}
-
-static cairo_bool_t
-_cairo_meta_surface_get_extents (void *abstract_surface,
- cairo_rectangle_int_t *rectangle)
-{
- cairo_meta_surface_t *surface = abstract_surface;
-
- if (surface->unbounded)
- return FALSE;
-
- *rectangle = surface->extents;
- return TRUE;
-}
-
-/**
- * _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_SURFACE_TYPE_META,
- _cairo_meta_surface_create_similar,
- _cairo_meta_surface_finish,
- _cairo_meta_surface_acquire_source_image,
- _cairo_meta_surface_release_source_image,
- NULL, /* acquire_dest_image */
- NULL, /* release_dest_image */
- NULL, /* clone_similar */
- NULL, /* composite */
- NULL, /* fill_rectangles */
- NULL, /* composite_trapezoids */
- NULL, /* create_span_renderer */
- NULL, /* check_span_renderer */
- NULL, /* copy_page */
- NULL, /* show_page */
- _cairo_meta_surface_get_extents,
- NULL, /* old_show_glyphs */
- NULL, /* get_font_options */
- NULL, /* flush */
- NULL, /* mark_dirty_rectangle */
- NULL, /* scaled_font_fini */
- NULL, /* scaled_glyph_fini */
-
- /* Here are the 5 basic drawing operations, (which are in some
- * sense the only things that cairo_meta_surface should need to
- * implement). However, we implement the more generic show_text_glyphs
- * instead of show_glyphs. One or the other is eough. */
-
- _cairo_meta_surface_paint,
- _cairo_meta_surface_mask,
- _cairo_meta_surface_stroke,
- _cairo_meta_surface_fill,
- NULL,
-
- _cairo_meta_surface_snapshot,
-
- NULL, /* is_similar */
- NULL, /* fill_stroke */
- NULL, /* create_solid_pattern_surface */
- NULL, /* can_repaint_solid_pattern_surface */
-
- _cairo_meta_surface_has_show_text_glyphs,
- _cairo_meta_surface_show_text_glyphs
-};
-
-cairo_int_status_t
-_cairo_meta_surface_get_path (cairo_surface_t *surface,
- cairo_path_fixed_t *path)
-{
- cairo_meta_surface_t *meta;
- cairo_command_t **elements;
- int i, num_elements;
- cairo_int_status_t status;
-
- if (surface->status)
- return surface->status;
-
- meta = (cairo_meta_surface_t *) surface;
- status = CAIRO_STATUS_SUCCESS;
-
- num_elements = meta->commands.num_elements;
- elements = _cairo_array_index (&meta->commands, 0);
- for (i = meta->replay_start_idx; i < num_elements; i++) {
- cairo_command_t *command = elements[i];
-
- switch (command->header.type) {
- case CAIRO_COMMAND_PAINT:
- case CAIRO_COMMAND_MASK:
- status = CAIRO_INT_STATUS_UNSUPPORTED;
- break;
-
- case CAIRO_COMMAND_STROKE:
- {
- cairo_traps_t traps;
-
- _cairo_traps_init (&traps);
-
- /* XXX call cairo_stroke_to_path() when that is implemented */
- status = _cairo_path_fixed_stroke_to_traps (&command->stroke.path,
- &command->stroke.style,
- &command->stroke.ctm,
- &command->stroke.ctm_inverse,
- command->stroke.tolerance,
- &traps);
-
- if (status == CAIRO_STATUS_SUCCESS)
- status = _cairo_traps_path (&traps, path);
-
- _cairo_traps_fini (&traps);
- break;
- }
- case CAIRO_COMMAND_FILL:
- {
- status = _cairo_path_fixed_append (path,
- &command->fill.path, CAIRO_DIRECTION_FORWARD,
- 0, 0);
- break;
- }
- case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
- {
- status = _cairo_scaled_font_glyph_path (command->show_text_glyphs.scaled_font,
- command->show_text_glyphs.glyphs,
- command->show_text_glyphs.num_glyphs,
- path);
- break;
- }
-
- default:
- ASSERT_NOT_REACHED;
- }
-
- if (unlikely (status))
- break;
- }
-
- return _cairo_surface_set_error (surface, status);
-}
-
-#define _clip(c) ((c)->header.clip.path ? &(c)->header.clip : NULL)
-static cairo_status_t
-_cairo_meta_surface_replay_internal (cairo_surface_t *surface,
- cairo_surface_t *target,
- cairo_meta_replay_type_t type,
- cairo_meta_region_type_t region)
-{
- cairo_meta_surface_t *meta;
- cairo_command_t **elements;
- int i, num_elements;
- cairo_int_status_t status;
- cairo_surface_wrapper_t wrapper;
-
- if (unlikely (surface->status))
- return surface->status;
-
- if (unlikely (target->status))
- return _cairo_surface_set_error (surface, target->status);
-
- _cairo_surface_wrapper_init (&wrapper, target);
-
- meta = (cairo_meta_surface_t *) surface;
- status = CAIRO_STATUS_SUCCESS;
-
- num_elements = meta->commands.num_elements;
- elements = _cairo_array_index (&meta->commands, 0);
- for (i = meta->replay_start_idx; i < num_elements; i++) {
- cairo_command_t *command = elements[i];
-
- if (type == CAIRO_META_REPLAY && region != CAIRO_META_REGION_ALL) {
- if (command->header.region != region)
- continue;
- }
-
- switch (command->header.type) {
- case CAIRO_COMMAND_PAINT:
- status = _cairo_surface_wrapper_paint (&wrapper,
- command->header.op,
- &command->paint.source.base,
- _clip (command));
- break;
-
- case CAIRO_COMMAND_MASK:
- status = _cairo_surface_wrapper_mask (&wrapper,
- command->header.op,
- &command->mask.source.base,
- &command->mask.mask.base,
- _clip (command));
- break;
-
- case CAIRO_COMMAND_STROKE:
- {
- status = _cairo_surface_wrapper_stroke (&wrapper,
- command->header.op,
- &command->stroke.source.base,
- &command->stroke.path,
- &command->stroke.style,
- &command->stroke.ctm,
- &command->stroke.ctm_inverse,
- command->stroke.tolerance,
- command->stroke.antialias,
- _clip (command));
- break;
- }
- case CAIRO_COMMAND_FILL:
- {
- cairo_command_t *stroke_command;
-
- stroke_command = NULL;
- if (type != CAIRO_META_CREATE_REGIONS && i < num_elements - 1)
- stroke_command = elements[i + 1];
-
- if (stroke_command != NULL &&
- type == CAIRO_META_REPLAY &&
- region != CAIRO_META_REGION_ALL)
- {
- if (stroke_command->header.region != region)
- stroke_command = NULL;
- }
-
- if (stroke_command != NULL &&
- stroke_command->header.type == CAIRO_COMMAND_STROKE &&
- _cairo_path_fixed_is_equal (&command->fill.path,
- &stroke_command->stroke.path))
- {
- status = _cairo_surface_wrapper_fill_stroke (&wrapper,
- command->header.op,
- &command->fill.source.base,
- command->fill.fill_rule,
- command->fill.tolerance,
- command->fill.antialias,
- &command->fill.path,
- stroke_command->header.op,
- &stroke_command->stroke.source.base,
- &stroke_command->stroke.style,
- &stroke_command->stroke.ctm,
- &stroke_command->stroke.ctm_inverse,
- stroke_command->stroke.tolerance,
- stroke_command->stroke.antialias,
- _clip (command));
- i++;
- }
- else
- {
- status = _cairo_surface_wrapper_fill (&wrapper,
- command->header.op,
- &command->fill.source.base,
- &command->fill.path,
- command->fill.fill_rule,
- command->fill.tolerance,
- command->fill.antialias,
- _clip (command));
- }
- break;
- }
- case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
- {
- cairo_glyph_t *glyphs = command->show_text_glyphs.glyphs;
- cairo_glyph_t *glyphs_copy;
- int num_glyphs = command->show_text_glyphs.num_glyphs;
-
- /* show_text_glyphs is special because _cairo_surface_show_text_glyphs is allowed
- * to modify the glyph array that's passed in. We must always
- * copy the array before handing it to the backend.
- */
- glyphs_copy = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
- if (unlikely (glyphs_copy == NULL)) {
- status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
- break;
- }
-
- memcpy (glyphs_copy, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
-
- status = _cairo_surface_wrapper_show_text_glyphs (&wrapper,
- command->header.op,
- &command->show_text_glyphs.source.base,
- command->show_text_glyphs.utf8, command->show_text_glyphs.utf8_len,
- glyphs_copy, num_glyphs,
- command->show_text_glyphs.clusters, command->show_text_glyphs.num_clusters,
- command->show_text_glyphs.cluster_flags,
- command->show_text_glyphs.scaled_font,
- _clip (command));
- free (glyphs_copy);
- break;
- }
- default:
- ASSERT_NOT_REACHED;
- }
-
- if (type == CAIRO_META_CREATE_REGIONS) {
- if (status == CAIRO_STATUS_SUCCESS) {
- command->header.region = CAIRO_META_REGION_NATIVE;
- } else if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK) {
- command->header.region = CAIRO_META_REGION_IMAGE_FALLBACK;
- status = CAIRO_STATUS_SUCCESS;
- } else {
- assert (_cairo_status_is_error (status));
- }
- }
-
- if (unlikely (status))
- break;
- }
-
- /* free up any caches */
- for (i = meta->replay_start_idx; i < num_elements; i++) {
- cairo_command_t *command = elements[i];
-
- _cairo_clip_drop_cache (&command->header.clip);
- }
-
- _cairo_surface_wrapper_fini (&wrapper);
-
- return _cairo_surface_set_error (surface, status);
-}
-
-/**
- * _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
- * @height_pixels: height of the surface, in pixels
- *
- * A meta surface can be "replayed" against any target 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.
- **/
-cairo_status_t
-_cairo_meta_surface_replay (cairo_surface_t *surface,
- cairo_surface_t *target)
-{
- return _cairo_meta_surface_replay_internal (surface,
- target,
- CAIRO_META_REPLAY,
- CAIRO_META_REGION_ALL);
-}
-
-/* Replay meta to surface. When the return status of each operation is
- * one of %CAIRO_STATUS_SUCCESS, %CAIRO_INT_STATUS_UNSUPPORTED, or
- * %CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY the status of each operation
- * will be stored in the meta surface. Any other status will abort the
- * replay and return the status.
- */
-cairo_status_t
-_cairo_meta_surface_replay_and_create_regions (cairo_surface_t *surface,
- cairo_surface_t *target)
-{
- return _cairo_meta_surface_replay_internal (surface,
- target,
- CAIRO_META_CREATE_REGIONS,
- CAIRO_META_REGION_ALL);
-}
-
-cairo_status_t
-_cairo_meta_surface_replay_region (cairo_surface_t *surface,
- cairo_surface_t *target,
- cairo_meta_region_type_t region)
-{
- return _cairo_meta_surface_replay_internal (surface,
- target,
- CAIRO_META_REPLAY,
- region);
-}
-
-static cairo_status_t
-_meta_surface_get_ink_bbox (cairo_meta_surface_t *surface,
- cairo_box_t *bbox,
- const cairo_matrix_t *transform)
-{
- cairo_surface_t *null_surface;
- cairo_surface_t *analysis_surface;
- cairo_status_t status;
-
- null_surface = _cairo_null_surface_create (surface->content);
- analysis_surface = _cairo_analysis_surface_create (null_surface);
- cairo_surface_destroy (null_surface);
-
- status = analysis_surface->status;
- if (unlikely (status))
- return status;
-
- if (transform != NULL)
- _cairo_analysis_surface_set_ctm (analysis_surface, transform);
-
- status = _cairo_meta_surface_replay (&surface->base, analysis_surface);
- _cairo_analysis_surface_get_bounding_box (analysis_surface, bbox);
- cairo_surface_destroy (analysis_surface);
-
- return status;
-}
-
-/**
- * cairo_meta_surface_ink_extents:
- * @surface: a #cairo_meta_surface_t
- * @x0: the x-coordinate of the top-left of the ink bounding box
- * @y0: the y-coordinate of the top-left of the ink bounding box
- * @width: the width of the ink bounding box
- * @height: the height of the ink bounding box
- *
- * Measures the extents of the operations stored within the meta-surface.
- * This is useful to compute the required size of an image surface (or
- * equivalent) into which to replay the full sequence of drawing operations.
- *
- * Since: 1.10
- **/
-void
-cairo_meta_surface_ink_extents (cairo_surface_t *surface,
- double *x0,
- double *y0,
- double *width,
- double *height)
-{
- cairo_status_t status;
- cairo_box_t bbox;
-
- memset (&bbox, 0, sizeof (bbox));
-
- if (! _cairo_surface_is_meta (surface)) {
- _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
- goto DONE;
- }
-
- status = _meta_surface_get_ink_bbox ((cairo_meta_surface_t *) surface,
- &bbox,
- NULL);
- if (unlikely (status))
- status = _cairo_surface_set_error (surface, status);
-
-DONE:
- if (x0)
- *x0 = _cairo_fixed_to_double (bbox.p1.x);
- if (y0)
- *y0 = _cairo_fixed_to_double (bbox.p1.y);
- if (width)
- *width = _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x);
- if (height)
- *height = _cairo_fixed_to_double (bbox.p2.y - bbox.p1.y);
-}
-
-cairo_status_t
-_cairo_meta_surface_get_bbox (cairo_meta_surface_t *surface,
- cairo_box_t *bbox,
- const cairo_matrix_t *transform)
-{
- if (! surface->unbounded) {
- _cairo_box_from_rectangle (bbox, &surface->extents);
- if (transform != NULL)
- _cairo_matrix_transform_bounding_box_fixed (transform, bbox, NULL);
-
- return CAIRO_STATUS_SUCCESS;
- }
-
- return _meta_surface_get_ink_bbox (surface, bbox, transform);
-}
diff --git a/src/cairo-paginated-private.h b/src/cairo-paginated-private.h
index 0841a2b..33358b9 100644
--- a/src/cairo-paginated-private.h
+++ b/src/cairo-paginated-private.h
@@ -98,7 +98,7 @@ struct _cairo_paginated_surface_backend {
* to follow.
*
* What the paginated surface does is first save all drawing
- * operations for a page into a meta-surface. Then when the user calls
+ * operations for a page into a recording-surface. Then when the user calls
* cairo_show_page(), the paginated surface performs the following
* sequence of operations (using the backend functions passed to
* cairo_paginated_surface_create()):
@@ -109,7 +109,7 @@ struct _cairo_paginated_surface_backend {
*
* 2. Calls set_paginated_mode() with an argument of %CAIRO_PAGINATED_MODE_ANALYZE
*
- * 3. Replays the meta-surface to the target surface, (with an
+ * 3. Replays the recording-surface to the target surface, (with an
* analysis surface inserted between which watches the return value
* from each operation). This analysis stage is used to decide which
* operations will require fallbacks.
@@ -119,7 +119,7 @@ struct _cairo_paginated_surface_backend {
*
* 5. Calls set_paginated_mode() with an argument of %CAIRO_PAGINATED_MODE_RENDER
*
- * 6. Replays a subset of the meta-surface operations to the target surface
+ * 6. Replays a subset of the recording-surface operations to the target surface
*
* 7. Calls set_paginated_mode() with an argument of %CAIRO_PAGINATED_MODE_FALLBACK
*
diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index 6c13072..a494e58 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -51,10 +51,10 @@ typedef struct _cairo_paginated_surface {
/* Paginated-surface specific functions for the target */
const cairo_paginated_surface_backend_t *backend;
- /* A cairo_meta_surface to record all operations. To be replayed
+ /* A cairo_recording_surface to record all operations. To be replayed
* against target, and also against image surface as necessary for
* fallbacks. */
- cairo_surface_t *meta;
+ cairo_surface_t *recording_surface;
int page_num;
cairo_bool_t page_is_blank;
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 680bcf5..dff5e83 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -46,7 +46,7 @@
#include "cairo-paginated-private.h"
#include "cairo-paginated-surface-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-analysis-surface-private.h"
static const cairo_surface_backend_t cairo_paginated_surface_backend;
@@ -64,26 +64,26 @@ _cairo_paginated_surface_create_similar (void *abstract_surface,
rect.x = rect.y = 0.;
rect.width = width;
rect.height = height;
- return cairo_meta_surface_create (content, &rect);
+ return cairo_recording_surface_create (content, &rect);
}
static cairo_surface_t *
-_create_meta_surface_for_target (cairo_surface_t *target,
- cairo_content_t content)
+_create_recording_surface_for_target (cairo_surface_t *target,
+ cairo_content_t content)
{
cairo_rectangle_int_t rect;
if (_cairo_surface_get_extents (target, &rect)) {
- cairo_rectangle_t meta_extents;
+ cairo_rectangle_t recording_extents;
- meta_extents.x = rect.x;
- meta_extents.y = rect.y;
- meta_extents.width = rect.width;
- meta_extents.height = rect.height;
+ recording_extents.x = rect.x;
+ recording_extents.y = rect.y;
+ recording_extents.width = rect.width;
+ recording_extents.height = rect.height;
- return cairo_meta_surface_create (content, &meta_extents);
+ return cairo_recording_surface_create (content, &recording_extents);
} else {
- return cairo_meta_surface_create (content, NULL);
+ return cairo_recording_surface_create (content, NULL);
}
}
@@ -113,8 +113,8 @@ _cairo_paginated_surface_create (cairo_surface_t *target,
surface->content = content;
surface->backend = backend;
- surface->meta = _create_meta_surface_for_target (target, content);
- status = surface->meta->status;
+ surface->recording_surface = _create_recording_surface_for_target (target, content);
+ status = surface->recording_surface->status;
if (unlikely (status))
goto FAIL_CLEANUP_SURFACE;
@@ -171,10 +171,10 @@ _cairo_paginated_surface_finish (void *abstract_surface)
}
cairo_surface_destroy (surface->target);
- cairo_surface_finish (surface->meta);
+ cairo_surface_finish (surface->recording_surface);
if (status == CAIRO_STATUS_SUCCESS)
- status = cairo_surface_status (surface->meta);
- cairo_surface_destroy (surface->meta);
+ status = cairo_surface_status (surface->recording_surface);
+ cairo_surface_destroy (surface->recording_surface);
return status;
}
@@ -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_recording_surface_replay (surface->recording_surface, 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_recording_surface_replay (surface->recording_surface, image);
if (unlikely (status))
goto CLEANUP_IMAGE;
@@ -305,8 +305,8 @@ _paint_page (cairo_paginated_surface_t *surface)
surface->backend->set_paginated_mode (surface->target,
CAIRO_PAGINATED_MODE_ANALYZE);
- status = _cairo_meta_surface_replay_and_create_regions (surface->meta,
- analysis);
+ status = _cairo_recording_surface_replay_and_create_regions (surface->recording_surface,
+ analysis);
if (status || analysis->status) {
if (status == CAIRO_STATUS_SUCCESS)
status = analysis->status;
@@ -356,9 +356,9 @@ _paint_page (cairo_paginated_surface_t *surface)
surface->backend->set_paginated_mode (surface->target,
CAIRO_PAGINATED_MODE_RENDER);
- status = _cairo_meta_surface_replay_region (surface->meta,
- surface->target,
- CAIRO_META_REGION_NATIVE);
+ status = _cairo_recording_surface_replay_region (surface->recording_surface,
+ surface->target,
+ CAIRO_RECORDING_REGION_NATIVE);
assert (status != CAIRO_INT_STATUS_UNSUPPORTED);
if (unlikely (status))
goto FAIL;
@@ -442,7 +442,7 @@ _cairo_paginated_surface_copy_page (void *abstract_surface)
* optimization for the output, but the interaction with image
* fallbacks gets tricky. For now, we just let the target see a
* show_page and we implement the copying by simply not destroying
- * the meta-surface. */
+ * the recording-surface. */
cairo_surface_show_page (surface->target);
return cairo_surface_status (surface->target);
@@ -467,15 +467,15 @@ _cairo_paginated_surface_show_page (void *abstract_surface)
if (unlikely (status))
return status;
- status = surface->meta->status;
+ status = surface->recording_surface->status;
if (unlikely (status))
return status;
- cairo_surface_destroy (surface->meta);
+ cairo_surface_destroy (surface->recording_surface);
- surface->meta = _create_meta_surface_for_target (surface->target,
- surface->content);
- status = surface->meta->status;
+ surface->recording_surface = _create_recording_surface_for_target (surface->target,
+ surface->content);
+ status = surface->recording_surface->status;
if (unlikely (status))
return status;
@@ -517,7 +517,7 @@ _cairo_paginated_surface_paint (void *abstract_surface,
surface->page_is_blank = FALSE;
- return _cairo_surface_paint (surface->meta, op, source, clip);
+ return _cairo_surface_paint (surface->recording_surface, op, source, clip);
}
static cairo_int_status_t
@@ -535,7 +535,7 @@ _cairo_paginated_surface_mask (void *abstract_surface,
surface->page_is_blank = FALSE;
- return _cairo_surface_mask (surface->meta, op, source, mask, clip);
+ return _cairo_surface_mask (surface->recording_surface, op, source, mask, clip);
}
static cairo_int_status_t
@@ -558,7 +558,7 @@ _cairo_paginated_surface_stroke (void *abstract_surface,
surface->page_is_blank = FALSE;
- return _cairo_surface_stroke (surface->meta, op, source,
+ return _cairo_surface_stroke (surface->recording_surface, op, source,
path, style,
ctm, ctm_inverse,
tolerance, antialias,
@@ -583,7 +583,7 @@ _cairo_paginated_surface_fill (void *abstract_surface,
surface->page_is_blank = FALSE;
- return _cairo_surface_fill (surface->meta, op, source,
+ return _cairo_surface_fill (surface->recording_surface, op, source,
path, fill_rule,
tolerance, antialias,
clip);
@@ -598,18 +598,18 @@ _cairo_paginated_surface_has_show_text_glyphs (void *abstract_surface)
}
static cairo_int_status_t
-_cairo_paginated_surface_show_text_glyphs (void *abstract_surface,
- cairo_operator_t op,
- const cairo_pattern_t *source,
- const char *utf8,
- int utf8_len,
- cairo_glyph_t *glyphs,
- int num_glyphs,
+_cairo_paginated_surface_show_text_glyphs (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const char *utf8,
+ int utf8_len,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
const cairo_text_cluster_t *clusters,
- int num_clusters,
- cairo_text_cluster_flags_t cluster_flags,
- cairo_scaled_font_t *scaled_font,
- cairo_clip_t *clip)
+ int num_clusters,
+ cairo_text_cluster_flags_t cluster_flags,
+ cairo_scaled_font_t *scaled_font,
+ cairo_clip_t *clip)
{
cairo_paginated_surface_t *surface = abstract_surface;
@@ -619,7 +619,7 @@ _cairo_paginated_surface_show_text_glyphs (void *abstract_surface,
surface->page_is_blank = FALSE;
- return _cairo_surface_show_text_glyphs (surface->meta, op, source,
+ return _cairo_surface_show_text_glyphs (surface->recording_surface, op, source,
utf8, utf8_len,
glyphs, num_glyphs,
clusters, num_clusters,
@@ -633,7 +633,7 @@ _cairo_paginated_surface_snapshot (void *abstract_other)
{
cairo_paginated_surface_t *other = abstract_other;
- return _cairo_surface_snapshot (other->meta);
+ return _cairo_surface_snapshot (other->recording_surface);
}
static const cairo_surface_backend_t cairo_paginated_surface_backend = {
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index a566183..cf6dab2 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -333,7 +333,7 @@ void
_cairo_pattern_fini_snapshot (cairo_pattern_t *pattern)
{
/* XXX this is quite ugly, but currently necessary to break the circular
- * references with snapshot-cow and the meta-surface.
+ * references with snapshot-cow and the recording-surface.
* This operation remains safe only whilst _cairo_surface_snapshot() is
* not public...
*/
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 60ebfe5..cdf3874 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -46,7 +46,7 @@
#include "cairo-pdf-operators-private.h"
#include "cairo-analysis-surface-private.h"
#include "cairo-image-info-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-paginated-private.h"
#include "cairo-scaled-font-subsets-private.h"
@@ -1046,11 +1046,11 @@ _get_source_surface_size (cairo_surface_t *source,
const unsigned char *mime_data;
unsigned int mime_data_length;
- if (_cairo_surface_is_meta (source)) {
- cairo_meta_surface_t *meta_surface = (cairo_meta_surface_t *) source;
+ if (_cairo_surface_is_recording (source)) {
+ cairo_recording_surface_t *recording_surface = (cairo_recording_surface_t *) source;
cairo_box_t bbox;
- status = _cairo_meta_surface_get_bbox (meta_surface, &bbox, NULL);
+ status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL);
if (unlikely (status))
return status;
@@ -2198,18 +2198,18 @@ BAIL:
static cairo_status_t
-_cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
- cairo_surface_t *meta_surface,
- cairo_pdf_resource_t resource)
+_cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t *surface,
+ cairo_surface_t *recording_surface,
+ cairo_pdf_resource_t resource)
{
double old_width, old_height;
cairo_paginated_mode_t old_paginated_mode;
- cairo_rectangle_int_t meta_extents;
+ cairo_rectangle_int_t recording_extents;
cairo_bool_t is_bounded;
cairo_status_t status;
int alpha = 0;
- is_bounded = _cairo_surface_get_extents (meta_surface, &meta_extents);
+ is_bounded = _cairo_surface_get_extents (recording_surface, &recording_extents);
assert (is_bounded);
old_width = surface->width;
@@ -2217,10 +2217,10 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
old_paginated_mode = surface->paginated_mode;
_cairo_pdf_surface_set_size_internal (surface,
- meta_extents.width,
- meta_extents.height);
+ recording_extents.width,
+ recording_extents.height);
/* Patterns are emitted after fallback images. The paginated mode
- * needs to be set to _RENDER while the meta surface is replayed
+ * needs to be set to _RENDER while the recording surface is replayed
* back to this surface.
*/
surface->paginated_mode = CAIRO_PAGINATED_MODE_RENDER;
@@ -2229,7 +2229,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
if (unlikely (status))
return status;
- if (cairo_surface_get_content (meta_surface) == CAIRO_CONTENT_COLOR) {
+ if (cairo_surface_get_content (recording_surface) == CAIRO_CONTENT_COLOR) {
status = _cairo_pdf_surface_add_alpha (surface, 1.0, &alpha);
if (unlikely (status))
return status;
@@ -2241,8 +2241,8 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
surface->height);
}
- status = _cairo_meta_surface_replay_region (meta_surface, &surface->base,
- CAIRO_META_REGION_NATIVE);
+ status = _cairo_recording_surface_replay_region (recording_surface, &surface->base,
+ CAIRO_RECORDING_REGION_NATIVE);
assert (status != CAIRO_INT_STATUS_UNSUPPORTED);
if (unlikely (status))
return status;
@@ -2261,8 +2261,8 @@ static cairo_status_t
_cairo_pdf_surface_emit_surface (cairo_pdf_surface_t *surface,
cairo_pdf_source_surface_t *src_surface)
{
- if (_cairo_surface_is_meta (src_surface->surface)) {
- return _cairo_pdf_surface_emit_meta_surface (surface,
+ if (_cairo_surface_is_recording (src_surface->surface)) {
+ return _cairo_pdf_surface_emit_recording_surface (surface,
src_surface->surface,
src_surface->hash_entry->surface_res);
} else {
@@ -2291,7 +2291,7 @@ _cairo_pdf_surface_emit_surface_pattern (cairo_pdf_surface_t *surface,
char draw_surface[200];
if (pattern->base.extend == CAIRO_EXTEND_PAD &&
- ! _cairo_surface_is_meta (pattern->surface))
+ ! _cairo_surface_is_recording (pattern->surface))
{
status = _cairo_pdf_surface_emit_padded_image_surface (surface,
pdf_pattern,
@@ -2422,7 +2422,7 @@ _cairo_pdf_surface_emit_surface_pattern (cairo_pdf_surface_t *surface,
if (unlikely (status))
return status;
- if (_cairo_surface_is_meta (pattern->surface)) {
+ if (_cairo_surface_is_recording (pattern->surface)) {
snprintf(draw_surface,
sizeof (draw_surface),
"/x%d Do\n",
@@ -3293,7 +3293,7 @@ _cairo_pdf_surface_paint_surface_pattern (cairo_pdf_surface_t *surface,
cairo_matrix_multiply (&pdf_p2d, &cairo_p2d, &pdf_p2d);
cairo_matrix_translate (&pdf_p2d, 0.0, height);
cairo_matrix_scale (&pdf_p2d, 1.0, -1.0);
- if (! _cairo_surface_is_meta (source->surface))
+ if (! _cairo_surface_is_recording (source->surface))
cairo_matrix_scale (&pdf_p2d, width, height);
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
@@ -4935,7 +4935,7 @@ _cairo_pdf_surface_write_patterns_and_smask_groups (cairo_pdf_surface_t *surface
* to be appended to surface->smask_groups. Additional patterns
* may also be appended to surface->patterns.
*
- * Writing meta surface patterns will cause additional patterns
+ * Writing recording surface patterns will cause additional patterns
* and groups to be appended.
*/
pattern_index = 0;
@@ -5091,7 +5091,7 @@ _surface_pattern_supported (cairo_surface_pattern_t *pattern)
{
cairo_extend_t extend;
- if (_cairo_surface_is_meta (pattern->surface))
+ if (_cairo_surface_is_recording (pattern->surface))
return TRUE;
if (pattern->surface->backend->acquire_source_image == NULL)
@@ -5230,11 +5230,11 @@ _cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t *surface,
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
- if ( _cairo_surface_is_meta (surface_pattern->surface)) {
+ if ( _cairo_surface_is_recording (surface_pattern->surface)) {
if (pattern->extend == CAIRO_EXTEND_PAD)
return CAIRO_INT_STATUS_UNSUPPORTED;
else
- return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+ return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
}
}
@@ -5248,14 +5248,14 @@ _cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t *surface,
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
- if (_cairo_surface_is_meta (surface_pattern->surface)) {
+ if (_cairo_surface_is_recording (surface_pattern->surface)) {
if (_cairo_pattern_is_opaque (pattern)) {
- return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+ return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
} else {
/* FIXME: The analysis surface does not yet have
- * the capability to analyze a non opaque meta
+ * the capability to analyze a non opaque recording
* surface and mark it supported if there is
- * nothing underneath. For now meta surfaces of
+ * nothing underneath. For now recording surfaces of
* type CONTENT_COLOR_ALPHA painted with
* OPERATOR_SOURCE will result in a fallback
* image. */
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 0ef787c..6785c12 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -60,7 +60,7 @@
#include "cairo-pdf-operators-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-paginated-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-surface-clipper-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-type3-glyph-surface-private.h"
@@ -1648,7 +1648,7 @@ _cairo_ps_surface_analyze_surface_pattern_transparency (cairo_ps_surface_t
static cairo_bool_t
surface_pattern_supported (const cairo_surface_pattern_t *pattern)
{
- if (_cairo_surface_is_meta (pattern->surface))
+ if (_cairo_surface_is_recording (pattern->surface))
return TRUE;
if (pattern->surface->backend->acquire_source_image == NULL)
@@ -1758,11 +1758,11 @@ _cairo_ps_surface_analyze_operation (cairo_ps_surface_t *surface,
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
- if ( _cairo_surface_is_meta (surface_pattern->surface)) {
+ if ( _cairo_surface_is_recording (surface_pattern->surface)) {
if (pattern->extend == CAIRO_EXTEND_PAD)
return CAIRO_INT_STATUS_UNSUPPORTED;
else
- return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+ return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
}
}
@@ -1963,7 +1963,7 @@ _base85_array_stream_create (cairo_output_stream_t *output)
}
-/* PS Output - this section handles output of the parts of the meta
+/* PS Output - this section handles output of the parts of the recording
* surface we can render natively in PS. */
static cairo_status_t
@@ -2402,8 +2402,8 @@ _cairo_ps_surface_emit_jpeg_image (cairo_ps_surface_t *surface,
}
static cairo_status_t
-_cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
- cairo_surface_t *meta_surface)
+_cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface,
+ cairo_surface_t *recording_surface)
{
double old_width, old_height;
cairo_matrix_t old_cairo_to_ps;
@@ -2419,15 +2419,15 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
old_cairo_to_ps = surface->cairo_to_ps;
status =
- _cairo_meta_surface_get_bbox ((cairo_meta_surface_t *) meta_surface,
- &bbox,
- NULL);
+ _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface,
+ &bbox,
+ NULL);
if (unlikely (status))
return status;
#if DEBUG_PS
_cairo_output_stream_printf (surface->stream,
- "%% _cairo_ps_surface_emit_meta_surface (%f, %f), (%f, %f)\n",
+ "%% _cairo_ps_surface_emit_recording_surface (%f, %f), (%f, %f)\n",
_cairo_fixed_to_double (bbox.p1.x),
_cairo_fixed_to_double (bbox.p1.y),
_cairo_fixed_to_double (bbox.p2.x),
@@ -2445,7 +2445,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
&surface->cairo_to_ps);
_cairo_output_stream_printf (surface->stream, " q\n");
- if (cairo_surface_get_content (meta_surface) == CAIRO_CONTENT_COLOR) {
+ if (cairo_surface_get_content (recording_surface) == CAIRO_CONTENT_COLOR) {
surface->content = CAIRO_CONTENT_COLOR;
_cairo_output_stream_printf (surface->stream,
" 0 g %d %d %d %d rectfill\n",
@@ -2455,8 +2455,8 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t *surface,
surface->page_bbox.height);
}
- status = _cairo_meta_surface_replay_region (meta_surface, &surface->base,
- CAIRO_META_REGION_NATIVE);
+ status = _cairo_recording_surface_replay_region (recording_surface, &surface->base,
+ CAIRO_RECORDING_REGION_NATIVE);
assert (status != CAIRO_INT_STATUS_UNSUPPORTED);
if (unlikely (status))
return status;
@@ -2539,12 +2539,12 @@ _cairo_ps_surface_acquire_surface (cairo_ps_surface_t *surface,
surface->acquired_image = NULL;
surface->image = NULL;
- if (_cairo_surface_is_meta (pattern->surface)) {
- cairo_meta_surface_t *meta_surface = (cairo_meta_surface_t *) pattern->surface;
+ if (_cairo_surface_is_recording (pattern->surface)) {
+ cairo_recording_surface_t *recording_surface = (cairo_recording_surface_t *) pattern->surface;
cairo_box_t bbox;
cairo_rectangle_int_t extents;
- status = _cairo_meta_surface_get_bbox (meta_surface, &bbox, NULL);
+ status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL);
if (unlikely (status))
return status;
@@ -2624,10 +2624,10 @@ _cairo_ps_surface_emit_surface (cairo_ps_surface_t *surface,
{
cairo_status_t status;
- if (_cairo_surface_is_meta (pattern->surface)) {
- cairo_surface_t *meta_surface = pattern->surface;
+ if (_cairo_surface_is_recording (pattern->surface)) {
+ cairo_surface_t *recording_surface = pattern->surface;
- status = _cairo_ps_surface_emit_meta_surface (surface, meta_surface);
+ status = _cairo_ps_surface_emit_recording_surface (surface, recording_surface);
} else {
if (pattern->base.extend != CAIRO_EXTEND_PAD) {
status = _cairo_ps_surface_emit_jpeg_image (surface, pattern->surface,
@@ -2650,7 +2650,7 @@ _cairo_ps_surface_release_surface (cairo_ps_surface_t *surface,
if (surface->image != surface->acquired_image)
cairo_surface_destroy (&surface->image->base);
- if (! _cairo_surface_is_meta (pattern->surface)) {
+ if (! _cairo_surface_is_recording (pattern->surface)) {
_cairo_surface_release_source_image (pattern->surface,
surface->acquired_image,
surface->image_extra);
diff --git a/src/cairo-recording-surface-private.h b/src/cairo-recording-surface-private.h
new file mode 100644
index 0000000..f0824f5
--- /dev/null
+++ b/src/cairo-recording-surface-private.h
@@ -0,0 +1,171 @@
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Kristian Høgsberg <krh at redhat.com>
+ * Adrian Johnson <ajohnson at redneon.com>
+ */
+
+#ifndef CAIRO_RECORDING_SURFACE_H
+#define CAIRO_RECORDING_SURFACE_H
+
+#include "cairoint.h"
+#include "cairo-path-fixed-private.h"
+#include "cairo-clip-private.h"
+
+typedef enum {
+ /* The 5 basic drawing operations. */
+ CAIRO_COMMAND_PAINT,
+ CAIRO_COMMAND_MASK,
+ CAIRO_COMMAND_STROKE,
+ CAIRO_COMMAND_FILL,
+ CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
+} cairo_command_type_t;
+
+typedef enum {
+ CAIRO_RECORDING_REGION_ALL,
+ CAIRO_RECORDING_REGION_NATIVE,
+ CAIRO_RECORDING_REGION_IMAGE_FALLBACK
+} cairo_recording_region_type_t;
+
+typedef struct _cairo_command_header {
+ cairo_command_type_t type;
+ cairo_recording_region_type_t region;
+ cairo_operator_t op;
+ cairo_clip_t clip;
+} cairo_command_header_t;
+
+typedef struct _cairo_command_paint {
+ cairo_command_header_t header;
+ cairo_pattern_union_t source;
+} cairo_command_paint_t;
+
+typedef struct _cairo_command_mask {
+ cairo_command_header_t header;
+ cairo_pattern_union_t source;
+ cairo_pattern_union_t mask;
+} cairo_command_mask_t;
+
+typedef struct _cairo_command_stroke {
+ cairo_command_header_t header;
+ cairo_pattern_union_t source;
+ cairo_path_fixed_t path;
+ cairo_stroke_style_t style;
+ cairo_matrix_t ctm;
+ cairo_matrix_t ctm_inverse;
+ double tolerance;
+ cairo_antialias_t antialias;
+} cairo_command_stroke_t;
+
+typedef struct _cairo_command_fill {
+ cairo_command_header_t header;
+ cairo_pattern_union_t source;
+ cairo_path_fixed_t path;
+ cairo_fill_rule_t fill_rule;
+ double tolerance;
+ cairo_antialias_t antialias;
+} cairo_command_fill_t;
+
+typedef struct _cairo_command_show_text_glyphs {
+ cairo_command_header_t header;
+ cairo_pattern_union_t source;
+ char *utf8;
+ int utf8_len;
+ cairo_glyph_t *glyphs;
+ unsigned int num_glyphs;
+ cairo_text_cluster_t *clusters;
+ int num_clusters;
+ cairo_text_cluster_flags_t cluster_flags;
+ cairo_scaled_font_t *scaled_font;
+} cairo_command_show_text_glyphs_t;
+
+typedef union _cairo_command {
+ cairo_command_header_t header;
+
+ cairo_command_paint_t paint;
+ cairo_command_mask_t mask;
+ cairo_command_stroke_t stroke;
+ cairo_command_fill_t fill;
+ cairo_command_show_text_glyphs_t show_text_glyphs;
+} cairo_command_t;
+
+typedef struct _cairo_recording_surface {
+ cairo_surface_t base;
+
+ cairo_content_t content;
+
+ /* A recording-surface is logically unbounded, but when used as a
+ * source we need to render it to an image, so we need a size at
+ * which to create that image. */
+ cairo_rectangle_t extents_pixels;
+ cairo_rectangle_int_t extents;
+ cairo_bool_t unbounded;
+
+ cairo_clip_t clip;
+
+ cairo_array_t commands;
+ cairo_surface_t *commands_owner;
+
+ int replay_start_idx;
+} cairo_recording_surface_t;
+
+slim_hidden_proto (cairo_recording_surface_create);
+
+cairo_private cairo_int_status_t
+_cairo_recording_surface_get_path (cairo_surface_t *surface,
+ cairo_path_fixed_t *path);
+
+cairo_private cairo_status_t
+_cairo_recording_surface_replay (cairo_surface_t *surface,
+ cairo_surface_t *target);
+
+
+cairo_private cairo_status_t
+_cairo_recording_surface_replay_analyze_recording_pattern (cairo_surface_t *surface,
+ cairo_surface_t *target);
+
+cairo_private cairo_status_t
+_cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface,
+ cairo_surface_t *target);
+cairo_private cairo_status_t
+_cairo_recording_surface_replay_region (cairo_surface_t *surface,
+ cairo_surface_t *target,
+ cairo_recording_region_type_t region);
+
+cairo_private cairo_status_t
+_cairo_recording_surface_get_bbox (cairo_recording_surface_t *recording,
+ cairo_box_t *bbox,
+ const cairo_matrix_t *transform);
+
+cairo_private cairo_bool_t
+_cairo_surface_is_recording (const cairo_surface_t *surface);
+
+#endif /* CAIRO_RECORDING_SURFACE_H */
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
new file mode 100644
index 0000000..c50b330
--- /dev/null
+++ b/src/cairo-recording-surface.c
@@ -0,0 +1,1096 @@
+/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
+/* cairo - a vector graphics library with display and print output
+ *
+ * Copyright © 2005 Red Hat, Inc
+ * Copyright © 2007 Adrian Johnson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it either under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation
+ * (the "LGPL") or, at your option, under the terms of the Mozilla
+ * Public License Version 1.1 (the "MPL"). If you do not alter this
+ * notice, a recipient may use your version of this file under either
+ * the MPL or the LGPL.
+ *
+ * You should have received a copy of the LGPL along with this library
+ * in the file COPYING-LGPL-2.1; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the MPL along with this library
+ * in the file COPYING-MPL-1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
+ * OF ANY KIND, either express or implied. See the LGPL or the MPL for
+ * the specific language governing rights and limitations.
+ *
+ * The Original Code is the cairo graphics library.
+ *
+ * The Initial Developer of the Original Code is Red Hat, Inc.
+ *
+ * Contributor(s):
+ * Kristian Høgsberg <krh at redhat.com>
+ * Carl Worth <cworth at cworth.org>
+ * Adrian Johnson <ajohnson at redneon.com>
+ */
+
+/* A recording 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 recording
+ * 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 recording surface had instead been applied to the
+ * target surface, you can use code like this:
+ * <informalexample><programlisting>
+ * cairo_t *cr;
+ *
+ * cr = cairo_create (target);
+ * cairo_set_source_surface (cr, recording_surface, 0.0, 0.0);
+ * cairo_paint (cr);
+ * cairo_destroy (cr);
+ * </programlisting></informalexample>
+ *
+ * A recording surface is logically unbounded, i.e. it has no implicit constraint
+ * on the size of the drawing surface. However, in practice this is rarely
+ * useful as you wish to replay against a particular target surface with
+ * known bounds. For this case, it is more efficient to specify the target
+ * extents to the recording surface upon creation.
+ *
+ * The recording phase of the recording surface is careful to snapshot all
+ * necessary objects (paths, patterns, etc.), in order to achieve
+ * accurate replay. The efficiency of the recording surface could be
+ * improved by improving the implementation of snapshot for the
+ * various objects. For example, it would be nice to have a
+ * copy-on-write implementation for _cairo_surface_snapshot.
+ */
+
+/* XXX Rename to recording surface */
+
+#include "cairoint.h"
+#include "cairo-analysis-surface-private.h"
+#include "cairo-recording-surface-private.h"
+#include "cairo-clip-private.h"
+#include "cairo-surface-wrapper-private.h"
+
+typedef enum {
+ CAIRO_RECORDING_REPLAY,
+ CAIRO_RECORDING_CREATE_REGIONS
+} cairo_recording_replay_type_t;
+
+static const cairo_surface_backend_t cairo_recording_surface_backend;
+
+/* Currently all recording surfaces do have a size which should be passed
+ * in as the maximum size of any target surface against which the
+ * recording-surface will ever be replayed.
+ *
+ * XXX: The naming of "pixels" in the size here is a misnomer. It's
+ * actually a size in whatever device-space units are desired (again,
+ * according to the intended replay target).
+ */
+
+/**
+ * cairo_recording_surface_create:
+ * @content: the content of the recording surface
+ * @extents_pixels: the extents to record in pixels, can be %NULL to record
+ * unbounded operations.
+ *
+ * Creates a recording-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 recording surface can then be "replayed" against
+ * any target surface by using it as a source to drawing operations.
+ *
+ * The recording phase of the recording surface is careful to snapshot all
+ * necessary objects (paths, patterns, etc.), in order to achieve
+ * accurate replay.
+ *
+ * Since 1.10
+ **/
+cairo_surface_t *
+cairo_recording_surface_create (cairo_content_t content,
+ const cairo_rectangle_t *extents)
+{
+ cairo_recording_surface_t *recording_surface;
+ cairo_status_t status;
+
+ recording_surface = malloc (sizeof (cairo_recording_surface_t));
+ if (unlikely (recording_surface == NULL))
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+
+ _cairo_surface_init (&recording_surface->base, &cairo_recording_surface_backend, content);
+
+ recording_surface->content = content;
+
+ /* unbounded -> 'infinite' extents */
+ if (extents != NULL) {
+ recording_surface->extents_pixels = *extents;
+
+ /* XXX check for overflow */
+ recording_surface->extents.x = floor (extents->x);
+ recording_surface->extents.y = floor (extents->y);
+ recording_surface->extents.width = ceil (extents->x + extents->width) - recording_surface->extents.x;
+ recording_surface->extents.height = ceil (extents->y + extents->height) - recording_surface->extents.y;
+
+ status = _cairo_clip_init_rectangle (&recording_surface->clip, &recording_surface->extents);
+ if (unlikely (status)) {
+ free (recording_surface);
+ return _cairo_surface_create_in_error (status);
+ }
+
+ recording_surface->unbounded = FALSE;
+ } else {
+ recording_surface->unbounded = TRUE;
+ _cairo_clip_init (&recording_surface->clip);
+ }
+
+ _cairo_array_init (&recording_surface->commands, sizeof (cairo_command_t *));
+ recording_surface->commands_owner = NULL;
+
+ recording_surface->replay_start_idx = 0;
+
+ return &recording_surface->base;
+}
+slim_hidden_def (cairo_recording_surface_create);
+
+static cairo_surface_t *
+_cairo_recording_surface_create_similar (void *abstract_surface,
+ cairo_content_t content,
+ int width,
+ int height)
+{
+ cairo_rectangle_t extents;
+ extents.x = extents.y = 0;
+ extents.width = width;
+ extents.height = height;
+ return cairo_recording_surface_create (content, &extents);
+}
+
+static cairo_status_t
+_cairo_recording_surface_finish (void *abstract_surface)
+{
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_t **elements;
+ int i, num_elements;
+
+ if (recording_surface->commands_owner) {
+ cairo_surface_destroy (recording_surface->commands_owner);
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ num_elements = recording_surface->commands.num_elements;
+ elements = _cairo_array_index (&recording_surface->commands, 0);
+ for (i = 0; i < num_elements; i++) {
+ cairo_command_t *command = elements[i];
+
+ _cairo_clip_reset (&command->header.clip);
+
+ switch (command->header.type) {
+ case CAIRO_COMMAND_PAINT:
+ _cairo_pattern_fini_snapshot (&command->paint.source.base);
+ free (command);
+ break;
+
+ case CAIRO_COMMAND_MASK:
+ _cairo_pattern_fini_snapshot (&command->mask.source.base);
+ _cairo_pattern_fini_snapshot (&command->mask.mask.base);
+ free (command);
+ break;
+
+ case CAIRO_COMMAND_STROKE:
+ _cairo_pattern_fini_snapshot (&command->stroke.source.base);
+ _cairo_path_fixed_fini (&command->stroke.path);
+ _cairo_stroke_style_fini (&command->stroke.style);
+ free (command);
+ break;
+
+ case CAIRO_COMMAND_FILL:
+ _cairo_pattern_fini_snapshot (&command->fill.source.base);
+ _cairo_path_fixed_fini (&command->fill.path);
+ free (command);
+ break;
+
+ case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
+ _cairo_pattern_fini_snapshot (&command->show_text_glyphs.source.base);
+ free (command->show_text_glyphs.utf8);
+ free (command->show_text_glyphs.glyphs);
+ free (command->show_text_glyphs.clusters);
+ cairo_scaled_font_destroy (command->show_text_glyphs.scaled_font);
+ free (command);
+ break;
+
+ default:
+ ASSERT_NOT_REACHED;
+ }
+ }
+
+ _cairo_array_fini (&recording_surface->commands);
+ _cairo_clip_reset (&recording_surface->clip);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static cairo_status_t
+_cairo_recording_surface_acquire_source_image (void *abstract_surface,
+ cairo_image_surface_t **image_out,
+ void **image_extra)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *surface = abstract_surface;
+ cairo_surface_t *image;
+
+ image = _cairo_surface_has_snapshot (&surface->base,
+ &_cairo_image_surface_backend,
+ surface->content);
+ if (image != NULL) {
+ *image_out = (cairo_image_surface_t *) cairo_surface_reference (image);
+ *image_extra = NULL;
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ image = _cairo_image_surface_create_with_content (surface->content,
+ surface->extents.width,
+ surface->extents.height);
+ if (unlikely (image->status))
+ return image->status;
+
+ cairo_surface_set_device_offset (image,
+ -surface->extents.x,
+ -surface->extents.y);
+
+ status = _cairo_recording_surface_replay (&surface->base, image);
+ if (unlikely (status)) {
+ cairo_surface_destroy (image);
+ return status;
+ }
+
+ status = _cairo_surface_attach_snapshot (&surface->base, image, NULL);
+ if (unlikely (status)) {
+ cairo_surface_destroy (image);
+ return status;
+ }
+
+ *image_out = (cairo_image_surface_t *) image;
+ *image_extra = NULL;
+ return CAIRO_STATUS_SUCCESS;
+}
+
+static void
+_cairo_recording_surface_release_source_image (void *abstract_surface,
+ cairo_image_surface_t *image,
+ void *image_extra)
+{
+ cairo_surface_destroy (&image->base);
+}
+
+static cairo_status_t
+_command_init (cairo_recording_surface_t *recording_surface,
+ cairo_command_header_t *command,
+ cairo_command_type_t type,
+ cairo_operator_t op,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
+
+ command->type = type;
+ command->op = op;
+ command->region = CAIRO_RECORDING_REGION_ALL;
+ _cairo_clip_init_copy (&command->clip, clip);
+ if (recording_surface->clip.path != NULL)
+ status = _cairo_clip_apply_clip (&command->clip, &recording_surface->clip);
+
+ return status;
+}
+
+static cairo_int_status_t
+_cairo_recording_surface_paint (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_paint_t *command;
+
+ command = malloc (sizeof (cairo_command_paint_t));
+ if (unlikely (command == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+ status = _command_init (recording_surface,
+ &command->header, CAIRO_COMMAND_PAINT, op, clip);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->source.base, source);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_array_append (&recording_surface->commands, &command);
+ if (unlikely (status))
+ goto CLEANUP_SOURCE;
+
+ /* An optimisation that takes care to not replay what was done
+ * before surface is cleared. We don't erase recorded commands
+ * since we may have earlier snapshots of this surface. */
+ if (op == CAIRO_OPERATOR_CLEAR && clip == NULL)
+ recording_surface->replay_start_idx = recording_surface->commands.num_elements;
+
+ return CAIRO_STATUS_SUCCESS;
+
+ CLEANUP_SOURCE:
+ _cairo_pattern_fini_snapshot (&command->source.base);
+ CLEANUP_COMMAND:
+ free (command);
+ return status;
+}
+
+static cairo_int_status_t
+_cairo_recording_surface_mask (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const cairo_pattern_t *mask,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_mask_t *command;
+
+ command = malloc (sizeof (cairo_command_mask_t));
+ if (unlikely (command == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+ status = _command_init (recording_surface,
+ &command->header, CAIRO_COMMAND_MASK, op, clip);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->source.base, source);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->mask.base, mask);
+ if (unlikely (status))
+ goto CLEANUP_SOURCE;
+
+ status = _cairo_array_append (&recording_surface->commands, &command);
+ if (unlikely (status))
+ goto CLEANUP_MASK;
+
+ return CAIRO_STATUS_SUCCESS;
+
+ CLEANUP_MASK:
+ _cairo_pattern_fini_snapshot (&command->mask.base);
+ CLEANUP_SOURCE:
+ _cairo_pattern_fini_snapshot (&command->source.base);
+ CLEANUP_COMMAND:
+ free (command);
+ return status;
+}
+
+static cairo_int_status_t
+_cairo_recording_surface_stroke (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_stroke_style_t *style,
+ cairo_matrix_t *ctm,
+ cairo_matrix_t *ctm_inverse,
+ double tolerance,
+ cairo_antialias_t antialias,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_stroke_t *command;
+
+ command = malloc (sizeof (cairo_command_stroke_t));
+ if (unlikely (command == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+ status = _command_init (recording_surface,
+ &command->header, CAIRO_COMMAND_STROKE, op, clip);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->source.base, source);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_path_fixed_init_copy (&command->path, path);
+ if (unlikely (status))
+ goto CLEANUP_SOURCE;
+
+ status = _cairo_stroke_style_init_copy (&command->style, style);
+ if (unlikely (status))
+ goto CLEANUP_PATH;
+
+ command->ctm = *ctm;
+ command->ctm_inverse = *ctm_inverse;
+ command->tolerance = tolerance;
+ command->antialias = antialias;
+
+ status = _cairo_array_append (&recording_surface->commands, &command);
+ if (unlikely (status))
+ goto CLEANUP_STYLE;
+
+ return CAIRO_STATUS_SUCCESS;
+
+ CLEANUP_STYLE:
+ _cairo_stroke_style_fini (&command->style);
+ CLEANUP_PATH:
+ _cairo_path_fixed_fini (&command->path);
+ CLEANUP_SOURCE:
+ _cairo_pattern_fini_snapshot (&command->source.base);
+ CLEANUP_COMMAND:
+ free (command);
+ return status;
+}
+
+static cairo_int_status_t
+_cairo_recording_surface_fill (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ cairo_path_fixed_t *path,
+ cairo_fill_rule_t fill_rule,
+ double tolerance,
+ cairo_antialias_t antialias,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_fill_t *command;
+
+ command = malloc (sizeof (cairo_command_fill_t));
+ if (unlikely (command == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+ status =_command_init (recording_surface,
+ &command->header, CAIRO_COMMAND_FILL, op, clip);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->source.base, source);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_path_fixed_init_copy (&command->path, path);
+ if (unlikely (status))
+ goto CLEANUP_SOURCE;
+
+ command->fill_rule = fill_rule;
+ command->tolerance = tolerance;
+ command->antialias = antialias;
+
+ status = _cairo_array_append (&recording_surface->commands, &command);
+ if (unlikely (status))
+ goto CLEANUP_PATH;
+
+ return CAIRO_STATUS_SUCCESS;
+
+ CLEANUP_PATH:
+ _cairo_path_fixed_fini (&command->path);
+ CLEANUP_SOURCE:
+ _cairo_pattern_fini_snapshot (&command->source.base);
+ CLEANUP_COMMAND:
+ free (command);
+ return status;
+}
+
+static cairo_bool_t
+_cairo_recording_surface_has_show_text_glyphs (void *abstract_surface)
+{
+ return TRUE;
+}
+
+static cairo_int_status_t
+_cairo_recording_surface_show_text_glyphs (void *abstract_surface,
+ cairo_operator_t op,
+ const cairo_pattern_t *source,
+ const char *utf8,
+ int utf8_len,
+ cairo_glyph_t *glyphs,
+ int num_glyphs,
+ const cairo_text_cluster_t *clusters,
+ int num_clusters,
+ cairo_text_cluster_flags_t cluster_flags,
+ cairo_scaled_font_t *scaled_font,
+ cairo_clip_t *clip)
+{
+ cairo_status_t status;
+ cairo_recording_surface_t *recording_surface = abstract_surface;
+ cairo_command_show_text_glyphs_t *command;
+
+ command = malloc (sizeof (cairo_command_show_text_glyphs_t));
+ if (unlikely (command == NULL))
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+
+ status = _command_init (recording_surface,
+ &command->header, CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
+ op, clip);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ status = _cairo_pattern_init_snapshot (&command->source.base, source);
+ if (unlikely (status))
+ goto CLEANUP_COMMAND;
+
+ command->utf8 = NULL;
+ command->utf8_len = utf8_len;
+ command->glyphs = NULL;
+ command->num_glyphs = num_glyphs;
+ command->clusters = NULL;
+ command->num_clusters = num_clusters;
+
+ if (utf8_len) {
+ command->utf8 = malloc (utf8_len);
+ if (unlikely (command->utf8 == NULL)) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ goto CLEANUP_ARRAYS;
+ }
+ memcpy (command->utf8, utf8, utf8_len);
+ }
+ if (num_glyphs) {
+ command->glyphs = _cairo_malloc_ab (num_glyphs, sizeof (glyphs[0]));
+ if (unlikely (command->glyphs == NULL)) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ goto CLEANUP_ARRAYS;
+ }
+ memcpy (command->glyphs, glyphs, sizeof (glyphs[0]) * num_glyphs);
+ }
+ if (num_clusters) {
+ command->clusters = _cairo_malloc_ab (num_clusters, sizeof (clusters[0]));
+ if (unlikely (command->clusters == NULL)) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ goto CLEANUP_ARRAYS;
+ }
+ memcpy (command->clusters, clusters, sizeof (clusters[0]) * num_clusters);
+ }
+
+ command->cluster_flags = cluster_flags;
+
+ command->scaled_font = cairo_scaled_font_reference (scaled_font);
+
+ status = _cairo_array_append (&recording_surface->commands, &command);
+ if (unlikely (status))
+ goto CLEANUP_SCALED_FONT;
+
+ return CAIRO_STATUS_SUCCESS;
+
+ CLEANUP_SCALED_FONT:
+ cairo_scaled_font_destroy (command->scaled_font);
+ CLEANUP_ARRAYS:
+ free (command->utf8);
+ free (command->glyphs);
+ free (command->clusters);
+
+ _cairo_pattern_fini_snapshot (&command->source.base);
+ CLEANUP_COMMAND:
+ free (command);
+ return status;
+}
+
+/**
+ * _cairo_recording_surface_snapshot
+ * @surface: a #cairo_surface_t which must be a recording surface
+ *
+ * Make an immutable copy of @surface. It is an error to call a
+ * surface-modifying function on the result of this function.
+ *
+ * The caller owns the return value and should call
+ * cairo_surface_destroy() when finished with it. This function will not
+ * return %NULL, but will return a nil surface instead.
+ *
+ * Return value: The snapshot surface.
+ **/
+static cairo_surface_t *
+_cairo_recording_surface_snapshot (void *abstract_other)
+{
+ cairo_recording_surface_t *other = abstract_other;
+ cairo_recording_surface_t *recording_surface;
+
+ recording_surface = malloc (sizeof (cairo_recording_surface_t));
+ if (unlikely (recording_surface == NULL))
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
+
+ _cairo_surface_init (&recording_surface->base, &cairo_recording_surface_backend,
+ other->base.content);
+
+ recording_surface->extents_pixels = other->extents_pixels;
+ recording_surface->extents = other->extents;
+ recording_surface->unbounded = other->unbounded;
+ recording_surface->replay_start_idx = other->replay_start_idx;
+ recording_surface->content = other->content;
+
+ _cairo_array_init_snapshot (&recording_surface->commands, &other->commands);
+ recording_surface->commands_owner = cairo_surface_reference (&other->base);
+
+ _cairo_clip_init_copy (&recording_surface->clip, &other->clip);
+
+ return &recording_surface->base;
+}
+
+static cairo_bool_t
+_cairo_recording_surface_get_extents (void *abstract_surface,
+ cairo_rectangle_int_t *rectangle)
+{
+ cairo_recording_surface_t *surface = abstract_surface;
+
+ if (surface->unbounded)
+ return FALSE;
+
+ *rectangle = surface->extents;
+ return TRUE;
+}
+
+/**
+ * _cairo_surface_is_recording:
+ * @surface: a #cairo_surface_t
+ *
+ * Checks if a surface is a #cairo_recording_surface_t
+ *
+ * Return value: %TRUE if the surface is a recording surface
+ **/
+cairo_bool_t
+_cairo_surface_is_recording (const cairo_surface_t *surface)
+{
+ return surface->backend == &cairo_recording_surface_backend;
+}
+
+static const cairo_surface_backend_t cairo_recording_surface_backend = {
+ CAIRO_SURFACE_TYPE_RECORDING,
+ _cairo_recording_surface_create_similar,
+ _cairo_recording_surface_finish,
+ _cairo_recording_surface_acquire_source_image,
+ _cairo_recording_surface_release_source_image,
+ NULL, /* acquire_dest_image */
+ NULL, /* release_dest_image */
+ NULL, /* clone_similar */
+ NULL, /* composite */
+ NULL, /* fill_rectangles */
+ NULL, /* composite_trapezoids */
+ NULL, /* create_span_renderer */
+ NULL, /* check_span_renderer */
+ NULL, /* copy_page */
+ NULL, /* show_page */
+ _cairo_recording_surface_get_extents,
+ NULL, /* old_show_glyphs */
+ NULL, /* get_font_options */
+ NULL, /* flush */
+ NULL, /* mark_dirty_rectangle */
+ NULL, /* scaled_font_fini */
+ NULL, /* scaled_glyph_fini */
+
+ /* Here are the 5 basic drawing operations, (which are in some
+ * sense the only things that cairo_recording_surface should need to
+ * implement). However, we implement the more generic show_text_glyphs
+ * instead of show_glyphs. One or the other is eough. */
+
+ _cairo_recording_surface_paint,
+ _cairo_recording_surface_mask,
+ _cairo_recording_surface_stroke,
+ _cairo_recording_surface_fill,
+ NULL,
+
+ _cairo_recording_surface_snapshot,
+
+ NULL, /* is_similar */
+ NULL, /* fill_stroke */
+ NULL, /* create_solid_pattern_surface */
+ NULL, /* can_repaint_solid_pattern_surface */
+
+ _cairo_recording_surface_has_show_text_glyphs,
+ _cairo_recording_surface_show_text_glyphs
+};
+
+cairo_int_status_t
+_cairo_recording_surface_get_path (cairo_surface_t *surface,
+ cairo_path_fixed_t *path)
+{
+ cairo_recording_surface_t *recording_surface;
+ cairo_command_t **elements;
+ int i, num_elements;
+ cairo_int_status_t status;
+
+ if (surface->status)
+ return surface->status;
+
+ recording_surface = (cairo_recording_surface_t *) surface;
+ status = CAIRO_STATUS_SUCCESS;
+
+ num_elements = recording_surface->commands.num_elements;
+ elements = _cairo_array_index (&recording_surface->commands, 0);
+ for (i = recording_surface->replay_start_idx; i < num_elements; i++) {
+ cairo_command_t *command = elements[i];
+
+ switch (command->header.type) {
+ case CAIRO_COMMAND_PAINT:
+ case CAIRO_COMMAND_MASK:
+ status = CAIRO_INT_STATUS_UNSUPPORTED;
+ break;
+
+ case CAIRO_COMMAND_STROKE:
+ {
+ cairo_traps_t traps;
+
+ _cairo_traps_init (&traps);
+
+ /* XXX call cairo_stroke_to_path() when that is implemented */
+ status = _cairo_path_fixed_stroke_to_traps (&command->stroke.path,
+ &command->stroke.style,
+ &command->stroke.ctm,
+ &command->stroke.ctm_inverse,
+ command->stroke.tolerance,
+ &traps);
+
+ if (status == CAIRO_STATUS_SUCCESS)
+ status = _cairo_traps_path (&traps, path);
+
+ _cairo_traps_fini (&traps);
+ break;
+ }
+ case CAIRO_COMMAND_FILL:
+ {
+ status = _cairo_path_fixed_append (path,
+ &command->fill.path, CAIRO_DIRECTION_FORWARD,
+ 0, 0);
+ break;
+ }
+ case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
+ {
+ status = _cairo_scaled_font_glyph_path (command->show_text_glyphs.scaled_font,
+ command->show_text_glyphs.glyphs,
+ command->show_text_glyphs.num_glyphs,
+ path);
+ break;
+ }
+
+ default:
+ ASSERT_NOT_REACHED;
+ }
+
+ if (unlikely (status))
+ break;
+ }
+
+ return _cairo_surface_set_error (surface, status);
+}
+
+#define _clip(c) ((c)->header.clip.path ? &(c)->header.clip : NULL)
+static cairo_status_t
+_cairo_recording_surface_replay_internal (cairo_surface_t *surface,
+ cairo_surface_t *target,
+ cairo_recording_replay_type_t type,
+ cairo_recording_region_type_t region)
+{
+ cairo_recording_surface_t *recording_surface;
+ cairo_command_t **elements;
+ int i, num_elements;
+ cairo_int_status_t status;
+ cairo_surface_wrapper_t wrapper;
+
+ if (unlikely (surface->status))
+ return surface->status;
+
+ if (unlikely (target->status))
+ return _cairo_surface_set_error (surface, target->status);
+
+ _cairo_surface_wrapper_init (&wrapper, target);
+
+ recording_surface = (cairo_recording_surface_t *) surface;
+ status = CAIRO_STATUS_SUCCESS;
+
+ num_elements = recording_surface->commands.num_elements;
+ elements = _cairo_array_index (&recording_surface->commands, 0);
+ for (i = recording_surface->replay_start_idx; i < num_elements; i++) {
+ cairo_command_t *command = elements[i];
+
+ if (type == CAIRO_RECORDING_REPLAY && region != CAIRO_RECORDING_REGION_ALL) {
+ if (command->header.region != region)
+ continue;
+ }
+
+ switch (command->header.type) {
+ case CAIRO_COMMAND_PAINT:
+ status = _cairo_surface_wrapper_paint (&wrapper,
+ command->header.op,
+ &command->paint.source.base,
+ _clip (command));
+ break;
+
+ case CAIRO_COMMAND_MASK:
+ status = _cairo_surface_wrapper_mask (&wrapper,
+ command->header.op,
+ &command->mask.source.base,
+ &command->mask.mask.base,
+ _clip (command));
+ break;
+
+ case CAIRO_COMMAND_STROKE:
+ {
+ status = _cairo_surface_wrapper_stroke (&wrapper,
+ command->header.op,
+ &command->stroke.source.base,
+ &command->stroke.path,
+ &command->stroke.style,
+ &command->stroke.ctm,
+ &command->stroke.ctm_inverse,
+ command->stroke.tolerance,
+ command->stroke.antialias,
+ _clip (command));
+ break;
+ }
+ case CAIRO_COMMAND_FILL:
+ {
+ cairo_command_t *stroke_command;
+
+ stroke_command = NULL;
+ if (type != CAIRO_RECORDING_CREATE_REGIONS && i < num_elements - 1)
+ stroke_command = elements[i + 1];
+
+ if (stroke_command != NULL &&
+ type == CAIRO_RECORDING_REPLAY &&
+ region != CAIRO_RECORDING_REGION_ALL)
+ {
+ if (stroke_command->header.region != region)
+ stroke_command = NULL;
+ }
+
+ if (stroke_command != NULL &&
+ stroke_command->header.type == CAIRO_COMMAND_STROKE &&
+ _cairo_path_fixed_is_equal (&command->fill.path,
+ &stroke_command->stroke.path))
+ {
+ status = _cairo_surface_wrapper_fill_stroke (&wrapper,
+ command->header.op,
+ &command->fill.source.base,
+ command->fill.fill_rule,
+ command->fill.tolerance,
+ command->fill.antialias,
+ &command->fill.path,
+ stroke_command->header.op,
+ &stroke_command->stroke.source.base,
+ &stroke_command->stroke.style,
+ &stroke_command->stroke.ctm,
+ &stroke_command->stroke.ctm_inverse,
+ stroke_command->stroke.tolerance,
+ stroke_command->stroke.antialias,
+ _clip (command));
+ i++;
+ }
+ else
+ {
+ status = _cairo_surface_wrapper_fill (&wrapper,
+ command->header.op,
+ &command->fill.source.base,
+ &command->fill.path,
+ command->fill.fill_rule,
+ command->fill.tolerance,
+ command->fill.antialias,
+ _clip (command));
+ }
+ break;
+ }
+ case CAIRO_COMMAND_SHOW_TEXT_GLYPHS:
+ {
+ cairo_glyph_t *glyphs = command->show_text_glyphs.glyphs;
+ cairo_glyph_t *glyphs_copy;
+ int num_glyphs = command->show_text_glyphs.num_glyphs;
+
+ /* show_text_glyphs is special because _cairo_surface_show_text_glyphs is allowed
+ * to modify the glyph array that's passed in. We must always
+ * copy the array before handing it to the backend.
+ */
+ glyphs_copy = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
+ if (unlikely (glyphs_copy == NULL)) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ break;
+ }
+
+ memcpy (glyphs_copy, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
+
+ status = _cairo_surface_wrapper_show_text_glyphs (&wrapper,
+ command->header.op,
+ &command->show_text_glyphs.source.base,
+ command->show_text_glyphs.utf8, command->show_text_glyphs.utf8_len,
+ glyphs_copy, num_glyphs,
+ command->show_text_glyphs.clusters, command->show_text_glyphs.num_clusters,
+ command->show_text_glyphs.cluster_flags,
+ command->show_text_glyphs.scaled_font,
+ _clip (command));
+ free (glyphs_copy);
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED;
+ }
+
+ if (type == CAIRO_RECORDING_CREATE_REGIONS) {
+ if (status == CAIRO_STATUS_SUCCESS) {
+ command->header.region = CAIRO_RECORDING_REGION_NATIVE;
+ } else if (status == CAIRO_INT_STATUS_IMAGE_FALLBACK) {
+ command->header.region = CAIRO_RECORDING_REGION_IMAGE_FALLBACK;
+ status = CAIRO_STATUS_SUCCESS;
+ } else {
+ assert (_cairo_status_is_error (status));
+ }
+ }
+
+ if (unlikely (status))
+ break;
+ }
+
+ /* free up any caches */
+ for (i = recording_surface->replay_start_idx; i < num_elements; i++) {
+ cairo_command_t *command = elements[i];
+
+ _cairo_clip_drop_cache (&command->header.clip);
+ }
+
+ _cairo_surface_wrapper_fini (&wrapper);
+
+ return _cairo_surface_set_error (surface, status);
+}
+
+/**
+ * _cairo_recording_surface_replay:
+ * @surface: the #cairo_recording_surface_t
+ * @target: a target #cairo_surface_t onto which to replay the operations
+ * @width_pixels: width of the surface, in pixels
+ * @height_pixels: height of the surface, in pixels
+ *
+ * A recording surface can be "replayed" against any target 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 recording surface had instead been applied to the target surface.
+ **/
+cairo_status_t
+_cairo_recording_surface_replay (cairo_surface_t *surface,
+ cairo_surface_t *target)
+{
+ return _cairo_recording_surface_replay_internal (surface,
+ target,
+ CAIRO_RECORDING_REPLAY,
+ CAIRO_RECORDING_REGION_ALL);
+}
+
+/* Replay recording to surface. When the return status of each operation is
+ * one of %CAIRO_STATUS_SUCCESS, %CAIRO_INT_STATUS_UNSUPPORTED, or
+ * %CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY the status of each operation
+ * will be stored in the recording surface. Any other status will abort the
+ * replay and return the status.
+ */
+cairo_status_t
+_cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface,
+ cairo_surface_t *target)
+{
+ return _cairo_recording_surface_replay_internal (surface,
+ target,
+ CAIRO_RECORDING_CREATE_REGIONS,
+ CAIRO_RECORDING_REGION_ALL);
+}
+
+cairo_status_t
+_cairo_recording_surface_replay_region (cairo_surface_t *surface,
+ cairo_surface_t *target,
+ cairo_recording_region_type_t region)
+{
+ return _cairo_recording_surface_replay_internal (surface,
+ target,
+ CAIRO_RECORDING_REPLAY,
+ region);
+}
+
+static cairo_status_t
+_recording_surface_get_ink_bbox (cairo_recording_surface_t *surface,
+ cairo_box_t *bbox,
+ const cairo_matrix_t *transform)
+{
+ cairo_surface_t *null_surface;
+ cairo_surface_t *analysis_surface;
+ cairo_status_t status;
+
+ null_surface = _cairo_null_surface_create (surface->content);
+ analysis_surface = _cairo_analysis_surface_create (null_surface);
+ cairo_surface_destroy (null_surface);
+
+ status = analysis_surface->status;
+ if (unlikely (status))
+ return status;
+
+ if (transform != NULL)
+ _cairo_analysis_surface_set_ctm (analysis_surface, transform);
+
+ status = _cairo_recording_surface_replay (&surface->base, analysis_surface);
+ _cairo_analysis_surface_get_bounding_box (analysis_surface, bbox);
+ cairo_surface_destroy (analysis_surface);
+
+ return status;
+}
+
+/**
+ * cairo_recording_surface_ink_extents:
+ * @surface: a #cairo_recording_surface_t
+ * @x0: the x-coordinate of the top-left of the ink bounding box
+ * @y0: the y-coordinate of the top-left of the ink bounding box
+ * @width: the width of the ink bounding box
+ * @height: the height of the ink bounding box
+ *
+ * Measures the extents of the operations stored within the recording-surface.
+ * This is useful to compute the required size of an image surface (or
+ * equivalent) into which to replay the full sequence of drawing operations.
+ *
+ * Since: 1.10
+ **/
+void
+cairo_recording_surface_ink_extents (cairo_surface_t *surface,
+ double *x0,
+ double *y0,
+ double *width,
+ double *height)
+{
+ cairo_status_t status;
+ cairo_box_t bbox;
+
+ memset (&bbox, 0, sizeof (bbox));
+
+ if (! _cairo_surface_is_recording (surface)) {
+ _cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
+ goto DONE;
+ }
+
+ status = _recording_surface_get_ink_bbox ((cairo_recording_surface_t *) surface,
+ &bbox,
+ NULL);
+ if (unlikely (status))
+ status = _cairo_surface_set_error (surface, status);
+
+DONE:
+ if (x0)
+ *x0 = _cairo_fixed_to_double (bbox.p1.x);
+ if (y0)
+ *y0 = _cairo_fixed_to_double (bbox.p1.y);
+ if (width)
+ *width = _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x);
+ if (height)
+ *height = _cairo_fixed_to_double (bbox.p2.y - bbox.p1.y);
+}
+
+cairo_status_t
+_cairo_recording_surface_get_bbox (cairo_recording_surface_t *surface,
+ cairo_box_t *bbox,
+ const cairo_matrix_t *transform)
+{
+ if (! surface->unbounded) {
+ _cairo_box_from_rectangle (bbox, &surface->extents);
+ if (transform != NULL)
+ _cairo_matrix_transform_bounding_box_fixed (transform, bbox, NULL);
+
+ return CAIRO_STATUS_SUCCESS;
+ }
+
+ return _recording_surface_get_ink_bbox (surface, bbox, transform);
+}
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 179844f..5795d24 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -199,8 +199,8 @@ _cairo_scaled_glyph_fini (cairo_scaled_font_t *scaled_font,
if (scaled_glyph->path != NULL)
_cairo_path_fixed_destroy (scaled_glyph->path);
- if (scaled_glyph->meta_surface != NULL)
- cairo_surface_destroy (scaled_glyph->meta_surface);
+ if (scaled_glyph->recording_surface != NULL)
+ cairo_surface_destroy (scaled_glyph->recording_surface);
}
#define ZOMBIE 0
@@ -2516,13 +2516,13 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
}
void
-_cairo_scaled_glyph_set_meta_surface (cairo_scaled_glyph_t *scaled_glyph,
- cairo_scaled_font_t *scaled_font,
- cairo_surface_t *meta_surface)
+_cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph,
+ cairo_scaled_font_t *scaled_font,
+ cairo_surface_t *recording_surface)
{
- if (scaled_glyph->meta_surface != NULL)
- cairo_surface_destroy (meta_surface);
- scaled_glyph->meta_surface = meta_surface;
+ if (scaled_glyph->recording_surface != NULL)
+ cairo_surface_destroy (recording_surface);
+ scaled_glyph->recording_surface = recording_surface;
}
static cairo_bool_t
@@ -2703,10 +2703,10 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
need_info |= CAIRO_SCALED_GLYPH_INFO_PATH;
}
- if ((info & CAIRO_SCALED_GLYPH_INFO_META_SURFACE) != 0 &&
- scaled_glyph->meta_surface == NULL)
+ if ((info & CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE) != 0 &&
+ scaled_glyph->recording_surface == NULL)
{
- need_info |= CAIRO_SCALED_GLYPH_INFO_META_SURFACE;
+ need_info |= CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE;
}
if (need_info) {
@@ -2718,7 +2718,7 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
/* Don't trust the scaled_glyph_init() return value, the font
* backend may not even know about some of the info. For example,
- * no backend other than the user-fonts knows about meta-surface
+ * no backend other than the user-fonts knows about recording-surface
* glyph info. */
if ((info & CAIRO_SCALED_GLYPH_INFO_SURFACE) != 0 &&
@@ -2735,8 +2735,8 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
goto CLEANUP;
}
- if ((info & CAIRO_SCALED_GLYPH_INFO_META_SURFACE) != 0 &&
- scaled_glyph->meta_surface == NULL)
+ if ((info & CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE) != 0 &&
+ scaled_glyph->recording_surface == NULL)
{
status = CAIRO_INT_STATUS_UNSUPPORTED;
goto CLEANUP;
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index 93b09da..ec06364 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -37,7 +37,7 @@
/* The script surface is one that records all operations performed on
* it in the form of a procedural script, similar in fashion to
* PostScript but using Cairo's imaging model. In essence, this is
- * equivalent to the meta-surface, but as there is no impedance mismatch
+ * equivalent to the recording-surface, but as there is no impedance mismatch
* between Cairo and CairoScript, we can generate output immediately
* without having to copy and hold the data in memory.
*/
@@ -49,7 +49,7 @@
#include "cairo-analysis-surface-private.h"
#include "cairo-ft-private.h"
#include "cairo-list-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-scaled-font-private.h"
#include "cairo-surface-clipper-private.h"
@@ -929,22 +929,22 @@ _emit_radial_pattern (cairo_script_surface_t *surface,
}
static cairo_status_t
-_emit_meta_surface_pattern (cairo_script_surface_t *surface,
- const cairo_pattern_t *pattern)
+_emit_recording_surface_pattern (cairo_script_surface_t *surface,
+ const cairo_pattern_t *pattern)
{
cairo_script_implicit_context_t old_cr;
cairo_surface_pattern_t *surface_pattern;
- cairo_meta_surface_t *source;
+ cairo_recording_surface_t *source;
cairo_script_surface_t *similar;
cairo_status_t status;
cairo_box_t bbox;
cairo_rectangle_int_t rect;
surface_pattern = (cairo_surface_pattern_t *) pattern;
- source = (cairo_meta_surface_t *) surface_pattern->surface;
+ source = (cairo_recording_surface_t *) surface_pattern->surface;
/* first measure the extents */
- status = _cairo_meta_surface_get_bbox (source, &bbox, NULL);
+ status = _cairo_recording_surface_get_bbox (source, &bbox, NULL);
if (unlikely (status))
return status;
@@ -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_recording_surface_replay (&source->base, &similar->base);
surface->cr = old_cr;
if (unlikely (status)) {
@@ -1346,8 +1346,8 @@ _emit_surface_pattern (cairo_script_surface_t *surface,
source = surface_pattern->surface;
switch ((int) source->type) {
- case CAIRO_SURFACE_TYPE_META:
- return _emit_meta_surface_pattern (surface, pattern);
+ case CAIRO_SURFACE_TYPE_RECORDING:
+ return _emit_recording_surface_pattern (surface, pattern);
case CAIRO_SURFACE_TYPE_SCRIPT:
return _emit_script_surface_pattern (surface, pattern);
default:
@@ -2655,8 +2655,8 @@ _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,
- &surface->base);
+ status = _cairo_recording_surface_replay (scaled_glyph->recording_surface,
+ &surface->base);
surface->cr = old_cr;
_cairo_output_stream_puts (surface->ctx->stream, "} >> set\n");
@@ -2763,7 +2763,7 @@ _emit_scaled_glyphs (cairo_script_surface_t *surface,
status = _cairo_scaled_glyph_lookup (scaled_font,
glyphs[n].index,
- CAIRO_SCALED_GLYPH_INFO_META_SURFACE,
+ CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE,
&scaled_glyph);
if (_cairo_status_is_error (status))
break;
@@ -3397,8 +3397,8 @@ cairo_script_surface_create_for_target (cairo_script_context_t *context,
}
cairo_status_t
-cairo_script_from_meta_surface (cairo_script_context_t *context,
- cairo_surface_t *meta)
+cairo_script_from_recording_surface (cairo_script_context_t *context,
+ cairo_surface_t *recording_surface)
{
cairo_box_t bbox;
cairo_rectangle_int_t extents;
@@ -3408,13 +3408,13 @@ cairo_script_from_meta_surface (cairo_script_context_t *context,
if (unlikely (context->status))
return context->status;
- if (unlikely (meta->status))
- return meta->status;
+ if (unlikely (recording_surface->status))
+ return recording_surface->status;
- if (unlikely (! _cairo_surface_is_meta (meta)))
+ if (unlikely (! _cairo_surface_is_recording (recording_surface)))
return _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
- status = _cairo_meta_surface_get_bbox ((cairo_meta_surface_t *) meta,
+ status = _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface,
&bbox, NULL);
if (unlikely (status))
return status;
@@ -3422,7 +3422,7 @@ cairo_script_from_meta_surface (cairo_script_context_t *context,
_cairo_box_round_to_rectangle (&bbox, &extents);
surface = &_cairo_script_surface_create_internal (context,
- meta->content,
+ recording_surface->content,
extents.width,
extents.height,
NULL)->base;
@@ -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_recording_surface_replay (recording_surface, surface);
cairo_surface_destroy (surface);
return status;
diff --git a/src/cairo-script.h b/src/cairo-script.h
index c418350..5af625c 100644
--- a/src/cairo-script.h
+++ b/src/cairo-script.h
@@ -82,8 +82,8 @@ cairo_script_surface_create_for_target (cairo_script_context_t *context,
cairo_surface_t *target);
cairo_public cairo_status_t
-cairo_script_from_meta_surface (cairo_script_context_t *context,
- cairo_surface_t *meta);
+cairo_script_from_recording_surface (cairo_script_context_t *context,
+ cairo_surface_t *recording_surface);
CAIRO_END_DECLS
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index aaab313..9aa707f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -40,7 +40,7 @@
#include "cairo-surface-fallback-private.h"
#include "cairo-clip-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-region-private.h"
#include "cairo-tee-surface-private.h"
@@ -1059,8 +1059,8 @@ slim_hidden_def (cairo_surface_mark_dirty_rectangle);
*
* Private function for setting an extra scale factor to affect all
* drawing to a surface. This is used, for example, when replaying a
- * meta surface to an image fallback intended for an eventual
- * vector-oriented backend. Since the meta surface will record
+ * recording surface to an image fallback intended for an eventual
+ * vector-oriented backend. Since the recording surface will record
* coordinates in one backend space, but the image fallback uses a
* different backend space, (differing by the fallback resolution
* scale factors), we need a scale factor correction.
@@ -1410,17 +1410,17 @@ _cairo_surface_release_dest_image (cairo_surface_t *surface,
}
static cairo_status_t
-_cairo_meta_surface_clone_similar (cairo_surface_t *surface,
- cairo_surface_t *src,
- int src_x,
- int src_y,
- int width,
- int height,
- int *clone_offset_x,
- int *clone_offset_y,
- cairo_surface_t **clone_out)
-{
- cairo_meta_surface_t *meta = (cairo_meta_surface_t *) src;
+_cairo_recording_surface_clone_similar (cairo_surface_t *surface,
+ cairo_surface_t *src,
+ int src_x,
+ int src_y,
+ int width,
+ int height,
+ int *clone_offset_x,
+ int *clone_offset_y,
+ cairo_surface_t **clone_out)
+{
+ cairo_recording_surface_t *recorder = (cairo_recording_surface_t *) src;
cairo_surface_t *similar;
cairo_status_t status;
@@ -1434,8 +1434,8 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
- if (meta->unbounded ||
- width*height*8 < meta->extents.width*meta->extents.height)
+ if (recorder->unbounded ||
+ width*height*8 < recorder->extents.width*recorder->extents.height)
{
/* XXX use _solid to perform an initial CLEAR? */
similar = _cairo_surface_create_similar_scratch (surface,
@@ -1448,7 +1448,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_recording_surface_replay (src, similar);
if (unlikely (status)) {
cairo_surface_destroy (similar);
return status;
@@ -1456,14 +1456,14 @@ _cairo_meta_surface_clone_similar (cairo_surface_t *surface,
} else {
similar = _cairo_surface_create_similar_scratch (surface,
src->content,
- meta->extents.width,
- meta->extents.height);
+ recorder->extents.width,
+ recorder->extents.height);
if (similar == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (unlikely (similar->status))
return similar->status;
- status = _cairo_meta_surface_replay (src, similar);
+ status = _cairo_recording_surface_replay (src, similar);
if (unlikely (status)) {
cairo_surface_destroy (similar);
return status;
@@ -1548,13 +1548,13 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
return CAIRO_INT_STATUS_UNSUPPORTED;
/* First check to see if we can replay to a similar surface */
- if (_cairo_surface_is_meta (src)) {
- return _cairo_meta_surface_clone_similar (surface, src,
- src_x, src_y,
- width, height,
- clone_offset_x,
- clone_offset_y,
- clone_out);
+ if (_cairo_surface_is_recording (src)) {
+ return _cairo_recording_surface_clone_similar (surface, src,
+ src_x, src_y,
+ width, height,
+ clone_offset_x,
+ clone_offset_y,
+ clone_out);
}
/* If we failed, try again with an image surface */
@@ -1598,7 +1598,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
}
/* XXX: Shouldn't really need to do this here. */
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
/**
* _cairo_surface_snapshot
@@ -2339,7 +2339,7 @@ slim_hidden_def (cairo_surface_show_page);
* possibly be recorded, in other words, it is the maximum extent of
* potentially usable coordinates.
*
- * For vector surfaces, (PDF, PS, SVG and meta-surfaces), the surface
+ * For vector surfaces, (PDF, PS, SVG and recording-surfaces), the surface
* might be conceived as unbounded, but we force the user to provide a
* maximum size at the time of surface_create. So get_extents uses
* that size.
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 6277af1..fa25b82 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -44,7 +44,7 @@
#include "cairo-svg.h"
#include "cairo-analysis-surface-private.h"
#include "cairo-image-info-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-path-fixed-private.h"
#include "cairo-paginated-private.h"
@@ -1268,8 +1268,8 @@ _cairo_svg_surface_emit_composite_surface_pattern (cairo_output_stream_t *outp
}
static cairo_status_t
-_cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
- cairo_meta_surface_t *source)
+_cairo_svg_surface_emit_recording_surface (cairo_svg_document_t *document,
+ cairo_recording_surface_t *source)
{
cairo_status_t status;
cairo_surface_t *paginated_surface;
@@ -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_recording_surface_replay (&source->base, paginated_surface);
if (unlikely (status)) {
cairo_surface_destroy (paginated_surface);
return status;
@@ -1372,16 +1372,16 @@ _cairo_svg_surface_emit_meta_surface (cairo_svg_document_t *document,
}
static cairo_status_t
-_cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t *output,
- cairo_svg_surface_t *surface,
- cairo_operator_t op,
- cairo_surface_pattern_t *pattern,
- int pattern_id,
- const cairo_matrix_t *parent_matrix,
- const char *extra_attributes)
+_cairo_svg_surface_emit_composite_recording_pattern (cairo_output_stream_t *output,
+ cairo_svg_surface_t *surface,
+ cairo_operator_t op,
+ cairo_surface_pattern_t *pattern,
+ int pattern_id,
+ const cairo_matrix_t *parent_matrix,
+ const char *extra_attributes)
{
cairo_svg_document_t *document = surface->document;
- cairo_meta_surface_t *meta_surface;
+ cairo_recording_surface_t *recording_surface;
cairo_matrix_t p2u;
cairo_status_t status;
@@ -1390,8 +1390,8 @@ _cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t *output,
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_STATUS_SUCCESS);
- meta_surface = (cairo_meta_surface_t *) pattern->surface;
- status = _cairo_svg_surface_emit_meta_surface (document, meta_surface);
+ recording_surface = (cairo_recording_surface_t *) pattern->surface;
+ status = _cairo_svg_surface_emit_recording_surface (document, recording_surface);
if (unlikely (status))
return status;
@@ -1401,15 +1401,15 @@ _cairo_svg_surface_emit_composite_meta_pattern (cairo_output_stream_t *output,
"patternUnits=\"userSpaceOnUse\" "
"width=\"%d\" height=\"%d\"",
pattern_id,
- meta_surface->extents.width,
- meta_surface->extents.height);
+ recording_surface->extents.width,
+ recording_surface->extents.height);
_cairo_svg_surface_emit_transform (output, " patternTransform", &p2u, parent_matrix);
_cairo_output_stream_printf (output, ">\n");
}
_cairo_output_stream_printf (output,
"<use xlink:href=\"#surface%d\"",
- meta_surface->base.unique_id);
+ recording_surface->base.unique_id);
if (pattern_id == invalid_pattern_id) {
_cairo_svg_surface_emit_operator (output, surface, op);
@@ -1437,12 +1437,12 @@ _cairo_svg_surface_emit_composite_pattern (cairo_output_stream_t *output,
const char *extra_attributes)
{
- if (_cairo_surface_is_meta (pattern->surface)) {
- return _cairo_svg_surface_emit_composite_meta_pattern (output, surface,
- op, pattern,
- pattern_id,
- parent_matrix,
- extra_attributes);
+ if (_cairo_surface_is_recording (pattern->surface)) {
+ return _cairo_svg_surface_emit_composite_recording_pattern (output, surface,
+ op, pattern,
+ pattern_id,
+ parent_matrix,
+ extra_attributes);
}
return _cairo_svg_surface_emit_composite_surface_pattern (output, surface,
diff --git a/src/cairo-tee-surface.c b/src/cairo-tee-surface.c
index 56f3cc2..1111fa1 100644
--- a/src/cairo-tee-surface.c
+++ b/src/cairo-tee-surface.c
@@ -159,14 +159,14 @@ _cairo_tee_surface_snapshot (void *abstract_surface)
cairo_surface_wrapper_t *slaves;
int num_slaves, n;
- /* we prefer to use a meta surface for our snapshots */
- if (_cairo_surface_is_meta (surface->master.target))
+ /* we prefer to use a recording surface for our snapshots */
+ if (_cairo_surface_is_recording (surface->master.target))
return _cairo_surface_wrapper_snapshot (&surface->master);
num_slaves = _cairo_array_num_elements (&surface->slaves);
slaves = _cairo_array_index (&surface->slaves, 0);
for (n = 0; n < num_slaves; n++) {
- if (_cairo_surface_is_meta (slaves[n].target))
+ if (_cairo_surface_is_recording (slaves[n].target))
return _cairo_surface_wrapper_snapshot (&slaves[n]);
}
diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c
index f7699b8..6878bba 100644
--- a/src/cairo-type3-glyph-surface.c
+++ b/src/cairo-type3-glyph-surface.c
@@ -40,7 +40,7 @@
#include "cairo-type3-glyph-surface-private.h"
#include "cairo-output-stream-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-analysis-surface-private.h"
#include "cairo-surface-clipper-private.h"
@@ -438,7 +438,7 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
- CAIRO_SCALED_GLYPH_INFO_META_SURFACE,
+ CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE,
&scaled_glyph);
if (_cairo_status_is_error (status))
@@ -449,8 +449,8 @@ _cairo_type3_glyph_surface_analyze_glyph (void *abstract_surface,
goto cleanup;
}
- status = _cairo_meta_surface_replay (scaled_glyph->meta_surface,
- &surface->base);
+ status = _cairo_recording_surface_replay (scaled_glyph->recording_surface,
+ &surface->base);
if (unlikely (status))
goto cleanup;
@@ -493,7 +493,7 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface,
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS |
- CAIRO_SCALED_GLYPH_INFO_META_SURFACE,
+ CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE,
&scaled_glyph);
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
status = _cairo_scaled_glyph_lookup (surface->scaled_font,
@@ -544,8 +544,8 @@ _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,
- &surface->base);
+ status = _cairo_recording_surface_replay (scaled_glyph->recording_surface,
+ &surface->base);
status2 = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (status == CAIRO_STATUS_SUCCESS)
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 16b27c2..3a3b849 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -158,7 +158,7 @@ typedef enum _cairo_int_status {
CAIRO_INT_STATUS_NOTHING_TO_DO,
CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY,
CAIRO_INT_STATUS_IMAGE_FALLBACK,
- CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN,
+ CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN,
CAIRO_INT_STATUS_LAST_STATUS
} cairo_int_status_t;
diff --git a/src/cairo-user-font.c b/src/cairo-user-font.c
index 1cd5ffc..3304392 100644
--- a/src/cairo-user-font.c
+++ b/src/cairo-user-font.c
@@ -36,7 +36,7 @@
#include "cairoint.h"
#include "cairo-user-font-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-analysis-surface-private.h"
typedef struct _cairo_user_scaled_font_methods {
@@ -75,19 +75,19 @@ typedef struct _cairo_user_scaled_font {
/* #cairo_user_scaled_font_t */
static cairo_t *
-_cairo_user_scaled_font_create_meta_context (cairo_user_scaled_font_t *scaled_font)
+_cairo_user_scaled_font_create_recording_context (cairo_user_scaled_font_t *scaled_font)
{
cairo_content_t content;
- cairo_surface_t *meta_surface;
+ cairo_surface_t *recording_surface;
cairo_t *cr;
content = scaled_font->base.options.antialias == CAIRO_ANTIALIAS_SUBPIXEL ?
CAIRO_CONTENT_COLOR_ALPHA :
CAIRO_CONTENT_ALPHA;
- meta_surface = cairo_meta_surface_create (content, NULL);
- cr = cairo_create (meta_surface);
- cairo_surface_destroy (meta_surface);
+ recording_surface = cairo_recording_surface_create (content, NULL);
+ cr = cairo_create (recording_surface);
+ cairo_surface_destroy (recording_surface);
cairo_set_matrix (cr, &scaled_font->base.scale);
cairo_set_font_size (cr, 1.0);
@@ -104,15 +104,15 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
{
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
cairo_user_scaled_font_t *scaled_font = abstract_font;
- cairo_surface_t *meta_surface = scaled_glyph->meta_surface;
+ cairo_surface_t *recording_surface = scaled_glyph->recording_surface;
- if (!scaled_glyph->meta_surface) {
+ if (!scaled_glyph->recording_surface) {
cairo_user_font_face_t *face =
(cairo_user_font_face_t *) scaled_font->base.font_face;
cairo_text_extents_t extents = scaled_font->default_glyph_extents;
cairo_t *cr;
- cr = _cairo_user_scaled_font_create_meta_context (scaled_font);
+ cr = _cairo_user_scaled_font_create_recording_context (scaled_font);
if (face->scaled_font_methods.render_glyph) {
status = face->scaled_font_methods.render_glyph ((cairo_scaled_font_t *)scaled_font,
@@ -124,18 +124,18 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
if (status == CAIRO_STATUS_SUCCESS)
status = cairo_status (cr);
- meta_surface = cairo_surface_reference (cairo_get_target (cr));
+ recording_surface = cairo_surface_reference (cairo_get_target (cr));
cairo_destroy (cr);
if (unlikely (status)) {
- cairo_surface_destroy (meta_surface);
+ cairo_surface_destroy (recording_surface);
return status;
}
- _cairo_scaled_glyph_set_meta_surface (scaled_glyph,
- &scaled_font->base,
- meta_surface);
+ _cairo_scaled_glyph_set_recording_surface (scaled_glyph,
+ &scaled_font->base,
+ recording_surface);
/* set metrics */
@@ -145,12 +145,12 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
double x1, y1, x2, y2;
double x_scale, y_scale;
- /* Compute extents.x/y/width/height from meta_surface,
+ /* Compute extents.x/y/width/height from recording_surface,
* in font space.
*/
- status = _cairo_meta_surface_get_bbox ((cairo_meta_surface_t *) meta_surface,
- &bbox,
- &scaled_font->extent_scale);
+ status = _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface,
+ &bbox,
+ &scaled_font->extent_scale);
if (unlikely (status))
return status;
@@ -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_recording_surface_replay (recording_surface, surface);
if (unlikely (status)) {
cairo_surface_destroy(surface);
@@ -219,7 +219,7 @@ _cairo_user_scaled_glyph_init (void *abstract_font,
if (!path)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- status = _cairo_meta_surface_get_path (meta_surface, path);
+ status = _cairo_recording_surface_get_path (recording_surface, path);
if (unlikely (status)) {
_cairo_path_fixed_destroy (path);
return status;
@@ -421,7 +421,7 @@ _cairo_user_font_face_scaled_font_create (void *abstract_
if (status == CAIRO_STATUS_SUCCESS) {
cairo_t *cr;
- cr = _cairo_user_scaled_font_create_meta_context (user_scaled_font);
+ cr = _cairo_user_scaled_font_create_recording_context (user_scaled_font);
status = font_face->scaled_font_methods.init (&user_scaled_font->base,
cr,
diff --git a/src/cairo-vg-surface.c b/src/cairo-vg-surface.c
index de22c10..5ca01b6 100644
--- a/src/cairo-vg-surface.c
+++ b/src/cairo-vg-surface.c
@@ -39,7 +39,7 @@
#include "cairo-vg.h"
#include "cairo-path-fixed-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-surface-clipper-private.h"
#include "cairo-cache-private.h"
@@ -840,7 +840,7 @@ _vg_setup_solid_source (cairo_vg_context_t *context,
}
static cairo_vg_surface_t *
-_vg_clone_meta_surface (cairo_vg_context_t *context,
+_vg_clone_recording_surface (cairo_vg_context_t *context,
cairo_surface_t *surface)
{
VGImage vg_image;
@@ -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_recording_surface_replay (surface, &clone->base);
if (unlikely (status)) {
cairo_surface_destroy (&clone->base);
return (cairo_vg_surface_t *) _cairo_surface_create_in_error (status);
@@ -965,8 +965,8 @@ _vg_setup_surface_source (cairo_vg_context_t *context,
goto DONE;
}
- if (_cairo_surface_is_meta (spat->surface))
- clone = _vg_clone_meta_surface (context, spat->surface);
+ if (_cairo_surface_is_recording (spat->surface))
+ clone = _vg_clone_recording_surface (context, spat->surface);
else
clone = _vg_clone_image_surface (context, spat->surface);
if (clone == NULL)
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index 8203e6a..173c933 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -50,7 +50,7 @@
#include "cairo-clip-private.h"
#include "cairo-win32-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-image-info-private.h"
#include "cairo-surface-clipper-private.h"
@@ -195,7 +195,7 @@ analyze_surface_pattern_transparency (cairo_surface_pattern_t *pattern)
static cairo_bool_t
surface_pattern_supported (const cairo_surface_pattern_t *pattern)
{
- if (_cairo_surface_is_meta (pattern->surface))
+ if (_cairo_surface_is_recording (pattern->surface))
return TRUE;
if (cairo_surface_get_type (pattern->surface) != CAIRO_SURFACE_TYPE_WIN32 &&
@@ -238,8 +238,8 @@ _cairo_win32_printing_surface_analyze_operation (cairo_win32_surface_t *surface,
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
- if ( _cairo_surface_is_meta (surface_pattern->surface))
- return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+ if ( _cairo_surface_is_recording (surface_pattern->surface))
+ return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
}
if (op == CAIRO_OPERATOR_SOURCE ||
@@ -384,20 +384,20 @@ _cairo_win32_printing_surface_paint_solid_pattern (cairo_win32_surface_t *surfac
}
static cairo_status_t
-_cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surface,
- cairo_surface_pattern_t *pattern)
+_cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_surface_t *surface,
+ cairo_surface_pattern_t *pattern)
{
cairo_content_t old_content;
cairo_matrix_t old_ctm;
cairo_bool_t old_has_ctm;
- cairo_rectangle_int_t meta_extents;
+ cairo_rectangle_int_t recording_extents;
cairo_status_t status;
cairo_extend_t extend;
cairo_matrix_t p2d;
XFORM xform;
int x_tile, y_tile, left, right, top, bottom;
RECT clip;
- cairo_meta_surface_t *meta_surface = (cairo_meta_surface_t *) pattern->surface;
+ cairo_recording_surface_t *recording_surface = (cairo_recording_surface_t *) pattern->surface;
cairo_box_t bbox;
extend = cairo_pattern_get_extend (&pattern->base);
@@ -414,11 +414,11 @@ _cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surfa
SaveDC (surface->dc);
_cairo_matrix_to_win32_xform (&p2d, &xform);
- status = _cairo_meta_surface_get_bbox (meta_surface, &bbox, NULL);
+ status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL);
if (status)
return status;
- _cairo_box_round_to_rectangle (&bbox, &meta_extents);
+ _cairo_box_round_to_rectangle (&bbox, &recording_extents);
status = _cairo_win32_printing_surface_get_ctm_clip_box (surface, &clip);
if (status)
@@ -437,7 +437,7 @@ _cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surfa
}
old_content = surface->content;
- if (meta_surface->base.content == CAIRO_CONTENT_COLOR) {
+ if (recording_surface->base.content == CAIRO_CONTENT_COLOR) {
cairo_pattern_t *source;
cairo_solid_pattern_t black;
@@ -457,15 +457,15 @@ _cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surfa
SaveDC (surface->dc);
m = p2d;
cairo_matrix_translate (&m,
- x_tile*meta_extents.width,
- y_tile*meta_extents.height);
+ x_tile*recording_extents.width,
+ y_tile*recording_extents.height);
if (extend == CAIRO_EXTEND_REFLECT) {
if (x_tile % 2) {
- cairo_matrix_translate (&m, meta_extents.width, 0);
+ cairo_matrix_translate (&m, recording_extents.width, 0);
cairo_matrix_scale (&m, -1, 1);
}
if (y_tile % 2) {
- cairo_matrix_translate (&m, 0, meta_extents.height);
+ cairo_matrix_translate (&m, 0, recording_extents.height);
cairo_matrix_scale (&m, 1, -1);
}
}
@@ -480,18 +480,18 @@ _cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surfa
cairo_matrix_transform_point (&surface->ctm, &x, &y);
MoveToEx (surface->dc, (int) x, (int) y, NULL);
- x = meta_extents.width;
+ x = recording_extents.width;
y = 0;
cairo_matrix_transform_point (&surface->ctm, &x, &y);
LineTo (surface->dc, (int) x, (int) y);
- x = meta_extents.width;
- y = meta_extents.height;
+ x = recording_extents.width;
+ y = recording_extents.height;
cairo_matrix_transform_point (&surface->ctm, &x, &y);
LineTo (surface->dc, (int) x, (int) y);
x = 0;
- y = meta_extents.height;
+ y = recording_extents.height;
cairo_matrix_transform_point (&surface->ctm, &x, &y);
LineTo (surface->dc, (int) x, (int) y);
@@ -500,9 +500,9 @@ _cairo_win32_printing_surface_paint_meta_pattern (cairo_win32_surface_t *surfa
SelectClipPath (surface->dc, RGN_AND);
SaveDC (surface->dc); /* Allow clip path to be reset during replay */
- status = _cairo_meta_surface_replay_region (&meta_surface->base,
- &surface->base,
- CAIRO_META_REGION_NATIVE);
+ status = _cairo_recording_surface_replay_region (&recording_surface->base,
+ &surface->base,
+ CAIRO_RECORDING_REGION_NATIVE);
assert (status != CAIRO_INT_STATUS_UNSUPPORTED);
/* Restore both the clip save and our earlier path SaveDC */
RestoreDC (surface->dc, -2);
@@ -781,9 +781,9 @@ static cairo_status_t
_cairo_win32_printing_surface_paint_surface_pattern (cairo_win32_surface_t *surface,
cairo_surface_pattern_t *pattern)
{
- if (_cairo_surface_is_meta (pattern->surface)) {
- return _cairo_win32_printing_surface_paint_meta_pattern (surface,
- pattern);
+ if (_cairo_surface_is_recording (pattern->surface)) {
+ return _cairo_win32_printing_surface_paint_recording_pattern (surface,
+ pattern);
} else {
return _cairo_win32_printing_surface_paint_image_pattern (surface,
pattern);
@@ -1634,7 +1634,7 @@ _cairo_win32_printing_surface_create_similar (void *abstract_surface,
extents.x = extents.y = 0;
extents.width = width;
extents.height = height;
- return cairo_meta_surface_create (content, &extents);
+ return cairo_recording_surface_create (content, &extents);
}
static cairo_int_status_t
@@ -1650,16 +1650,16 @@ _cairo_win32_printing_surface_start_page (void *abstract_surface)
/* As the logical coordinates used by GDI functions (eg LineTo)
* are integers we need to do some additional work to prevent
- * rounding errors. For example the obvious way to paint a meta
+ * rounding errors. For example the obvious way to paint a recording
* pattern is to:
*
* SaveDC()
* transform the device context DC by the pattern to device matrix
- * replay the meta surface
+ * replay the recording surface
* RestoreDC()
*
* The problem here is that if the pattern to device matrix is
- * [100 0 0 100 0 0], coordinates in the meta pattern such as
+ * [100 0 0 100 0 0], coordinates in the recording pattern such as
* (1.56, 2.23) which correspond to (156, 223) in device space
* will be rounded to (100, 200) due to (1.56, 2.23) being
* truncated to integers.
@@ -1667,7 +1667,7 @@ _cairo_win32_printing_surface_start_page (void *abstract_surface)
* This is solved by saving the current GDI CTM in surface->ctm,
* switch the GDI CTM to identity, and transforming all
* coordinates by surface->ctm before passing them to GDI. When
- * painting a meta pattern, surface->ctm is transformed by the
+ * painting a recording pattern, surface->ctm is transformed by the
* pattern to device matrix.
*
* For printing device contexts where 1 unit is 1 dpi, switching
diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index c40f61f..25e0bb2 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -46,7 +46,7 @@
#include "cairo-clip-private.h"
#include "cairo-output-stream-private.h"
-#include "cairo-meta-surface-private.h"
+#include "cairo-recording-surface-private.h"
#define static cairo_warn static
@@ -69,7 +69,7 @@ struct _cairo_xml_surface {
double width, height;
};
-slim_hidden_proto (cairo_xml_for_meta_surface);
+slim_hidden_proto (cairo_xml_for_recording_surface);
static const cairo_xml_t _nil_xml = {
CAIRO_STATUS_NO_MEMORY,
@@ -348,7 +348,7 @@ _cairo_xml_surface_create_similar (void *abstract_surface,
extents.width = width;
extents.height = height;
- return cairo_meta_surface_create (content, &extents);
+ return cairo_recording_surface_create (content, &extents);
}
static cairo_status_t
@@ -623,8 +623,8 @@ _cairo_xml_emit_surface (cairo_xml_t *xml,
cairo_surface_t *source = pattern->surface;
cairo_status_t status;
- if (_cairo_surface_is_meta (source)) {
- status = cairo_xml_for_meta_surface (xml, source);
+ if (_cairo_surface_is_recording (source)) {
+ status = cairo_xml_for_recording_surface (xml, source);
} else {
cairo_image_surface_t *image;
void *image_extra;
@@ -1094,8 +1094,8 @@ cairo_xml_surface_create (cairo_xml_t *xml,
}
cairo_status_t
-cairo_xml_for_meta_surface (cairo_xml_t *xml,
- cairo_surface_t *meta)
+cairo_xml_for_recording_surface (cairo_xml_t *xml,
+ cairo_surface_t *recording_surface)
{
cairo_box_t bbox;
cairo_rectangle_int_t extents;
@@ -1105,20 +1105,20 @@ cairo_xml_for_meta_surface (cairo_xml_t *xml,
if (unlikely (xml->status))
return xml->status;
- if (unlikely (meta->status))
- return meta->status;
+ if (unlikely (recording_surface->status))
+ return recording_surface->status;
- if (unlikely (! _cairo_surface_is_meta (meta)))
+ if (unlikely (! _cairo_surface_is_recording (recording_surface)))
return _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
- status = _cairo_meta_surface_get_bbox ((cairo_meta_surface_t *) meta,
- &bbox, NULL);
+ status = _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface,
+ &bbox, NULL);
if (unlikely (status))
return status;
_cairo_box_round_to_rectangle (&bbox, &extents);
surface = _cairo_xml_surface_create_internal (xml,
- meta->content,
+ recording_surface->content,
extents.width,
extents.height);
if (unlikely (surface->status))
@@ -1126,12 +1126,12 @@ cairo_xml_for_meta_surface (cairo_xml_t *xml,
_cairo_xml_printf (xml,
"<surface content='%s' width='%d' height='%d'>",
- _content_to_string (meta->content),
+ _content_to_string (recording_surface->content),
extents.width, extents.height);
_cairo_xml_indent (xml, 2);
cairo_surface_set_device_offset (surface, -extents.x, -extents.y);
- status = _cairo_meta_surface_replay (meta, surface);
+ status = _cairo_recording_surface_replay (recording_surface, surface);
cairo_surface_destroy (surface);
_cairo_xml_indent (xml, -2);
@@ -1139,7 +1139,7 @@ cairo_xml_for_meta_surface (cairo_xml_t *xml,
return status;
}
-slim_hidden_def (cairo_xml_for_meta_surface);
+slim_hidden_def (cairo_xml_for_recording_surface);
void
cairo_xml_destroy (cairo_xml_t *xml)
diff --git a/src/cairo-xml.h b/src/cairo-xml.h
index 9bd1735..bba8adc 100644
--- a/src/cairo-xml.h
+++ b/src/cairo-xml.h
@@ -60,8 +60,8 @@ cairo_xml_surface_create (cairo_xml_t *xml,
double width, double height);
cairo_public cairo_status_t
-cairo_xml_for_meta_surface (cairo_xml_t *context,
- cairo_surface_t *meta);
+cairo_xml_for_recording_surface (cairo_xml_t *context,
+ cairo_surface_t *surface);
CAIRO_END_DECLS
diff --git a/src/cairo.c b/src/cairo.c
index 383dc89..8d16314 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1933,7 +1933,7 @@ cairo_stroke_to_path (cairo_t *cr)
if (unlikely (cr->status))
return;
- /* The code in _cairo_meta_surface_get_path has a poorman's stroke_to_path */
+ /* The code in _cairo_recording_surface_get_path has a poorman's stroke_to_path */
status = _cairo_gstate_stroke_path (cr->gstate);
if (unlikely (status))
diff --git a/src/cairo.h b/src/cairo.h
index a43eae8..8be8043 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1953,7 +1953,7 @@ cairo_surface_status (cairo_surface_t *surface);
* @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image
* @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10
* @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10
- * @CAIRO_SURFACE_TYPE_META: The surface is a meta-type, since 1.10
+ * @CAIRO_SURFACE_TYPE_RECORDING: The surface is of type recording, since 1.10
* @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10
* @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10
* @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10
@@ -2001,7 +2001,7 @@ typedef enum _cairo_surface_type {
CAIRO_SURFACE_TYPE_QUARTZ_IMAGE,
CAIRO_SURFACE_TYPE_SCRIPT,
CAIRO_SURFACE_TYPE_QT,
- CAIRO_SURFACE_TYPE_META,
+ CAIRO_SURFACE_TYPE_RECORDING,
CAIRO_SURFACE_TYPE_VG,
CAIRO_SURFACE_TYPE_GL,
CAIRO_SURFACE_TYPE_DRM,
@@ -2185,18 +2185,18 @@ cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func,
#endif
-/* Meta-surface functions */
+/* Recording-surface functions */
cairo_public cairo_surface_t *
-cairo_meta_surface_create (cairo_content_t content,
- const cairo_rectangle_t *extents);
+cairo_recording_surface_create (cairo_content_t content,
+ const cairo_rectangle_t *extents);
cairo_public void
-cairo_meta_surface_ink_extents (cairo_surface_t *surface,
- double *x0,
- double *y0,
- double *width,
- double *height);
+cairo_recording_surface_ink_extents (cairo_surface_t *surface,
+ double *x0,
+ double *y0,
+ double *width,
+ double *height);
/* Tee-surface functions */
diff --git a/src/cairoint.h b/src/cairoint.h
index c309f3d..d03fd87 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -392,7 +392,7 @@ typedef struct _cairo_scaled_glyph {
cairo_image_surface_t *surface; /* device-space image */
cairo_path_fixed_t *path; /* device-space outline */
- cairo_surface_t *meta_surface; /* device-space meta-surface */
+ cairo_surface_t *recording_surface; /* device-space recording-surface */
void *surface_private; /* for the surface backend */
} cairo_scaled_glyph_t;
@@ -441,7 +441,7 @@ typedef enum _cairo_scaled_glyph_info {
CAIRO_SCALED_GLYPH_INFO_METRICS = (1 << 0),
CAIRO_SCALED_GLYPH_INFO_SURFACE = (1 << 1),
CAIRO_SCALED_GLYPH_INFO_PATH = (1 << 2),
- CAIRO_SCALED_GLYPH_INFO_META_SURFACE = (1 << 3)
+ CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE = (1 << 3)
} cairo_scaled_glyph_info_t;
typedef struct _cairo_scaled_font_subset {
@@ -1700,9 +1700,9 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
cairo_path_fixed_t *path);
cairo_private void
-_cairo_scaled_glyph_set_meta_surface (cairo_scaled_glyph_t *scaled_glyph,
- cairo_scaled_font_t *scaled_font,
- cairo_surface_t *meta_surface);
+_cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph,
+ cairo_scaled_font_t *scaled_font,
+ cairo_surface_t *recording_surface);
cairo_private cairo_int_status_t
_cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
@@ -2210,7 +2210,7 @@ cairo_private cairo_bool_t
_cairo_surface_is_image (const cairo_surface_t *surface) cairo_pure;
cairo_private cairo_bool_t
-_cairo_surface_is_meta (const cairo_surface_t *surface) cairo_pure;
+_cairo_surface_is_recording (const cairo_surface_t *surface) cairo_pure;
/* cairo-pen.c */
cairo_private cairo_status_t
diff --git a/test/Makefile.am b/test/Makefile.am
index 6e3d2df..8bbce94 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -634,19 +634,19 @@ REFERENCE_IMAGES = \
mask.svg.rgb24.xfail.png \
mask.xlib.ref.png \
mask.xlib.rgb24.ref.png \
- meta-surface-pattern.gl.argb32.ref.png \
- meta-surface-pattern.pdf.argb32.ref.png \
- meta-surface-pattern.pdf.rgb24.ref.png \
- meta-surface-pattern.ps2.argb32.ref.png \
- meta-surface-pattern.ps2.rgb24.ref.png \
- meta-surface-pattern.ps3.argb32.ref.png \
- meta-surface-pattern.ps3.rgb24.ref.png \
- meta-surface-pattern.quartz.ref.png \
- meta-surface-pattern.quartz.rgb24.ref.png \
- meta-surface-pattern.ref.png \
- meta-surface-pattern.rgb24.ref.png \
- meta-surface-pattern.svg.argb32.ref.png \
- meta-surface-pattern.svg.rgb24.ref.png \
+ recording-surface-pattern.gl.argb32.ref.png \
+ recording-surface-pattern.pdf.argb32.ref.png \
+ recording-surface-pattern.pdf.rgb24.ref.png \
+ recording-surface-pattern.ps2.argb32.ref.png \
+ recording-surface-pattern.ps2.rgb24.ref.png \
+ recording-surface-pattern.ps3.argb32.ref.png \
+ recording-surface-pattern.ps3.rgb24.ref.png \
+ recording-surface-pattern.quartz.ref.png \
+ recording-surface-pattern.quartz.rgb24.ref.png \
+ recording-surface-pattern.ref.png \
+ recording-surface-pattern.rgb24.ref.png \
+ recording-surface-pattern.svg.argb32.ref.png \
+ recording-surface-pattern.svg.rgb24.ref.png \
mime-data.pdf.ref.png \
mime-data.ps.ref.png \
mime-data.ref.png \
@@ -839,7 +839,7 @@ REFERENCE_IMAGES = \
scale-offset-similar.ps.ref.png \
scale-offset-similar.ref.png \
scale-offset-similar.xfail.png \
- scale-offset-similar.meta.xfail.png \
+ scale-offset-similar.recording.xfail.png \
scale-offset-similar.script.xfail.png \
scale-offset-similar.xlib.xfail.png \
scale-offset-similar.xlib-fallback.xfail.png \
@@ -1087,13 +1087,13 @@ $(REFERENCE_IMAGES)
# manipulation for SVG
# extend-pad - lacks implementation in pixman and consequently used
# as an excuse for lack of support in other backends
-# fallback-resolution - The essential problem here is that the meta-surface
+# fallback-resolution - The essential problem here is that the recording-surface
# has recorded a sequence of operations with one device
# transformation, and we attempt to replay it with
# another (basically a scale-factor for the falback
# resolution). Carl begun to look at this with his
# chain-of-bugs, but the can of worms is much bigger.
-# It appears to be a design flaw in the meta-surface
+# It appears to be a design flaw in the recording-surface
# that may spread further...
# My solution would be to lock Behad and Adrian in a
# room, with Carl as a moderator and not let them out
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 5afa7bc..f9c2acb 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -131,7 +131,7 @@ test_sources = \
mask-surface-ctm.c \
mask-transformed-image.c \
mask-transformed-similar.c \
- meta-surface-pattern.c \
+ recording-surface-pattern.c \
mime-data.c \
miter-precision.c \
move-to-show-surface.c \
diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c
index 2401d17..b7cae20 100644
--- a/test/cairo-test-trace.c
+++ b/test/cairo-test-trace.c
@@ -116,7 +116,7 @@ typedef struct _test_runner {
const char *trace;
pid_t pid;
int sk;
- cairo_bool_t is_meta;
+ cairo_bool_t is_recording;
cairo_script_interpreter_t *csi;
struct context_closure {
@@ -144,7 +144,7 @@ struct slave {
buffer_diff_result_t result;
const cairo_boilerplate_target_t *target;
const struct slave *reference;
- cairo_bool_t is_meta;
+ cairo_bool_t is_recording;
};
struct request_image {
@@ -163,7 +163,7 @@ struct surface_tag {
static const cairo_user_data_key_t surface_tag;
#if CAIRO_HAS_PTHREAD
-#define tr_die(t) t->is_meta ? pthread_exit(NULL) : exit(1)
+#define tr_die(t) t->is_recording ? pthread_exit(NULL) : exit(1)
#else
#define tr_die(t) exit(1)
#endif
@@ -241,9 +241,9 @@ format_for_content (cairo_content_t content)
}
static void
-send_meta_surface (test_runner_t *tr,
- int width, int height,
- struct context_closure *closure)
+send_recording_surface (test_runner_t *tr,
+ int width, int height,
+ struct context_closure *closure)
{
#if CAIRO_HAS_PTHREAD
const struct request_image rq = {
@@ -258,7 +258,7 @@ send_meta_surface (test_runner_t *tr,
unsigned long serial;
if (DEBUG > 1) {
- printf ("send-meta-surface: %lu [%lu, %lu]\n",
+ printf ("send-recording-surface: %lu [%lu, %lu]\n",
closure->id,
closure->start_line,
closure->end_line);
@@ -273,7 +273,7 @@ send_meta_surface (test_runner_t *tr,
serial = 0;
readn (tr->sk, &serial, sizeof (serial));
if (DEBUG > 1) {
- printf ("send-meta-surface: serial: %lu\n", serial);
+ printf ("send-recording-surface: serial: %lu\n", serial);
}
if (serial != closure->id)
pthread_exit (NULL);
@@ -350,8 +350,8 @@ send_surface (test_runner_t *tr,
}
}
- if (tr->is_meta) {
- send_meta_surface (tr, width, height, closure);
+ if (tr->is_recording) {
+ send_recording_surface (tr, width, height, closure);
return;
}
@@ -542,7 +542,7 @@ spawn_target (const char *socket_path,
if (pid != 0)
return pid;
- tr.is_meta = FALSE;
+ tr.is_recording = FALSE;
tr.pid = getpid ();
tr.sk = spawn_socket (socket_path, tr.pid);
@@ -636,7 +636,7 @@ spawn_recorder (const char *socket_path, const char *trace)
if (tr == NULL)
return -1;
- tr->is_meta = TRUE;
+ tr->is_recording = TRUE;
tr->pid = pid;
tr->sk = spawn_socket (socket_path, tr->pid);
if (tr->sk == -1) {
@@ -650,7 +650,7 @@ spawn_recorder (const char *socket_path, const char *trace)
tr->context_id = 0;
tr->trace = trace;
- tr->surface = cairo_meta_surface_create (CAIRO_CONTENT_COLOR_ALPHA,
+ tr->surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA,
0, 0);
if (tr->surface == NULL) {
cleanup_recorder (tr);
@@ -840,7 +840,7 @@ static void
write_images (const char *trace, struct slave *slave, int num_slaves)
{
while (num_slaves--) {
- if (slave->image != NULL && ! slave->is_meta) {
+ if (slave->image != NULL && ! slave->is_recording) {
char *filename;
xasprintf (&filename, "%s-%s-fail.png",
@@ -916,8 +916,8 @@ allocate_image_for_slave (uint8_t *base,
offset);
}
- if (slave->is_meta) {
- /* special communication with meta-surface thread */
+ if (slave->is_recording) {
+ /* special communication with recording-surface thread */
slave->image = cairo_surface_reference ((cairo_surface_t *) rq.stride);
} else {
size = rq.height * rq.stride;
@@ -1045,7 +1045,7 @@ test_run (void *base,
goto out;
/* Can anyone spell 'P·E·D·A·N·T'? */
- if (! slaves[i].is_meta)
+ if (! slaves[i].is_recording)
cairo_surface_mark_dirty (slaves[i].image);
completion++;
}
@@ -1075,7 +1075,7 @@ test_run (void *base,
write_images (trace, slaves, num_slaves);
- if (slaves[0].is_meta)
+ if (slaves[0].is_recording)
write_trace (trace, &slaves[0]);
goto out;
@@ -1173,7 +1173,7 @@ target_is_measurable (const cairo_boilerplate_target_t *target)
case CAIRO_SURFACE_TYPE_SCRIPT:
case CAIRO_SURFACE_TYPE_SVG:
case CAIRO_SURFACE_TYPE_WIN32_PRINTING:
- case CAIRO_SURFACE_TYPE_META:
+ case CAIRO_SURFACE_TYPE_RECORDING:
default:
return FALSE;
}
@@ -1275,15 +1275,15 @@ _test_trace (test_trace_t *test,
s = slaves = xcalloc (2*test->num_targets + 1, sizeof (struct slave));
#if CAIRO_HAS_PTHREAD
- /* set-up a meta-surface to reconstruct errors */
+ /* set-up a recording-surface to reconstruct errors */
slave = spawn_recorder (socket_path, trace);
if (slave < 0) {
- fprintf (stderr, "Unable to create meta surface\n");
+ fprintf (stderr, "Unable to create recording surface\n");
goto cleanup_sk;
}
s->pid = slave;
- s->is_meta = TRUE;
+ s->is_recording = TRUE;
s->target = NULL;
s->fd = -1;
s->reference = NULL;
@@ -1355,7 +1355,7 @@ cleanup:
while (s-- > slaves) {
int status;
- if (s->is_meta) /* in-process */
+ if (s->is_recording) /* in-process */
continue;
kill (s->pid, SIGKILL);
@@ -1568,7 +1568,7 @@ parse_options (test_trace_t *test, int argc, char *argv[])
static void
test_reset (test_trace_t *test)
{
- /* XXX leaking fonts again via meta-surface? */
+ /* XXX leaking fonts again via recording-surface? */
#if 0
cairo_debug_reset_static_data ();
#if HAVE_FCFINI
diff --git a/test/cairo-test.c b/test/cairo-test.c
index edc9ae5..5d6858c 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -824,10 +824,10 @@ cairo_test_for_target (cairo_test_context_t *ctx,
goto UNWIND_STRINGS;
}
- required = target->is_meta ? "target=!meta" : "target=meta";
+ required = target->is_recording ? "target=!recording" : "target=recording";
if (strstr (ctx->test->requirements, required) != NULL) {
cairo_test_log (ctx, "Error: Skipping for %s target %s\n",
- target->is_meta ? "meta" : "non-meta",
+ target->is_recording ? "recording" : "non-recording",
target->name);
ret = CAIRO_TEST_UNTESTED;
goto UNWIND_STRINGS;
@@ -1016,7 +1016,7 @@ REPEAT:
if (target->finish_surface != NULL) {
#if HAVE_MEMFAULT
- /* We need to re-enable faults as most meta-surface processing
+ /* We need to re-enable faults as most recording-surface processing
* is done during cairo_surface_finish().
*/
MEMFAULT_CLEAR_FAULTS ();
diff --git a/test/meta-surface-pattern.c b/test/meta-surface-pattern.c
deleted file mode 100644
index 9fd1235..0000000
--- a/test/meta-surface-pattern.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright © 2007 Adrian Johnson
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Author: Adrian Johnson <ajohnson at redneon.com>
- */
-
-#include "cairo-test.h"
-
-#define PAT_WIDTH 120
-#define PAT_HEIGHT 120
-#define SIZE (PAT_WIDTH*2)
-#define PAD 2
-#define WIDTH (PAD + SIZE + PAD)
-#define HEIGHT WIDTH
-
-
-/* This test is designed to test painting a meta surface pattern with
- * CAIRO_EXTEND_NONE and a non identity pattern matrix.
- */
-
-static cairo_test_status_t
-draw (cairo_t *cr, int width, int height)
-{
- cairo_surface_t *pat_surface;
- cairo_pattern_t *pattern;
- cairo_matrix_t mat;
- cairo_t *cr2;
-
- cairo_translate (cr, PAD, PAD);
-
- pat_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
- CAIRO_CONTENT_COLOR_ALPHA,
- PAT_WIDTH, PAT_HEIGHT);
- cr2 = cairo_create (pat_surface);
- cairo_surface_destroy (pat_surface);
-
- cairo_set_source_rgba (cr2, 1, 0, 1, 0.5);
- cairo_rectangle (cr2, PAT_WIDTH/6.0, PAT_HEIGHT/6.0, PAT_WIDTH/4.0, PAT_HEIGHT/4.0);
- cairo_fill (cr2);
-
- cairo_set_source_rgba (cr2, 0, 1, 1, 0.5);
- cairo_rectangle (cr2, PAT_WIDTH/2.0, PAT_HEIGHT/2.0, PAT_WIDTH/4.0, PAT_HEIGHT/4.0);
- cairo_fill (cr2);
-
- cairo_set_line_width (cr2, 1);
- cairo_move_to (cr2, PAT_WIDTH/6.0, 0);
- cairo_line_to (cr2, 0, 0);
- cairo_line_to (cr2, 0, PAT_HEIGHT/6.0);
- cairo_set_source_rgb (cr2, 1, 0, 0);
- cairo_stroke (cr2);
- cairo_move_to (cr2, PAT_WIDTH/6.0, PAT_HEIGHT);
- cairo_line_to (cr2, 0, PAT_HEIGHT);
- cairo_line_to (cr2, 0, 5*PAT_HEIGHT/6.0);
- cairo_set_source_rgb (cr2, 0, 1, 0);
- cairo_stroke (cr2);
- cairo_move_to (cr2, 5*PAT_WIDTH/6.0, 0);
- cairo_line_to (cr2, PAT_WIDTH, 0);
- cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT/6.0);
- cairo_set_source_rgb (cr2, 0, 0, 1);
- cairo_stroke (cr2);
- cairo_move_to (cr2, 5*PAT_WIDTH/6.0, PAT_HEIGHT);
- cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT);
- cairo_line_to (cr2, PAT_WIDTH, 5*PAT_HEIGHT/6.0);
- cairo_set_source_rgb (cr2, 1, 1, 0);
- cairo_stroke (cr2);
-
- cairo_set_source_rgb (cr2, 0.5, 0.5, 0.5);
- cairo_set_line_width (cr2, PAT_WIDTH/10.0);
-
- cairo_move_to (cr2, 0, PAT_HEIGHT/4.0);
- cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT/4.0);
- cairo_stroke (cr2);
-
- cairo_move_to (cr2, PAT_WIDTH/4.0, 0);
- cairo_line_to (cr2, PAT_WIDTH/4.0, PAT_WIDTH);
- cairo_stroke (cr2);
-
- pattern = cairo_pattern_create_for_surface (cairo_get_target (cr2));
- cairo_destroy (cr2);
-
- cairo_matrix_init_identity (&mat);
- cairo_matrix_scale (&mat, 2, 1.5);
- cairo_matrix_rotate (&mat, 1);
- cairo_matrix_translate (&mat, -PAT_WIDTH/4.0, -PAT_WIDTH/2.0);
- cairo_pattern_set_matrix (pattern, &mat);
- cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);
-
- cairo_set_source (cr, pattern);
- cairo_paint (cr);
-
- cairo_pattern_destroy (pattern);
-
- return CAIRO_TEST_SUCCESS;
-}
-
-CAIRO_TEST (meta_surface_pattern,
- "Paint meta surface pattern with non identity pattern matrix",
- "meta", /* keywords */
- NULL, /* requirements */
- WIDTH, HEIGHT,
- NULL, draw)
diff --git a/test/meta-surface-pattern.gl.argb32.ref.png b/test/meta-surface-pattern.gl.argb32.ref.png
deleted file mode 100644
index 50e6f5a..0000000
Binary files a/test/meta-surface-pattern.gl.argb32.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.pdf.argb32.ref.png b/test/meta-surface-pattern.pdf.argb32.ref.png
deleted file mode 100644
index a06386b..0000000
Binary files a/test/meta-surface-pattern.pdf.argb32.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.pdf.rgb24.ref.png b/test/meta-surface-pattern.pdf.rgb24.ref.png
deleted file mode 100644
index bf69f9e..0000000
Binary files a/test/meta-surface-pattern.pdf.rgb24.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.ps2.argb32.ref.png b/test/meta-surface-pattern.ps2.argb32.ref.png
deleted file mode 100644
index fbd58ef..0000000
Binary files a/test/meta-surface-pattern.ps2.argb32.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.ps2.rgb24.ref.png b/test/meta-surface-pattern.ps2.rgb24.ref.png
deleted file mode 100644
index 84da8da..0000000
Binary files a/test/meta-surface-pattern.ps2.rgb24.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.ps3.argb32.ref.png b/test/meta-surface-pattern.ps3.argb32.ref.png
deleted file mode 100644
index fbd58ef..0000000
Binary files a/test/meta-surface-pattern.ps3.argb32.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.ps3.rgb24.ref.png b/test/meta-surface-pattern.ps3.rgb24.ref.png
deleted file mode 100644
index 84da8da..0000000
Binary files a/test/meta-surface-pattern.ps3.rgb24.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.quartz.ref.png b/test/meta-surface-pattern.quartz.ref.png
deleted file mode 100644
index 755f281..0000000
Binary files a/test/meta-surface-pattern.quartz.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.quartz.rgb24.ref.png b/test/meta-surface-pattern.quartz.rgb24.ref.png
deleted file mode 100644
index b71891e..0000000
Binary files a/test/meta-surface-pattern.quartz.rgb24.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.ref.png b/test/meta-surface-pattern.ref.png
deleted file mode 100644
index 7f9c56c..0000000
Binary files a/test/meta-surface-pattern.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.rgb24.ref.png b/test/meta-surface-pattern.rgb24.ref.png
deleted file mode 100644
index 2de298d..0000000
Binary files a/test/meta-surface-pattern.rgb24.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.svg.argb32.ref.png b/test/meta-surface-pattern.svg.argb32.ref.png
deleted file mode 100644
index ff4154d..0000000
Binary files a/test/meta-surface-pattern.svg.argb32.ref.png and /dev/null differ
diff --git a/test/meta-surface-pattern.svg.rgb24.ref.png b/test/meta-surface-pattern.svg.rgb24.ref.png
deleted file mode 100644
index d2d5372..0000000
Binary files a/test/meta-surface-pattern.svg.rgb24.ref.png and /dev/null differ
diff --git a/test/recording-surface-pattern.c b/test/recording-surface-pattern.c
new file mode 100644
index 0000000..c8768f9
--- /dev/null
+++ b/test/recording-surface-pattern.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright © 2007 Adrian Johnson
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Adrian Johnson <ajohnson at redneon.com>
+ */
+
+#include "cairo-test.h"
+
+#define PAT_WIDTH 120
+#define PAT_HEIGHT 120
+#define SIZE (PAT_WIDTH*2)
+#define PAD 2
+#define WIDTH (PAD + SIZE + PAD)
+#define HEIGHT WIDTH
+
+
+/* This test is designed to test painting a recording surface pattern with
+ * CAIRO_EXTEND_NONE and a non identity pattern matrix.
+ */
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+ cairo_surface_t *pat_surface;
+ cairo_pattern_t *pattern;
+ cairo_matrix_t mat;
+ cairo_t *cr2;
+
+ cairo_translate (cr, PAD, PAD);
+
+ pat_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
+ CAIRO_CONTENT_COLOR_ALPHA,
+ PAT_WIDTH, PAT_HEIGHT);
+ cr2 = cairo_create (pat_surface);
+ cairo_surface_destroy (pat_surface);
+
+ cairo_set_source_rgba (cr2, 1, 0, 1, 0.5);
+ cairo_rectangle (cr2, PAT_WIDTH/6.0, PAT_HEIGHT/6.0, PAT_WIDTH/4.0, PAT_HEIGHT/4.0);
+ cairo_fill (cr2);
+
+ cairo_set_source_rgba (cr2, 0, 1, 1, 0.5);
+ cairo_rectangle (cr2, PAT_WIDTH/2.0, PAT_HEIGHT/2.0, PAT_WIDTH/4.0, PAT_HEIGHT/4.0);
+ cairo_fill (cr2);
+
+ cairo_set_line_width (cr2, 1);
+ cairo_move_to (cr2, PAT_WIDTH/6.0, 0);
+ cairo_line_to (cr2, 0, 0);
+ cairo_line_to (cr2, 0, PAT_HEIGHT/6.0);
+ cairo_set_source_rgb (cr2, 1, 0, 0);
+ cairo_stroke (cr2);
+ cairo_move_to (cr2, PAT_WIDTH/6.0, PAT_HEIGHT);
+ cairo_line_to (cr2, 0, PAT_HEIGHT);
+ cairo_line_to (cr2, 0, 5*PAT_HEIGHT/6.0);
+ cairo_set_source_rgb (cr2, 0, 1, 0);
+ cairo_stroke (cr2);
+ cairo_move_to (cr2, 5*PAT_WIDTH/6.0, 0);
+ cairo_line_to (cr2, PAT_WIDTH, 0);
+ cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT/6.0);
+ cairo_set_source_rgb (cr2, 0, 0, 1);
+ cairo_stroke (cr2);
+ cairo_move_to (cr2, 5*PAT_WIDTH/6.0, PAT_HEIGHT);
+ cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT);
+ cairo_line_to (cr2, PAT_WIDTH, 5*PAT_HEIGHT/6.0);
+ cairo_set_source_rgb (cr2, 1, 1, 0);
+ cairo_stroke (cr2);
+
+ cairo_set_source_rgb (cr2, 0.5, 0.5, 0.5);
+ cairo_set_line_width (cr2, PAT_WIDTH/10.0);
+
+ cairo_move_to (cr2, 0, PAT_HEIGHT/4.0);
+ cairo_line_to (cr2, PAT_WIDTH, PAT_HEIGHT/4.0);
+ cairo_stroke (cr2);
+
+ cairo_move_to (cr2, PAT_WIDTH/4.0, 0);
+ cairo_line_to (cr2, PAT_WIDTH/4.0, PAT_WIDTH);
+ cairo_stroke (cr2);
+
+ pattern = cairo_pattern_create_for_surface (cairo_get_target (cr2));
+ cairo_destroy (cr2);
+
+ cairo_matrix_init_identity (&mat);
+ cairo_matrix_scale (&mat, 2, 1.5);
+ cairo_matrix_rotate (&mat, 1);
+ cairo_matrix_translate (&mat, -PAT_WIDTH/4.0, -PAT_WIDTH/2.0);
+ cairo_pattern_set_matrix (pattern, &mat);
+ cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);
+
+ cairo_set_source (cr, pattern);
+ cairo_paint (cr);
+
+ cairo_pattern_destroy (pattern);
+
+ return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (recording_surface_pattern,
+ "Paint recording surface pattern with non identity pattern matrix",
+ "recording", /* keywords */
+ NULL, /* requirements */
+ WIDTH, HEIGHT,
+ NULL, draw)
diff --git a/test/recording-surface-pattern.gl.argb32.ref.png b/test/recording-surface-pattern.gl.argb32.ref.png
new file mode 100644
index 0000000..50e6f5a
Binary files /dev/null and b/test/recording-surface-pattern.gl.argb32.ref.png differ
diff --git a/test/recording-surface-pattern.pdf.argb32.ref.png b/test/recording-surface-pattern.pdf.argb32.ref.png
new file mode 100644
index 0000000..a06386b
Binary files /dev/null and b/test/recording-surface-pattern.pdf.argb32.ref.png differ
diff --git a/test/recording-surface-pattern.pdf.rgb24.ref.png b/test/recording-surface-pattern.pdf.rgb24.ref.png
new file mode 100644
index 0000000..bf69f9e
Binary files /dev/null and b/test/recording-surface-pattern.pdf.rgb24.ref.png differ
diff --git a/test/recording-surface-pattern.ps2.argb32.ref.png b/test/recording-surface-pattern.ps2.argb32.ref.png
new file mode 100644
index 0000000..fbd58ef
Binary files /dev/null and b/test/recording-surface-pattern.ps2.argb32.ref.png differ
diff --git a/test/recording-surface-pattern.ps2.rgb24.ref.png b/test/recording-surface-pattern.ps2.rgb24.ref.png
new file mode 100644
index 0000000..84da8da
Binary files /dev/null and b/test/recording-surface-pattern.ps2.rgb24.ref.png differ
diff --git a/test/recording-surface-pattern.ps3.argb32.ref.png b/test/recording-surface-pattern.ps3.argb32.ref.png
new file mode 100644
index 0000000..fbd58ef
Binary files /dev/null and b/test/recording-surface-pattern.ps3.argb32.ref.png differ
diff --git a/test/recording-surface-pattern.ps3.rgb24.ref.png b/test/recording-surface-pattern.ps3.rgb24.ref.png
new file mode 100644
index 0000000..84da8da
Binary files /dev/null and b/test/recording-surface-pattern.ps3.rgb24.ref.png differ
diff --git a/test/recording-surface-pattern.quartz.ref.png b/test/recording-surface-pattern.quartz.ref.png
new file mode 100644
index 0000000..755f281
Binary files /dev/null and b/test/recording-surface-pattern.quartz.ref.png differ
diff --git a/test/recording-surface-pattern.quartz.rgb24.ref.png b/test/recording-surface-pattern.quartz.rgb24.ref.png
new file mode 100644
index 0000000..b71891e
Binary files /dev/null and b/test/recording-surface-pattern.quartz.rgb24.ref.png differ
diff --git a/test/recording-surface-pattern.ref.png b/test/recording-surface-pattern.ref.png
new file mode 100644
index 0000000..7f9c56c
Binary files /dev/null and b/test/recording-surface-pattern.ref.png differ
diff --git a/test/recording-surface-pattern.rgb24.ref.png b/test/recording-surface-pattern.rgb24.ref.png
new file mode 100644
index 0000000..2de298d
Binary files /dev/null and b/test/recording-surface-pattern.rgb24.ref.png differ
diff --git a/test/recording-surface-pattern.svg.argb32.ref.png b/test/recording-surface-pattern.svg.argb32.ref.png
new file mode 100644
index 0000000..ff4154d
Binary files /dev/null and b/test/recording-surface-pattern.svg.argb32.ref.png differ
diff --git a/test/recording-surface-pattern.svg.rgb24.ref.png b/test/recording-surface-pattern.svg.rgb24.ref.png
new file mode 100644
index 0000000..d2d5372
Binary files /dev/null and b/test/recording-surface-pattern.svg.rgb24.ref.png differ
diff --git a/test/scale-offset-similar.meta.xfail.png b/test/scale-offset-similar.meta.xfail.png
deleted file mode 100644
index 0f2553e..0000000
Binary files a/test/scale-offset-similar.meta.xfail.png and /dev/null differ
diff --git a/test/scale-offset-similar.recording.xfail.png b/test/scale-offset-similar.recording.xfail.png
new file mode 100644
index 0000000..0f2553e
Binary files /dev/null and b/test/scale-offset-similar.recording.xfail.png differ
diff --git a/util/cairo-fdr/fdr.c b/util/cairo-fdr/fdr.c
index 9890024..05c77e5 100644
--- a/util/cairo-fdr/fdr.c
+++ b/util/cairo-fdr/fdr.c
@@ -52,11 +52,11 @@ static int fdr_dump;
static const cairo_user_data_key_t fdr_key;
static void
-fdr_replay_to_script (cairo_surface_t *meta, cairo_script_context_t *ctx)
+fdr_replay_to_script (cairo_surface_t *recording, cairo_script_context_t *ctx)
{
- if (meta != NULL) {
+ if (recording != NULL) {
DLCALL (cairo_script_context_write_comment, ctx, "--- fdr ---", -1);
- DLCALL (cairo_script_from_meta_surface, ctx, meta);
+ DLCALL (cairo_script_from_recording_surface, ctx, recording);
}
}
@@ -163,7 +163,7 @@ cairo_create (cairo_surface_t *surface)
content = DLCALL (cairo_surface_get_content, surface);
tee = DLCALL (cairo_tee_surface_create, surface);
- record = DLCALL (cairo_meta_surface_create, content, &extents);
+ record = DLCALL (cairo_recording_surface_create, content, &extents);
DLCALL (cairo_tee_surface_add, tee, record);
DLCALL (cairo_surface_set_user_data, surface,
diff --git a/util/cairo-sphinx/sphinx.c b/util/cairo-sphinx/sphinx.c
index d6ccfc7..9fb5ce0 100644
--- a/util/cairo-sphinx/sphinx.c
+++ b/util/cairo-sphinx/sphinx.c
@@ -217,7 +217,7 @@ struct clients {
int count, size;
int complete;
- cairo_surface_t *meta;
+ cairo_surface_t *recording;
unsigned long serial;
struct client_info {
@@ -274,7 +274,7 @@ clients_init (struct clients *clients)
return -1;
clients->offset = 0;
- clients->meta = NULL;
+ clients->recording = NULL;
clients->serial = 0;
return 0;
@@ -675,7 +675,7 @@ write_trace (struct clients *clients)
mkdir ("output", 0777);
ctx = cairo_script_context_create ("output/cairo-sphinx.trace");
- cairo_script_from_meta_surface (ctx, clients->meta);
+ cairo_script_from_recording_surface (ctx, clients->recording);
cairo_script_context_destroy (ctx);
csum = checksum ("output/cairo-sphinx.trace");
@@ -684,8 +684,8 @@ write_trace (struct clients *clients)
if (! g_file_test (buf, G_FILE_TEST_EXISTS)) {
rename ("output/cairo-sphinx.trace", buf);
- sprintf (buf, "output/%s.meta.png", csum);
- cairo_surface_write_to_png (clients->meta, buf);
+ sprintf (buf, "output/%s.recording.png", csum);
+ cairo_surface_write_to_png (clients->recording, buf);
for (i = 0; i < clients->count; i++) {
struct client_info *c = &clients->clients[i];
@@ -732,14 +732,14 @@ clients_complete (struct clients *clients, int fd)
c->image_serial = 0;
}
- clients->meta = NULL;
+ clients->recording = NULL;
clients->serial = 0;
}
static void
-clients_meta (struct clients *clients, int fd, char *info)
+clients_recording (struct clients *clients, int fd, char *info)
{
- sscanf (info, "%p %lu", &clients->meta, &clients->serial);
+ sscanf (info, "%p %lu", &clients->recording, &clients->serial);
clients_complete (clients, fd);
}
@@ -940,16 +940,16 @@ send_surface (struct client *c,
}
static void
-send_meta (struct client *c,
- struct context_closure *closure)
+send_recording (struct client *c,
+ struct context_closure *closure)
{
cairo_surface_t *source = closure->surface;
char buf[1024];
int len;
unsigned long serial;
- assert (cairo_surface_get_type (source) == CAIRO_SURFACE_TYPE_META);
- len = sprintf (buf, ".meta %p %lu\n", source, closure->id);
+ assert (cairo_surface_get_type (source) == CAIRO_SURFACE_TYPE_RECORDING);
+ len = sprintf (buf, ".recording %p %lu\n", source, closure->id);
writen (c->sk, buf, len);
/* wait for image check */
@@ -1001,7 +1001,7 @@ _context_create (void *closure, cairo_surface_t *surface)
/* record everything, including writes to images */
if (c->target == NULL) {
- if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_META) {
+ if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_RECORDING) {
cairo_format_t format;
int width, height;
@@ -1032,7 +1032,7 @@ _context_destroy (void *closure, void *ptr)
if (l->context == ptr) {
if (cairo_surface_status (l->surface) == CAIRO_STATUS_SUCCESS) {
if (c->target == NULL)
- send_meta (c, l);
+ send_recording (c, l);
else
send_surface (c, l);
} else {
@@ -1071,7 +1071,7 @@ recorder (void *arg)
buf_size = 65536;
buf = xmalloc (buf_size);
- len = sprintf (buf, "client-command target=meta name=.recorder\n");
+ len = sprintf (buf, "client-command target=recording name=.recorder\n");
if (! writen (client.sk, buf, len))
return NULL;
@@ -1086,8 +1086,8 @@ recorder (void *arg)
if (! writen (pfd.fd, buf, len))
return NULL;
- client.surface = cairo_meta_surface_create (CAIRO_CONTENT_COLOR_ALPHA,
- NULL);
+ client.surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA,
+ NULL);
client.context_id = 0;
client.csi = cairo_script_interpreter_create ();
@@ -1261,8 +1261,8 @@ do_server (const char *path)
}
} else if (strncmp (line, ".complete", 9) == 0) {
clients_complete (&clients, pfd[n].fd);
- } else if (strncmp (line, ".meta", 5) == 0) {
- clients_meta (&clients, pfd[n].fd, line + 6);
+ } else if (strncmp (line, ".recording", 5) == 0) {
+ clients_recording (&clients, pfd[n].fd, line + 6);
} else {
printf ("do_command (%s)\n", line);
}
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 79cd6a2..82172aa 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -4714,22 +4714,22 @@ _cairo_test_null_surface_create (cairo_content_t content)
#endif
cairo_surface_t *
-cairo_meta_surface_create (cairo_content_t content,
- const cairo_rectangle_t *extents)
+cairo_recording_surface_create (cairo_content_t content,
+ const cairo_rectangle_t *extents)
{
cairo_surface_t *ret;
long surface_id;
_enter_trace ();
- ret = DLCALL (cairo_meta_surface_create, content, extents);
+ ret = DLCALL (cairo_recording_surface_create, content, extents);
surface_id = _create_surface_id (ret);
_emit_line_info ();
if (_write_lock ()) {
if (extents) {
_trace_printf ("dict\n"
- " /type /meta set\n"
+ " /type /recording set\n"
" /content //%s set\n"
" /extents [%f %f %f %f] set\n"
" surface dup /s%ld exch def\n",
@@ -4740,7 +4740,7 @@ cairo_meta_surface_create (cairo_content_t content,
_surface_object_set_size (ret, extents->width, extents->height);
} else {
_trace_printf ("dict\n"
- " /type /meta set\n"
+ " /type /recording set\n"
" /content //%s set\n"
" surface dup /s%ld exch def\n",
_content_to_string (content),
diff --git a/util/trace-to-xml.c b/util/trace-to-xml.c
index 763a565..416d8e1 100644
--- a/util/trace-to-xml.c
+++ b/util/trace-to-xml.c
@@ -20,7 +20,7 @@ _surface_create (void *_closure,
extents.x = extents.y = 0;
extents.width = width;
extents.height = height;
- surface = cairo_meta_surface_create (content, &extents);
+ surface = cairo_recording_surface_create (content, &extents);
if (*closure == NULL)
*closure = cairo_surface_reference (surface);
@@ -62,7 +62,7 @@ main (int argc, char **argv)
cairo_xml_t *xml;
xml = cairo_xml_create_for_stream (stdio_write, out);
- cairo_xml_for_meta_surface (xml, surface);
+ cairo_xml_for_recording_surface (xml, surface);
cairo_xml_destroy (xml);
cairo_surface_destroy (surface);
More information about the cairo-commit
mailing list