[cairo-commit] 4 commits - meson_options.txt src/cairo-tee-surface.c util/meson.build
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Aug 17 18:59:06 UTC 2023
meson_options.txt | 2
src/cairo-tee-surface.c | 210 ++++++++++++++++++++++++------------------------
util/meson.build | 1
3 files changed, 107 insertions(+), 106 deletions(-)
New commits:
commit 42c986fef3b444dc36d5670ae65b8b3bb5dbeae4
Merge: 1d3d24a48 98e9a4098
Author: Emmanuele Bassi <ebassi at gmail.com>
Date: Thu Aug 17 18:59:04 2023 +0000
Merge branch 'cairo-tee-checks' into 'master'
tee: Remove questionable terminology
See merge request cairo/cairo!505
commit 98e9a40985963219885f4d786f8b986f2a5615cc
Author: Emmanuele Bassi <ebassi at gnome.org>
Date: Thu Aug 17 19:09:09 2023 +0100
build: Enable cairo-sphinx only if we have SysV's SHM
Otherwise the build fails on Android when enabling the tee surface.
diff --git a/util/meson.build b/util/meson.build
index 3c3bf26c2..a598d9daf 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -24,6 +24,7 @@ endif
if (glib_dep.found() and
png_dep.found() and
+ have_shm and
host_machine.system() != 'windows' and
conf.get('CAIRO_HAS_DLSYM', 0) == 1 and
feature_conf.get('CAIRO_HAS_SCRIPT_SURFACE', 0) == 1 and
commit 77cdde124a250e1ac2a4c6a38a8092c5143c0583
Author: Emmanuele Bassi <ebassi at gnome.org>
Date: Sat Feb 4 11:20:19 2023 +0100
build: Move 'tee' from disabled to auto
The 'tee' surface is used by Firefox and Thunderbird, so we should at
least have it built automatically, to ensure we catch eventual build
issues.
Tee does not have specific tests, so this does not influence our test
suite.
diff --git a/meson_options.txt b/meson_options.txt
index 5b96940dd..f481ef3ea 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,7 +6,7 @@ option('freetype', type : 'feature', value : 'auto')
# Cairo surface backends
option('png', type : 'feature', value : 'auto') # png and svg surfaces
option('quartz', type : 'feature', value : 'auto')
-option('tee', type : 'feature', value : 'disabled')
+option('tee', type : 'feature', value : 'auto')
option('xcb', type : 'feature', value : 'auto')
option('xlib', type : 'feature', value : 'auto')
option('xlib-xcb', type : 'feature', value : 'disabled')
commit 335c713ed7e489e6213ff6f45379caedd0e923df
Author: Emmanuele Bassi <ebassi at gnome.org>
Date: Sat Feb 4 11:21:34 2023 +0100
tee: Remove questionable terminology
The master/slave terms are both inappropriate and inaccurate: the tee
surface replicates the rendering commands from a primary surface to
other surfaces.
This change is a mechanical search-and-replace.
diff --git a/src/cairo-tee-surface.c b/src/cairo-tee-surface.c
index f15483c26..b5244df04 100644
--- a/src/cairo-tee-surface.c
+++ b/src/cairo-tee-surface.c
@@ -52,8 +52,8 @@
typedef struct _cairo_tee_surface {
cairo_surface_t base;
- cairo_surface_wrapper_t master;
- cairo_array_t slaves;
+ cairo_surface_wrapper_t primary;
+ cairo_array_t replicas;
} cairo_tee_surface_t;
static cairo_surface_t *
@@ -66,21 +66,21 @@ _cairo_tee_surface_create_similar (void *abstract_surface,
cairo_tee_surface_t *other = abstract_surface;
cairo_surface_t *similar;
cairo_surface_t *surface;
- cairo_surface_wrapper_t *slaves;
- int n, num_slaves;
+ cairo_surface_wrapper_t *replicas;
+ int n, num_replicas;
- similar = _cairo_surface_wrapper_create_similar (&other->master,
+ similar = _cairo_surface_wrapper_create_similar (&other->primary,
content, width, height);
surface = cairo_tee_surface_create (similar);
cairo_surface_destroy (similar);
if (unlikely (surface->status))
return surface;
- num_slaves = _cairo_array_num_elements (&other->slaves);
- slaves = _cairo_array_index (&other->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
+ num_replicas = _cairo_array_num_elements (&other->replicas);
+ replicas = _cairo_array_index (&other->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
- similar = _cairo_surface_wrapper_create_similar (&slaves[n],
+ similar = _cairo_surface_wrapper_create_similar (&replicas[n],
content,
width, height);
cairo_tee_surface_add (surface, similar);
@@ -100,17 +100,17 @@ static cairo_status_t
_cairo_tee_surface_finish (void *abstract_surface)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
- int n, num_slaves;
+ cairo_surface_wrapper_t *replicas;
+ int n, num_replicas;
- _cairo_surface_wrapper_fini (&surface->master);
+ _cairo_surface_wrapper_fini (&surface->primary);
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++)
- _cairo_surface_wrapper_fini (&slaves[n]);
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++)
+ _cairo_surface_wrapper_fini (&replicas[n]);
- _cairo_array_fini (&surface->slaves);
+ _cairo_array_fini (&surface->replicas);
return CAIRO_STATUS_SUCCESS;
}
@@ -120,7 +120,7 @@ _cairo_tee_surface_source (void *abstract_surface,
cairo_rectangle_int_t *extents)
{
cairo_tee_surface_t *surface = abstract_surface;
- return _cairo_surface_get_source (surface->master.target, extents);
+ return _cairo_surface_get_source (surface->primary.target, extents);
}
static cairo_status_t
@@ -129,26 +129,26 @@ _cairo_tee_surface_acquire_source_image (void *abstract_surface,
void **image_extra)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
- int num_slaves, n;
+ cairo_surface_wrapper_t *replicas;
+ int num_replicas, n;
/* we prefer to use a real image surface if available */
- if (_cairo_surface_is_image (surface->master.target)) {
- return _cairo_surface_wrapper_acquire_source_image (&surface->master,
+ if (_cairo_surface_is_image (surface->primary.target)) {
+ return _cairo_surface_wrapper_acquire_source_image (&surface->primary,
image_out, image_extra);
}
- 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_image (slaves[n].target)) {
- return _cairo_surface_wrapper_acquire_source_image (&slaves[n],
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ if (_cairo_surface_is_image (replicas[n].target)) {
+ return _cairo_surface_wrapper_acquire_source_image (&replicas[n],
image_out,
image_extra);
}
}
- return _cairo_surface_wrapper_acquire_source_image (&surface->master,
+ return _cairo_surface_wrapper_acquire_source_image (&surface->primary,
image_out, image_extra);
}
@@ -159,7 +159,7 @@ _cairo_tee_surface_release_source_image (void *abstract_surface,
{
cairo_tee_surface_t *surface = abstract_surface;
- _cairo_surface_wrapper_release_source_image (&surface->master,
+ _cairo_surface_wrapper_release_source_image (&surface->primary,
image, image_extra);
}
@@ -167,21 +167,21 @@ static cairo_surface_t *
_cairo_tee_surface_snapshot (void *abstract_surface)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
- int num_slaves, n;
+ cairo_surface_wrapper_t *replicas;
+ int num_replicas, n;
/* 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_recording (slaves[n].target))
- return _cairo_surface_wrapper_snapshot (&slaves[n]);
+ if (_cairo_surface_is_recording (surface->primary.target))
+ return _cairo_surface_wrapper_snapshot (&surface->primary);
+
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ if (_cairo_surface_is_recording (replicas[n].target))
+ return _cairo_surface_wrapper_snapshot (&replicas[n]);
}
- return _cairo_surface_wrapper_snapshot (&surface->master);
+ return _cairo_surface_wrapper_snapshot (&surface->primary);
}
static cairo_bool_t
@@ -190,7 +190,7 @@ _cairo_tee_surface_get_extents (void *abstract_surface,
{
cairo_tee_surface_t *surface = abstract_surface;
- return _cairo_surface_wrapper_get_extents (&surface->master, rectangle);
+ return _cairo_surface_wrapper_get_extents (&surface->primary, rectangle);
}
static void
@@ -199,7 +199,7 @@ _cairo_tee_surface_get_font_options (void *abstract_surface,
{
cairo_tee_surface_t *surface = abstract_surface;
- _cairo_surface_wrapper_get_font_options (&surface->master, options);
+ _cairo_surface_wrapper_get_font_options (&surface->primary, options);
}
static cairo_int_status_t
@@ -209,19 +209,19 @@ _cairo_tee_surface_paint (void *abstract_surface,
const cairo_clip_t *clip)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
- int n, num_slaves;
+ cairo_surface_wrapper_t *replicas;
+ int n, num_replicas;
cairo_int_status_t status;
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
- status = _cairo_surface_wrapper_paint (&slaves[n], op, source, 0, clip);
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ status = _cairo_surface_wrapper_paint (&replicas[n], op, source, 0, clip);
if (unlikely (status))
return status;
}
- return _cairo_surface_wrapper_paint (&surface->master, op, source, 0, clip);
+ return _cairo_surface_wrapper_paint (&surface->primary, op, source, 0, clip);
}
static cairo_int_status_t
@@ -232,14 +232,14 @@ _cairo_tee_surface_mask (void *abstract_surface,
const cairo_clip_t *clip)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
+ cairo_surface_wrapper_t *replicas;
cairo_int_status_t status;
- int n, num_slaves;
+ int n, num_replicas;
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
- status = _cairo_surface_wrapper_mask (&slaves[n],
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ status = _cairo_surface_wrapper_mask (&replicas[n],
op, source, 0,
mask, 0,
clip);
@@ -247,7 +247,7 @@ _cairo_tee_surface_mask (void *abstract_surface,
return status;
}
- return _cairo_surface_wrapper_mask (&surface->master,
+ return _cairo_surface_wrapper_mask (&surface->primary,
op, source, 0,
mask, 0,
clip);
@@ -266,14 +266,14 @@ _cairo_tee_surface_stroke (void *abstract_surface,
const cairo_clip_t *clip)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
+ cairo_surface_wrapper_t *replicas;
cairo_int_status_t status;
- int n, num_slaves;
+ int n, num_replicas;
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
- status = _cairo_surface_wrapper_stroke (&slaves[n],
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ status = _cairo_surface_wrapper_stroke (&replicas[n],
op, source, 0,
path, style,
ctm, ctm_inverse,
@@ -283,7 +283,7 @@ _cairo_tee_surface_stroke (void *abstract_surface,
return status;
}
- return _cairo_surface_wrapper_stroke (&surface->master,
+ return _cairo_surface_wrapper_stroke (&surface->primary,
op, source, 0,
path, style,
ctm, ctm_inverse,
@@ -302,14 +302,14 @@ _cairo_tee_surface_fill (void *abstract_surface,
const cairo_clip_t *clip)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
+ cairo_surface_wrapper_t *replicas;
cairo_int_status_t status;
- int n, num_slaves;
+ int n, num_replicas;
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
- status = _cairo_surface_wrapper_fill (&slaves[n],
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ status = _cairo_surface_wrapper_fill (&replicas[n],
op, source, 0,
path, fill_rule,
tolerance, antialias,
@@ -318,7 +318,7 @@ _cairo_tee_surface_fill (void *abstract_surface,
return status;
}
- return _cairo_surface_wrapper_fill (&surface->master,
+ return _cairo_surface_wrapper_fill (&surface->primary,
op, source, 0,
path, fill_rule,
tolerance, antialias,
@@ -346,9 +346,9 @@ _cairo_tee_surface_show_text_glyphs (void *abstract_surface,
const cairo_clip_t *clip)
{
cairo_tee_surface_t *surface = abstract_surface;
- cairo_surface_wrapper_t *slaves;
+ cairo_surface_wrapper_t *replicas;
cairo_int_status_t status;
- int n, num_slaves;
+ int n, num_replicas;
cairo_glyph_t *glyphs_copy;
/* XXX: This copying is ugly. */
@@ -356,11 +356,11 @@ _cairo_tee_surface_show_text_glyphs (void *abstract_surface,
if (unlikely (glyphs_copy == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
memcpy (glyphs_copy, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
- status = _cairo_surface_wrapper_show_text_glyphs (&slaves[n], op,
+ status = _cairo_surface_wrapper_show_text_glyphs (&replicas[n], op,
source, 0,
utf8, utf8_len,
glyphs_copy, num_glyphs,
@@ -373,7 +373,7 @@ _cairo_tee_surface_show_text_glyphs (void *abstract_surface,
}
memcpy (glyphs_copy, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
- status = _cairo_surface_wrapper_show_text_glyphs (&surface->master, op,
+ status = _cairo_surface_wrapper_show_text_glyphs (&surface->primary, op,
source, 0,
utf8, utf8_len,
glyphs_copy, num_glyphs,
@@ -421,12 +421,12 @@ static const cairo_surface_backend_t cairo_tee_surface_backend = {
};
cairo_surface_t *
-cairo_tee_surface_create (cairo_surface_t *master)
+cairo_tee_surface_create (cairo_surface_t *primary)
{
cairo_tee_surface_t *surface;
- if (unlikely (master->status))
- return _cairo_surface_create_in_error (master->status);
+ if (unlikely (primary->status))
+ return _cairo_surface_create_in_error (primary->status);
surface = _cairo_malloc (sizeof (cairo_tee_surface_t));
if (unlikely (surface == NULL))
@@ -434,13 +434,13 @@ cairo_tee_surface_create (cairo_surface_t *master)
_cairo_surface_init (&surface->base,
&cairo_tee_surface_backend,
- master->device,
- master->content,
+ primary->device,
+ primary->content,
TRUE); /* is_vector */
- _cairo_surface_wrapper_init (&surface->master, master);
+ _cairo_surface_wrapper_init (&surface->primary, primary);
- _cairo_array_init (&surface->slaves, sizeof (cairo_surface_wrapper_t));
+ _cairo_array_init (&surface->replicas, sizeof (cairo_surface_wrapper_t));
return &surface->base;
}
@@ -450,7 +450,7 @@ cairo_tee_surface_add (cairo_surface_t *abstract_surface,
cairo_surface_t *target)
{
cairo_tee_surface_t *surface;
- cairo_surface_wrapper_t slave;
+ cairo_surface_wrapper_t replica;
cairo_status_t status;
if (unlikely (abstract_surface->status))
@@ -474,10 +474,10 @@ cairo_tee_surface_add (cairo_surface_t *abstract_surface,
surface = (cairo_tee_surface_t *) abstract_surface;
- _cairo_surface_wrapper_init (&slave, target);
- status = _cairo_array_append (&surface->slaves, &slave);
+ _cairo_surface_wrapper_init (&replica, target);
+ status = _cairo_array_append (&surface->replicas, &replica);
if (unlikely (status)) {
- _cairo_surface_wrapper_fini (&slave);
+ _cairo_surface_wrapper_fini (&replica);
status = _cairo_surface_set_error (&surface->base, status);
}
}
@@ -487,8 +487,8 @@ cairo_tee_surface_remove (cairo_surface_t *abstract_surface,
cairo_surface_t *target)
{
cairo_tee_surface_t *surface;
- cairo_surface_wrapper_t *slaves;
- int n, num_slaves;
+ cairo_surface_wrapper_t *replicas;
+ int n, num_replicas;
if (unlikely (abstract_surface->status))
return;
@@ -505,29 +505,29 @@ cairo_tee_surface_remove (cairo_surface_t *abstract_surface,
}
surface = (cairo_tee_surface_t *) abstract_surface;
- if (target == surface->master.target) {
+ if (target == surface->primary.target) {
_cairo_surface_set_error (abstract_surface,
_cairo_error (CAIRO_STATUS_INVALID_INDEX));
return;
}
- num_slaves = _cairo_array_num_elements (&surface->slaves);
- slaves = _cairo_array_index (&surface->slaves, 0);
- for (n = 0; n < num_slaves; n++) {
- if (slaves[n].target == target)
+ num_replicas = _cairo_array_num_elements (&surface->replicas);
+ replicas = _cairo_array_index (&surface->replicas, 0);
+ for (n = 0; n < num_replicas; n++) {
+ if (replicas[n].target == target)
break;
}
- if (n == num_slaves) {
+ if (n == num_replicas) {
_cairo_surface_set_error (abstract_surface,
_cairo_error (CAIRO_STATUS_INVALID_INDEX));
return;
}
- _cairo_surface_wrapper_fini (&slaves[n]);
- for (n++; n < num_slaves; n++)
- slaves[n-1] = slaves[n];
- surface->slaves.num_elements--; /* XXX: cairo_array_remove()? */
+ _cairo_surface_wrapper_fini (&replicas[n]);
+ for (n++; n < num_replicas; n++)
+ replicas[n-1] = replicas[n];
+ surface->replicas.num_elements--; /* XXX: cairo_array_remove()? */
}
cairo_surface_t *
@@ -546,16 +546,16 @@ cairo_tee_surface_index (cairo_surface_t *abstract_surface,
surface = (cairo_tee_surface_t *) abstract_surface;
if (index == 0) {
- return surface->master.target;
+ return surface->primary.target;
} else {
- cairo_surface_wrapper_t *slave;
+ cairo_surface_wrapper_t *replica;
index--;
- if (index >= _cairo_array_num_elements (&surface->slaves))
+ if (index >= _cairo_array_num_elements (&surface->replicas))
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_INDEX));
- slave = _cairo_array_index (&surface->slaves, index);
- return slave->target;
+ replica = _cairo_array_index (&surface->replicas, index);
+ return replica->target;
}
}
More information about the cairo-commit
mailing list