diff options
69 files changed, 203 insertions, 217 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cd2e610c..c05529df9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -256,17 +256,27 @@ meson macOS: tags: - gst-macos-11.1 artifacts: - name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" - expire_in: '5 days' when: 'always' + expire_in: "7 days" paths: - - "build/meson-logs/*txt" - - "build/meson-private/*pc" + - build/meson-logs/*.txt + - build/meson-private/*.pc + - build/test/*.log + - build/test/pdiff/*.log + - build/test/output + exclude: + - "build/test/**/*.cs" + - "build/test/**/*.trace" before_script: + # Install the DejaVu fonts + - curl -LO https://downloads.sourceforge.net/dejavu/dejavu-fonts-ttf-2.37.zip + - unzip dejavu-fonts-ttf-2.37.zip + - cp dejavu-fonts-ttf-2.37/ttf/*.ttf /Library/Fonts + # Update pip - pip3 install --upgrade pip # Make sure meson is up to date - pip3 install -U meson - # Need to install certificates for python + # Need to install certificates for Python - pip3 install --upgrade certifi # Anther way to install certificates - open /Applications/Python\ 3.8/Install\ Certificates.command @@ -278,7 +288,7 @@ meson macOS: - meson setup -Dpixman:tests=disabled build - meson compile --verbose -C build # Test cairo-quartz. Other backends should be covered by other jobs - - export CAIRO_TEST_IGNORE_quartz_argb32=bug-361,bug-431,bug-image-compositor,clear,clip-operator,clip-text,coverage-rhombus,culled-glyphs,extended-blend-alpha,extended-blend-mask,extended-blend-alpha-mask,extended-blend-solid-alpha,fallback,font-matrix-translation,glyph-cache-pressure,halo,halo-transform,inverse-text,large-font,negative-stride-image,operator-clear,operator-source,operator-www,overlapping-glyphs,partial-clip-text-top,partial-clip-text-bottom,partial-clip-text-left,partial-clip-text-right,radial-gradient,radial-gradient-mask,radial-gradient-source,radial-gradient-mask-source,record-paint-alpha-clip-mask,record-fill-alpha,record-select-font-face,record-text-transform,record1414x-select-font-face,record1414x-text-transform,record2x-paint-alpha-clip-mask,record2x-select-font-face,record2x-text-transform,record90-fill-alpha,record90-select-font-face,record90-text-transform,recordflip-whole-select-font-face,recordflip-whole-text-transform,recordflip-select-font-face,recordflip-text-transform,record-neg-extents-bounded,record-mesh,record-replay-extend-repeat,record-replay-extend-reflect,record-replay-extend-pad,select-font-face,show-glyphs-advance,show-text-current-point,simple-edge,smask,smask-text,smp-glyph,subsurface,subsurface-outside-target,subsurface-scale,surface-pattern,text-antialias-gray,text-antialias-none,text-antialias-subpixel,text-antialias-subpixel-rgb,text-antialias-subpixel-bgr,text-antialias-subpixel-vrgb,text-antialias-subpixel-vbgr,text-glyph-range,text-pattern,text-rotate,text-transform,text-unhinted-metrics,unbounded-operator,user-font-proxy,user-font-rescale,ft-show-glyphs-positioning,ft-text-vertical-layout-type1,ft-text-vertical-layout-type3,ft-text-antialias-none - - export CAIRO_TEST_IGNORE_quartz_rgb24=bug-361,bug-431,bug-448,bug-image-compositor,clear,clip-operator,clip-text,coverage-rhombus,culled-glyphs,extended-blend,extended-blend-alpha,extended-blend-mask,extended-blend-alpha-mask,extended-blend-solid,extended-blend-solid-alpha,font-matrix-translation,glyph-cache-pressure,halo,halo-transform,inverse-text,large-font,negative-stride-image,operator-clear,operator-source,operator-www,overlapping-glyphs,partial-clip-text-top,partial-clip-text-bottom,partial-clip-text-left,partial-clip-text-right,radial-gradient,radial-gradient-mask,radial-gradient-source,radial-gradient-mask-source,record-paint-alpha-clip-mask,record-fill-alpha,record-select-font-face,record-text-transform,record1414x-select-font-face,record1414x-text-transform,record2x-paint-alpha-clip-mask,record2x-select-font-face,record2x-text-transform,record90-fill-alpha,record90-select-font-face,record90-text-transform,recordflip-whole-select-font-face,recordflip-whole-text-transform,recordflip-select-font-face,recordflip-text-transform,record-neg-extents-unbounded,record-neg-extents-bounded,record-mesh,record-replay-extend-repeat,record-replay-extend-reflect,record-replay-extend-pad,select-font-face,shifted-operator,show-glyphs-advance,show-text-current-point,simple-edge,smask,smask-text,smp-glyph,subsurface,subsurface-scale,text-antialias-gray,text-antialias-none,text-antialias-subpixel,text-antialias-subpixel-rgb,text-antialias-subpixel-bgr,text-antialias-subpixel-vrgb,text-antialias-subpixel-vbgr,text-glyph-range,text-pattern,text-rotate,text-transform,text-unhinted-metrics,unbounded-operator,user-font-proxy,user-font-rescale,ft-show-glyphs-positioning,ft-text-vertical-layout-type1,ft-text-vertical-layout-type3,ft-text-antialias-none + - export CAIRO_TEST_IGNORE_quartz_argb32=bug-361,bug-431,bug-image-compositor,clip-operator,coverage-rhombus,culled-glyphs,extended-blend-alpha,extended-blend-mask,extended-blend-alpha-mask,extended-blend-solid-alpha,fallback,negative-stride-image,operator-www,radial-gradient,radial-gradient-mask,radial-gradient-source,radial-gradient-mask-source,record-paint-alpha-clip-mask,record-fill-alpha,record-select-font-face,record-text-transform,record1414x-select-font-face,record1414x-text-transform,record2x-paint-alpha-clip-mask,record2x-select-font-face,record2x-text-transform,record90-fill-alpha,record90-select-font-face,record90-text-transform,recordflip-whole-select-font-face,recordflip-whole-text-transform,recordflip-select-font-face,recordflip-text-transform,record-neg-extents-bounded,record-mesh,record-replay-extend-repeat,record-replay-extend-reflect,record-replay-extend-pad,simple-edge,subsurface,subsurface-outside-target,subsurface-scale,surface-pattern,text-antialias-subpixel,text-antialias-subpixel-rgb,text-antialias-subpixel-bgr,text-antialias-subpixel-vrgb,text-antialias-subpixel-vbgr,text-unhinted-metrics,user-font-proxy,ft-show-glyphs-positioning,ft-text-vertical-layout-type1,ft-text-vertical-layout-type3 + - export CAIRO_TEST_IGNORE_quartz_rgb24=bug-361,bug-431,bug-448,bug-image-compositor,coverage-rhombus,culled-glyphs,extended-blend,extended-blend-alpha,extended-blend-mask,extended-blend-alpha-mask,extended-blend-solid,extended-blend-solid-alpha,negative-stride-image,operator-www,radial-gradient,radial-gradient-mask,radial-gradient-source,radial-gradient-mask-source,record-paint-alpha-clip-mask,record-fill-alpha,record-select-font-face,record-text-transform,record1414x-select-font-face,record1414x-text-transform,record2x-paint-alpha-clip-mask,record2x-select-font-face,record2x-text-transform,record90-fill-alpha,record90-select-font-face,record90-text-transform,recordflip-whole-select-font-face,recordflip-whole-text-transform,recordflip-select-font-face,recordflip-text-transform,record-neg-extents-unbounded,record-neg-extents-bounded,record-mesh,record-replay-extend-repeat,record-replay-extend-reflect,record-replay-extend-pad,shifted-operator,simple-edge,subsurface,subsurface-scale,text-antialias-subpixel,text-antialias-subpixel-rgb,text-antialias-subpixel-bgr,text-antialias-subpixel-vrgb,text-antialias-subpixel-vbgr,text-unhinted-metrics,user-font-proxy,ft-show-glyphs-positioning,ft-text-vertical-layout-type1,ft-text-vertical-layout-type3 - export CAIRO_TEST_TARGET=quartz - (cd build/test && srcdir=../../test ./cairo-test-suite) diff --git a/boilerplate/cairo-boilerplate-system.c b/boilerplate/cairo-boilerplate-system.c index ec23341a4..e9bcd78c5 100644 --- a/boilerplate/cairo-boilerplate-system.c +++ b/boilerplate/cairo-boilerplate-system.c @@ -23,8 +23,6 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#define _GNU_SOURCE 1 /* for vasprintf */ - #include "cairo-boilerplate.h" #include "cairo-boilerplate-system.h" diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h index 515bb03bc..544d38816 100644 --- a/boilerplate/cairo-boilerplate.h +++ b/boilerplate/cairo-boilerplate.h @@ -26,9 +26,7 @@ #ifndef _CAIRO_BOILERPLATE_H_ #define _CAIRO_BOILERPLATE_H_ -#if HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/boilerplate/meson.build b/boilerplate/meson.build index 79d1eeea4..0216b7a6c 100644 --- a/boilerplate/meson.build +++ b/boilerplate/meson.build @@ -35,8 +35,6 @@ cairo_boilerplate_constructors = custom_target('cairo-boilerplate-constructors.c command: [python3, files('make-cairo-boilerplate-constructors.py')[0], '@OUTPUT@', '@INPUT@']) libcairoboilerplate = static_library('cairoboilerplate', cairo_boilerplate_sources + [cairo_boilerplate_constructors], - c_args: ['-DHAVE_CONFIG_H'], - cpp_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], dependencies: deps, link_with: [libcairo], diff --git a/meson.build b/meson.build index d4f759224..9901bdf29 100644 --- a/meson.build +++ b/meson.build @@ -45,6 +45,9 @@ endif add_project_arguments('-D_GNU_SOURCE', language: 'c') +# Autotools compatibility +add_project_arguments('-DHAVE_CONFIG_H', language: 'c') + # Make sure source directory hasn't been configured with autotools if meson.version().version_compare('>= 0.53') fs = import('fs') @@ -683,7 +686,7 @@ if zlib_dep.found() endif if zlib_dep.found() - feature_conf.set('CAIRO_HAS_INTERPRETER', 1) + conf.set('CAIRO_HAS_INTERPRETER', 1) endif # TODO: add xml option and disable by default @@ -967,6 +970,6 @@ if meson.version().version_compare('>= 0.53') summary({ 'cairo-trace:': conf.get('CAIRO_HAS_TRACE', 0) == 1, - 'cairo-script-interpreter': feature_conf.get('CAIRO_HAS_INTERPRETER', 0) == 1, + 'cairo-script-interpreter': conf.get('CAIRO_HAS_INTERPRETER', 0) == 1, }, section: 'Features and Utilities', bool_yn: true) endif diff --git a/perf/cairo-analyse-trace.c b/perf/cairo-analyse-trace.c index 95b7e6664..6dbe7cf4b 100644 --- a/perf/cairo-analyse-trace.c +++ b/perf/cairo-analyse-trace.c @@ -29,7 +29,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#define _GNU_SOURCE 1 /* for sched_getaffinity() and getline() */ +#include "config.h" #include "cairo-perf.h" #include "cairo-stats.h" diff --git a/perf/cairo-perf-micro.c b/perf/cairo-perf-micro.c index d8745c205..618272ec5 100644 --- a/perf/cairo-perf-micro.c +++ b/perf/cairo-perf-micro.c @@ -26,7 +26,7 @@ * Carl Worth <cworth@cworth.org> */ -#define _GNU_SOURCE 1 /* for sched_getaffinity() */ +#include "config.h" #include "cairo-perf.h" #include "cairo-stats.h" diff --git a/perf/cairo-perf-print.c b/perf/cairo-perf-print.c index d7ae1311e..ab1440f55 100644 --- a/perf/cairo-perf-print.c +++ b/perf/cairo-perf-print.c @@ -27,9 +27,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#if HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-perf.h" #include "cairo-stats.h" diff --git a/perf/cairo-perf-report.c b/perf/cairo-perf-report.c index 2325f4793..5a1e25441 100644 --- a/perf/cairo-perf-report.c +++ b/perf/cairo-perf-report.c @@ -25,16 +25,14 @@ * Authors: Carl Worth <cworth@cworth.org> */ +#include "config.h" + #define _GETDELIM 1/* for getline() on AIX */ #include "cairo-perf.h" #include "cairo-missing.h" #include "cairo-stats.h" -/* We use _GNU_SOURCE for getline and strndup if available. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c index 7823089ae..cfabcaad0 100644 --- a/perf/cairo-perf-trace.c +++ b/perf/cairo-perf-trace.c @@ -28,7 +28,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#define _GNU_SOURCE 1 /* for sched_getaffinity() and getline() */ +#include "config.h" #include "cairo-missing.h" #include "cairo-perf.h" diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h index 70d4b79d6..d23192b41 100644 --- a/src/cairo-atomic-private.h +++ b/src/cairo-atomic-private.h @@ -39,11 +39,9 @@ #ifndef CAIRO_ATOMIC_PRIVATE_H #define CAIRO_ATOMIC_PRIVATE_H -# include "cairo-compiler-private.h" +#include "cairo-compiler-private.h" -#if HAVE_CONFIG_H #include "config.h" -#endif #include <assert.h> diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h index 4562bea66..00703c584 100644 --- a/src/cairo-compiler-private.h +++ b/src/cairo-compiler-private.h @@ -40,9 +40,7 @@ #include "cairo.h" -#if HAVE_CONFIG_H #include "config.h" -#endif /* Size in bytes of buffer to use off the stack per functions. * Mostly used by text functions. For larger allocations, they'll diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 0e17f3a16..3b11eb981 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -1243,6 +1243,9 @@ _cairo_image_compute_color (cairo_image_surface_t *image) int x, y; cairo_image_color_t color; + if (image->width == 0 || image->height == 0) + return CAIRO_IMAGE_IS_MONOCHROME; + if (image->format == CAIRO_FORMAT_A1) return CAIRO_IMAGE_IS_MONOCHROME; diff --git a/src/cairo-misc.c b/src/cairo-misc.c index d7af82147..e683198e7 100644 --- a/src/cairo-misc.c +++ b/src/cairo-misc.c @@ -38,8 +38,6 @@ * Adrian Johnson <ajohnson@redneon.com> */ -#define _GNU_SOURCE 1 /* strtod_l() */ - #include "cairoint.h" #include "cairo-error-private.h" diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h index 25223f3ea..a31e1e0d9 100644 --- a/src/cairo-mutex-impl-private.h +++ b/src/cairo-mutex-impl-private.h @@ -43,9 +43,7 @@ #include "cairo.h" -#if HAVE_CONFIG_H #include "config.h" -#endif #if HAVE_LOCKDEP #include <lockdep.h> diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index 7a9f52401..c8c28d4a7 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -34,7 +34,6 @@ * Vladimir Vukicevic <vladimir@mozilla.com> */ -#define _GNU_SOURCE /* required for RTLD_DEFAULT */ #include "cairoint.h" #include "cairo-quartz-private.h" diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index d53915fee..4f979c5db 100755 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -1813,9 +1813,9 @@ cairo_scaled_font_text_to_glyphs_internal_uncached (cairo_scaled_font_t *scaled /** * cairo_scaled_font_text_to_glyphs: + * @scaled_font: a #cairo_scaled_font_t * @x: X position to place first glyph * @y: Y position to place first glyph - * @scaled_font: a #cairo_scaled_font_t * @utf8: a string of text encoded in UTF-8 * @utf8_len: length of @utf8 in bytes, or -1 if it is NUL-terminated * @glyphs: pointer to array of glyphs to fill diff --git a/src/cairo-svg.h b/src/cairo-svg.h index 4d24857bc..5328cb583 100644 --- a/src/cairo-svg.h +++ b/src/cairo-svg.h @@ -55,7 +55,6 @@ typedef enum _cairo_svg_version { /** * cairo_svg_unit_t: - * * @CAIRO_SVG_UNIT_USER: User unit, a value in the current coordinate system. * If used in the root element for the initial coordinate systems it * corresponds to pixels. (Since 1.16) diff --git a/src/cairo-wideint-type-private.h b/src/cairo-wideint-type-private.h index 84a3cbab0..a1a2269f8 100644 --- a/src/cairo-wideint-type-private.h +++ b/src/cairo-wideint-type-private.h @@ -39,9 +39,7 @@ #include "cairo.h" -#if HAVE_CONFIG_H #include "config.h" -#endif #if HAVE_STDINT_H # include <stdint.h> diff --git a/src/cairo-xcb-connection-core.c b/src/cairo-xcb-connection-core.c index e01dc1a83..71d2e515b 100644 --- a/src/cairo-xcb-connection-core.c +++ b/src/cairo-xcb-connection-core.c @@ -42,7 +42,7 @@ _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection, uint16_t width, uint16_t height) { - xcb_pixmap_t pixmap = _cairo_xcb_connection_get_xid (connection); + xcb_pixmap_t pixmap = xcb_generate_id (connection->xcb_connection); assert (width > 0); assert (height > 0); @@ -52,35 +52,19 @@ _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection, return pixmap; } -void -_cairo_xcb_connection_free_pixmap (cairo_xcb_connection_t *connection, - xcb_pixmap_t pixmap) -{ - xcb_free_pixmap (connection->xcb_connection, pixmap); - _cairo_xcb_connection_put_xid (connection, pixmap); -} - xcb_gcontext_t _cairo_xcb_connection_create_gc (cairo_xcb_connection_t *connection, xcb_drawable_t drawable, uint32_t value_mask, uint32_t *values) { - xcb_gcontext_t gc = _cairo_xcb_connection_get_xid (connection); + xcb_gcontext_t gc = xcb_generate_id (connection->xcb_connection); xcb_create_gc (connection->xcb_connection, gc, drawable, value_mask, values); return gc; } void -_cairo_xcb_connection_free_gc (cairo_xcb_connection_t *connection, - xcb_gcontext_t gc) -{ - xcb_free_gc (connection->xcb_connection, gc); - _cairo_xcb_connection_put_xid (connection, gc); -} - -void _cairo_xcb_connection_change_gc (cairo_xcb_connection_t *connection, xcb_gcontext_t gc, uint32_t value_mask, diff --git a/src/cairo-xcb-connection-render.c b/src/cairo-xcb-connection-render.c index 61119653e..e27b2b3b2 100644 --- a/src/cairo-xcb-connection-render.c +++ b/src/cairo-xcb-connection-render.c @@ -79,7 +79,6 @@ _cairo_xcb_connection_render_free_picture (cairo_xcb_connection_t *connection, { assert (connection->flags & CAIRO_XCB_HAS_RENDER); xcb_render_free_picture (connection->xcb_connection, picture); - _cairo_xcb_connection_put_xid (connection, picture); } void @@ -133,7 +132,6 @@ _cairo_xcb_connection_render_free_glyph_set (cairo_xcb_connection_t *connec { assert (connection->flags & CAIRO_XCB_HAS_RENDER); xcb_render_free_glyph_set (connection->xcb_connection, glyphset); - _cairo_xcb_connection_put_xid (connection, glyphset); } void diff --git a/src/cairo-xcb-connection-shm.c b/src/cairo-xcb-connection-shm.c index 7720bbbd2..140a73cd0 100644 --- a/src/cairo-xcb-connection-shm.c +++ b/src/cairo-xcb-connection-shm.c @@ -43,7 +43,7 @@ _cairo_xcb_connection_shm_attach (cairo_xcb_connection_t *connection, uint32_t id, cairo_bool_t readonly) { - uint32_t segment = _cairo_xcb_connection_get_xid (connection); + uint32_t segment = xcb_generate_id (connection->xcb_connection); assert (connection->flags & CAIRO_XCB_HAS_SHM); xcb_shm_attach (connection->xcb_connection, segment, id, readonly); return segment; @@ -109,7 +109,6 @@ _cairo_xcb_connection_shm_detach (cairo_xcb_connection_t *connection, { assert (connection->flags & CAIRO_XCB_HAS_SHM); xcb_shm_detach (connection->xcb_connection, segment); - _cairo_xcb_connection_put_xid (connection, segment); } #endif /* CAIRO_HAS_XCB_SHM_FUNCTIONS */ diff --git a/src/cairo-xcb-connection.c b/src/cairo-xcb-connection.c index 51f5ee323..2c58cca70 100644 --- a/src/cairo-xcb-connection.c +++ b/src/cairo-xcb-connection.c @@ -255,7 +255,7 @@ pixmap_depths_usable (cairo_xcb_connection_t *connection, cairo_bool_t success = TRUE; int depth, i, j; - pixmap = _cairo_xcb_connection_get_xid (connection); + pixmap = xcb_generate_id (connection->xcb_connection); for (depth = 1, i = 0; depth <= 32; depth++) { if (missing & DEPTH_MASK(depth)) { @@ -275,8 +275,6 @@ pixmap_depths_usable (cairo_xcb_connection_t *connection, free (create_error); } - _cairo_xcb_connection_put_xid (connection, pixmap); - return success; } @@ -462,10 +460,9 @@ can_use_shm (cairo_xcb_connection_t *connection) return FALSE; } - shmseg = _cairo_xcb_connection_get_xid (connection); + shmseg = xcb_generate_id (connection->xcb_connection); cookie[0] = xcb_shm_attach_checked (c, shmseg, shmid, FALSE); cookie[1] = xcb_shm_detach_checked (c, shmseg); - _cairo_xcb_connection_put_xid (connection, shmseg); error = xcb_request_check (c, cookie[0]); if (error != NULL) @@ -586,8 +583,6 @@ _device_destroy (void *device) #endif _cairo_freepool_fini (&connection->shm_info_freelist); - _cairo_freepool_fini (&connection->xid_pool); - CAIRO_MUTEX_FINI (connection->shm_mutex); CAIRO_MUTEX_FINI (connection->screens_mutex); @@ -662,10 +657,6 @@ _cairo_xcb_connection_get (xcb_connection_t *xcb_connection) goto unlock; } - cairo_list_init (&connection->free_xids); - _cairo_freepool_init (&connection->xid_pool, - sizeof (cairo_xcb_xid_t)); - cairo_list_init (&connection->shm_pools); cairo_list_init (&connection->shm_pending); _cairo_freepool_init (&connection->shm_info_freelist, @@ -766,43 +757,6 @@ _cairo_xcb_connection_get_xrender_format_for_visual (cairo_xcb_connection_t *con return format ? format->xrender_format : XCB_NONE; } -void -_cairo_xcb_connection_put_xid (cairo_xcb_connection_t *connection, - uint32_t xid) -{ - cairo_xcb_xid_t *cache; - - assert (CAIRO_MUTEX_IS_LOCKED (connection->device.mutex)); - cache = _cairo_freepool_alloc (&connection->xid_pool); - if (likely (cache != NULL)) { - cache->xid = xid; - cairo_list_add (&cache->link, &connection->free_xids); - } -} - -uint32_t -_cairo_xcb_connection_get_xid (cairo_xcb_connection_t *connection) -{ - uint32_t xid; - - assert (CAIRO_MUTEX_IS_LOCKED (connection->device.mutex)); - if (! cairo_list_is_empty (&connection->free_xids)) { - cairo_xcb_xid_t *cache; - - cache = cairo_list_first_entry (&connection->free_xids, - cairo_xcb_xid_t, - link); - xid = cache->xid; - - cairo_list_del (&cache->link); - _cairo_freepool_free (&connection->xid_pool, cache); - } else { - xid = xcb_generate_id (connection->xcb_connection); - } - - return xid; -} - /** * cairo_xcb_device_get_connection: * @device: a #cairo_device_t for the XCB backend diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h index f5d5a4c81..009f0820a 100644 --- a/src/cairo-xcb-private.h +++ b/src/cairo-xcb-private.h @@ -226,9 +226,6 @@ struct _cairo_xcb_connection { const xcb_query_extension_reply_t *shm; xcb_render_sub_pixel_t *subpixel_orders; - cairo_list_t free_xids; - cairo_freepool_t xid_pool; - cairo_mutex_t shm_mutex; cairo_list_t shm_pools; cairo_list_t shm_pending; @@ -323,13 +320,6 @@ _cairo_xcb_connection_acquire (cairo_xcb_connection_t *connection) return cairo_device_acquire (&connection->device); } -cairo_private uint32_t -_cairo_xcb_connection_get_xid (cairo_xcb_connection_t *connection); - -cairo_private void -_cairo_xcb_connection_put_xid (cairo_xcb_connection_t *connection, - uint32_t xid); - static inline void _cairo_xcb_connection_release (cairo_xcb_connection_t *connection) { @@ -482,10 +472,6 @@ _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection, uint16_t width, uint16_t height); -cairo_private void -_cairo_xcb_connection_free_pixmap (cairo_xcb_connection_t *connection, - xcb_pixmap_t pixmap); - cairo_private xcb_gcontext_t _cairo_xcb_connection_create_gc (cairo_xcb_connection_t *connection, xcb_drawable_t drawable, @@ -493,10 +479,6 @@ _cairo_xcb_connection_create_gc (cairo_xcb_connection_t *connection, uint32_t *values); cairo_private void -_cairo_xcb_connection_free_gc (cairo_xcb_connection_t *connection, - xcb_gcontext_t gc); - -cairo_private void _cairo_xcb_connection_change_gc (cairo_xcb_connection_t *connection, xcb_gcontext_t gc, uint32_t value_mask, diff --git a/src/cairo-xcb-screen.c b/src/cairo-xcb-screen.c index 0d23ad3c3..f443eec29 100644 --- a/src/cairo-xcb-screen.c +++ b/src/cairo-xcb-screen.c @@ -169,7 +169,7 @@ _cairo_xcb_screen_finish (cairo_xcb_screen_t *screen) for (i = 0; i < ARRAY_LENGTH (screen->gc); i++) { if (screen->gc_depths[i] != 0) - _cairo_xcb_connection_free_gc (screen->connection, screen->gc[i]); + xcb_free_gc (screen->connection->xcb_connection, screen->gc[i]); } _cairo_cache_fini (&screen->linear_pattern_cache); @@ -350,7 +350,7 @@ _cairo_xcb_screen_put_gc (cairo_xcb_screen_t *screen, int depth, xcb_gcontext_t if (i == ARRAY_LENGTH (screen->gc)) { /* perform random substitution to ensure fair caching over depths */ i = rand () % ARRAY_LENGTH (screen->gc); - _cairo_xcb_connection_free_gc (screen->connection, screen->gc[i]); + xcb_free_gc (screen->connection->xcb_connection, screen->gc[i]); } screen->gc[i] = gc; diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c index 91c0ff995..f9f12f04b 100644 --- a/src/cairo-xcb-surface-core.c +++ b/src/cairo-xcb-surface-core.c @@ -66,7 +66,7 @@ _cairo_xcb_pixmap_finish (void *abstract_surface) if (unlikely (status)) return status; - _cairo_xcb_connection_free_pixmap (surface->connection, + xcb_free_pixmap (surface->connection->xcb_connection, surface->pixmap); _cairo_xcb_connection_release (surface->connection); } diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c index 6cb56cb78..a1eaad9a5 100644 --- a/src/cairo-xcb-surface-render.c +++ b/src/cairo-xcb-surface-render.c @@ -128,7 +128,7 @@ _cairo_xcb_picture_create (cairo_xcb_screen_t *screen, cairo_list_add (&surface->link, &screen->pictures); surface->screen = screen; - surface->picture = _cairo_xcb_connection_get_xid (screen->connection); + surface->picture = xcb_generate_id (screen->connection->xcb_connection); surface->pixman_format = pixman_format; surface->xrender_format = xrender_format; @@ -308,7 +308,7 @@ _cairo_xcb_surface_ensure_picture (cairo_xcb_surface_t *surface) values[0] = surface->precision; } - surface->picture = _cairo_xcb_connection_get_xid (surface->connection); + surface->picture = xcb_generate_id (surface->connection->xcb_connection); _cairo_xcb_connection_render_create_picture (surface->connection, surface->picture, surface->drawable, @@ -382,7 +382,7 @@ _picture_from_image (cairo_xcb_surface_t *target, 0, 0); } - _cairo_xcb_connection_free_pixmap (target->connection, pixmap); + xcb_free_pixmap (target->connection->xcb_connection, pixmap); return picture; } @@ -640,7 +640,7 @@ _solid_picture (cairo_xcb_surface_t *target, _cairo_xcb_screen_put_gc (target->screen, 32, gc); } - _cairo_xcb_connection_free_pixmap (target->connection, pixmap); + xcb_free_pixmap (target->connection->xcb_connection, pixmap); } return picture; @@ -4232,7 +4232,7 @@ _cairo_xcb_scaled_font_get_glyphset_info_for_format (cairo_xcb_connection_t *c, info = &priv->glyphset_info[glyphset_index]; if (info->glyphset == XCB_NONE) { - info->glyphset = _cairo_xcb_connection_get_xid (c); + info->glyphset = xcb_generate_id (c->xcb_connection); info->xrender_format = c->standard_formats[info->format]; _cairo_xcb_connection_render_create_glyph_set (c, diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 7f601bb71..de020d8a0 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -155,7 +155,7 @@ _cairo_xcb_surface_create_similar (void *abstract_other, } if (unlikely (surface->base.status)) - _cairo_xcb_connection_free_pixmap (connection, pixmap); + xcb_free_pixmap (connection->xcb_connection, pixmap); _cairo_xcb_connection_release (connection); @@ -220,7 +220,7 @@ _cairo_xcb_surface_finish (void *abstract_surface) } if (surface->owns_pixmap) - _cairo_xcb_connection_free_pixmap (surface->connection, surface->drawable); + xcb_free_pixmap (surface->connection->xcb_connection, surface->drawable); _cairo_xcb_connection_release (surface->connection); } @@ -423,7 +423,7 @@ _get_image (cairo_xcb_surface_t *surface, pixmap, 0, 0, width, height); - _cairo_xcb_connection_free_pixmap (connection, pixmap); + xcb_free_pixmap (connection->xcb_connection, pixmap); } if (unlikely (reply == NULL)) { diff --git a/src/cairoint.h b/src/cairoint.h index c97ad57fa..03ca09c10 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -46,9 +46,7 @@ #ifndef _CAIROINT_H_ #define _CAIROINT_H_ -#if HAVE_CONFIG_H #include "config.h" -#endif #ifdef _MSC_VER #define cairo_public __declspec(dllexport) diff --git a/src/meson.build b/src/meson.build index f5d741eae..2905fdc8a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -296,8 +296,8 @@ incsrc = include_directories('.') libcairo = library('cairo', cairo_sources, dependencies: deps, - c_args: cairo_no_warn_c_args + pthread_c_args + ['-DHAVE_CONFIG_H'], - cpp_args: cairo_no_warn_c_args + pthread_c_args + ['-DHAVE_CONFIG_H'], + c_args: cairo_no_warn_c_args + pthread_c_args, + cpp_args: cairo_no_warn_c_args + pthread_c_args, link_args: extra_link_args, soversion: cairo_version_sonum, version: cairo_libversion, diff --git a/test/Makefile.sources b/test/Makefile.sources index 0e68ccb7d..493141203 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -283,6 +283,7 @@ test_sources = \ record-mesh.c \ record-replay-extend.c \ record-transform-paint.c \ + record-write-png.c \ recording-ink-extents.c \ recording-surface-pattern.c \ recording-surface-extend.c \ diff --git a/test/any2ppm.c b/test/any2ppm.c index b3f1308ea..d2d5fc5e2 100644 --- a/test/any2ppm.c +++ b/test/any2ppm.c @@ -50,9 +50,7 @@ * Author: Kristian Høgsberg <krh@redhat.com> */ -#if HAVE_CONFIG_H #include "config.h" -#endif #if HAVE_UNISTD_H #include <unistd.h> diff --git a/test/api-special-cases.c b/test/api-special-cases.c index aa615f804..ae87d0e5d 100644 --- a/test/api-special-cases.c +++ b/test/api-special-cases.c @@ -56,9 +56,7 @@ * enough to just add a new check to the function it complained about. */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <assert.h> #include <limits.h> diff --git a/test/buffer-diff.c b/test/buffer-diff.c index 087ac459b..6d2a6bf8a 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -23,9 +23,7 @@ * * Author: Richard D. Worth <richard@theworths.org> */ -#if HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/test/cairo-test-trace.c b/test/cairo-test-trace.c index 7ada3e75a..35db4c033 100644 --- a/test/cairo-test-trace.c +++ b/test/cairo-test-trace.c @@ -52,8 +52,6 @@ * scope of this test. */ -#define _GNU_SOURCE 1 /* getline() */ - #include "cairo-test.h" #include "buffer-diff.h" diff --git a/test/cairo-test.c b/test/cairo-test.c index b5650ffce..3d241d814 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -25,11 +25,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#define _GNU_SOURCE 1 /* for feenableexcept() et al */ - -#if HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/test/error-setters.c b/test/error-setters.c index ff65ad4f2..8ad823def 100644 --- a/test/error-setters.c +++ b/test/error-setters.c @@ -23,9 +23,7 @@ * Author: Benjamin Otte <otte@redhat.com> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <limits.h> diff --git a/test/fallback-resolution.c b/test/fallback-resolution.c index 306a57013..83020fc37 100644 --- a/test/fallback-resolution.c +++ b/test/fallback-resolution.c @@ -25,9 +25,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/test/imagediff.c b/test/imagediff.c index 6ebbcfca7..c091e7627 100644 --- a/test/imagediff.c +++ b/test/imagediff.c @@ -23,9 +23,7 @@ * * Author: Richard D. Worth <richard@theworths.org> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/test/invalid-matrix.c b/test/invalid-matrix.c index 9bb26be0b..df0dff0f1 100644 --- a/test/invalid-matrix.c +++ b/test/invalid-matrix.c @@ -25,8 +25,8 @@ */ #define _ISOC99_SOURCE /* for INFINITY */ -#define _GNU_SOURCE 1 /* for fedisableeexcept() et al */ +#include "config.h" #include "cairo-test.h" #if !defined(INFINITY) diff --git a/test/meson.build b/test/meson.build index b4562adb8..143d2f09c 100644 --- a/test/meson.build +++ b/test/meson.build @@ -283,6 +283,7 @@ test_sources = [ 'record-mesh.c', 'record-replay-extend.c', 'record-transform-paint.c', + 'record-write-png.c', 'recording-ink-extents.c', 'recording-surface-pattern.c', 'recording-surface-extend.c', @@ -602,7 +603,6 @@ endif if build_any2ppm any2ppm_exe = executable('any2ppm', 'any2ppm.c', - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc, inccairoscript], link_with: [libcairo, libcairoscript], dependencies: deps + test_deps, @@ -613,7 +613,7 @@ endif if have_shm cairo_test_trace_exe = executable('cairo-test-trace', cairo_test_trace_sources, include_directories: [incbase, incsrc, incboilerplate, incpdiff, inccairoscript, inccairomissing], - c_args: ['-DHAVE_CONFIG_H'] + pthread_c_args, + c_args: pthread_c_args, link_with: [libcairo, libcairoboilerplate, libpdiff, libcairoscript, libcairomissing], link_args: extra_link_args, dependencies: deps + test_deps + [rt_dep]) @@ -621,7 +621,6 @@ endif exe = executable('cairo-test-suite', [cairo_test_suite_sources, test_sources, cairo_test_constructors], include_directories: [incbase, incsrc, incboilerplate, incpdiff], - c_args: ['-DHAVE_CONFIG_H'], link_with: [libcairo, libcairoboilerplate, libpdiff], link_args: extra_link_args, dependencies: deps + test_deps, diff --git a/test/pdiff/meson.build b/test/pdiff/meson.build index 6400b95c2..30c6f1b5f 100644 --- a/test/pdiff/meson.build +++ b/test/pdiff/meson.build @@ -9,13 +9,11 @@ perceptualdiff_sources = [ ] libpdiff = static_library('pdiff', libpdiff_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], dependencies: deps, link_with: [libcairo], ) perceptualdiff = executable('perceptualdiff', perceptualdiff_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], link_with: [libpdiff]) diff --git a/test/pdiff/pdiff.c b/test/pdiff/pdiff.c index eb5f15682..6e05552d6 100644 --- a/test/pdiff/pdiff.c +++ b/test/pdiff/pdiff.c @@ -14,11 +14,7 @@ if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA */ -#define _GNU_SOURCE - -#if HAVE_CONFIG_H #include "config.h" -#endif #include "lpyramid.h" #include <math.h> diff --git a/test/ps-eps.c b/test/ps-eps.c index de1248d81..60203a1cb 100644 --- a/test/ps-eps.c +++ b/test/ps-eps.c @@ -27,9 +27,7 @@ * Chris Wilson <chris@chris-wilson.co.uk> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/test/record-write-png.c b/test/record-write-png.c new file mode 100644 index 000000000..da0e253bd --- /dev/null +++ b/test/record-write-png.c @@ -0,0 +1,136 @@ +/* + * Copyright © 2021 Matthias Clasen + * Copyright © 2021 Uli Schlachter + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Matthias Clasen + * Uli Schlachter + */ + +// Test case for https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/118 +// A recording surface with a non-zero origin gets cut off when passed to +// cairo_surface_write_to_png(). + +#include "cairo-test.h" + +#include <assert.h> + +struct buffer { + char *data; + size_t length; +}; + +static cairo_surface_t * +prepare_recording (void) +{ + cairo_surface_t *surface; + cairo_rectangle_t rect; + cairo_t *cr; + + rect.x = -1; + rect.y = -2; + rect.width = 3; + rect.height = 4; + surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, &rect); + + cr = cairo_create (surface); + cairo_set_line_width (cr, 1); + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_rectangle (cr, 0.5, -0.5, 1., 1.); + cairo_stroke (cr); + cairo_destroy (cr); + + return surface; +} + +static cairo_status_t +write_callback (void *closure, const unsigned char *data, unsigned int length) +{ + struct buffer *buffer = closure; + + buffer->data = realloc (buffer->data, buffer->length + length); + memcpy (&buffer->data[buffer->length], data, length); + buffer->length += length; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +read_callback (void *closure, unsigned char *data, unsigned int length) +{ + struct buffer *buffer = closure; + + assert (buffer->length >= length); + memcpy (data, buffer->data, length); + buffer->data += length; + buffer->length -= length; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_surface_t * +png_round_trip (cairo_surface_t *input_surface) +{ + cairo_surface_t *output_surface; + struct buffer buffer; + void *to_free; + + // Turn the surface into a PNG + buffer.data = NULL; + buffer.length = 0; + cairo_surface_write_to_png_stream (input_surface, write_callback, &buffer); + to_free = buffer.data; + + // Load the PNG again + output_surface = cairo_image_surface_create_from_png_stream (read_callback, &buffer); + + free (to_free); + return output_surface; +} + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *recording, *surface; + + // Draw a black background so that the output does not vary with alpha + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_paint (cr); + + recording = prepare_recording (); + surface = png_round_trip (recording); + + cairo_set_source_surface (cr, surface, 0, 0); + cairo_paint (cr); + + cairo_surface_destroy (recording); + cairo_surface_destroy (surface); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (record_write_png, + "Test writing to png with non-zero origin", + "record, transform", /* keywords */ + NULL, /* requirements */ + 4, 4, + NULL, draw) diff --git a/test/reference/record-write-png.ref.png b/test/reference/record-write-png.ref.png Binary files differnew file mode 100644 index 000000000..7152a217a --- /dev/null +++ b/test/reference/record-write-png.ref.png diff --git a/test/solid-pattern-cache-stress.c b/test/solid-pattern-cache-stress.c index c2a1c1526..56972bfaf 100644 --- a/test/solid-pattern-cache-stress.c +++ b/test/solid-pattern-cache-stress.c @@ -23,9 +23,7 @@ * Author: Chris Wilson <chris at chris-wilson.co.uk> */ -#if HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-test.h" #include <stdlib.h> /* drand48() */ diff --git a/test/toy-font-face.c b/test/toy-font-face.c index cbebf840a..95d2c01eb 100644 --- a/test/toy-font-face.c +++ b/test/toy-font-face.c @@ -24,9 +24,7 @@ * Behdad Esfahbod <behdad@behdad.org> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-test.h" diff --git a/util/cairo-fdr/fdr.c b/util/cairo-fdr/fdr.c index 08d9c0113..edbd53a5b 100644 --- a/util/cairo-fdr/fdr.c +++ b/util/cairo-fdr/fdr.c @@ -16,11 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <cairo.h> #include <cairo-script.h> diff --git a/util/cairo-fdr/meson.build b/util/cairo-fdr/meson.build index 3cb66c678..001af27bc 100644 --- a/util/cairo-fdr/meson.build +++ b/util/cairo-fdr/meson.build @@ -4,7 +4,6 @@ cairo_fdr_sources = [ libcairofdr = library('cairo-fdr', cairo_fdr_sources, include_directories: [incbase, incsrc], - c_args: ['-DHAVE_CONFIG_H'], dependencies: deps, install: true, install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'), diff --git a/util/cairo-gobject/cairo-gobject-enums.c b/util/cairo-gobject/cairo-gobject-enums.c index 0c5069406..ce7d70c60 100644 --- a/util/cairo-gobject/cairo-gobject-enums.c +++ b/util/cairo-gobject/cairo-gobject-enums.c @@ -1,9 +1,7 @@ /* Generated data (by glib-mkenums) */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-gobject.h" diff --git a/util/cairo-gobject/cairo-gobject-structs.c b/util/cairo-gobject/cairo-gobject-structs.c index 9171abeb8..c8f59d7e7 100644 --- a/util/cairo-gobject/cairo-gobject-structs.c +++ b/util/cairo-gobject/cairo-gobject-structs.c @@ -34,9 +34,7 @@ * Benjamin Otte <otte@redhat.com> */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-gobject.h" diff --git a/util/cairo-gobject/meson.build b/util/cairo-gobject/meson.build index bf24242a0..e4e3c8302 100644 --- a/util/cairo-gobject/meson.build +++ b/util/cairo-gobject/meson.build @@ -8,7 +8,6 @@ cairo_gobject_headers = [ ] libcairogobject = library('cairo-gobject', cairo_gobject_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], dependencies: [glib_dep, gobject_dep], link_with: [libcairo], diff --git a/util/cairo-missing/meson.build b/util/cairo-missing/meson.build index dd1507b59..18c6caf33 100644 --- a/util/cairo-missing/meson.build +++ b/util/cairo-missing/meson.build @@ -6,7 +6,6 @@ cairo_missing_sources = [ inccairomissing = include_directories('.') libcairomissing = static_library('cairo-missing', cairo_missing_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], install: false, build_by_default: false, diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h index ac633c950..7ae8be925 100644 --- a/util/cairo-script/cairo-script-private.h +++ b/util/cairo-script/cairo-script-private.h @@ -35,9 +35,7 @@ #ifndef CAIRO_SCRIPT_PRIVATE_H #define CAIRO_SCRIPT_PRIVATE_H -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "cairo-script-interpreter.h" diff --git a/util/cairo-script/meson.build b/util/cairo-script/meson.build index f50a200df..7a6b55818 100644 --- a/util/cairo-script/meson.build +++ b/util/cairo-script/meson.build @@ -26,7 +26,6 @@ csi_trace_sources = [ libcairoscript = library('cairo-script-interpreter', cairoscript_interpreter_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], dependencies: deps, link_with: [libcairo], @@ -50,14 +49,12 @@ pkgmod.generate(libcairoscript, meson.override_dependency('cairo-script-interpreter', libcairoscript_dep) csi_replay_exe = executable('csi-replay', csi_replay_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], link_with: [libcairo, libcairoscript], dependencies: deps, ) csi_exec_exe = executable('csi-exec', csi_exec_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], link_with: [libcairo, libcairoscript], dependencies: deps, @@ -65,7 +62,6 @@ csi_exec_exe = executable('csi-exec', csi_exec_sources, if feature_conf.get('CAIRO_HAS_SCRIPT_SURFACE', 0) == 1 and conf.get('HAVE_LIBGEN_H', 0) == 1 csi_trace_exe = executable('csi-trace', csi_trace_sources, - c_args: ['-DHAVE_CONFIG_H'], include_directories: [incbase, incsrc], link_with: [libcairo, libcairoscript], dependencies: deps, diff --git a/util/cairo-sphinx/fdr.c b/util/cairo-sphinx/fdr.c index aeda89bcd..a28251650 100644 --- a/util/cairo-sphinx/fdr.c +++ b/util/cairo-sphinx/fdr.c @@ -16,11 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <cairo.h> #include <cairo-script.h> diff --git a/util/cairo-sphinx/meson.build b/util/cairo-sphinx/meson.build index cf560aefd..f779744b9 100644 --- a/util/cairo-sphinx/meson.build +++ b/util/cairo-sphinx/meson.build @@ -8,7 +8,6 @@ cairo_sphinx_sources = [ libcairosphinx = library('cairo-sphinx', libcairo_sphinx_sources, include_directories: [incbase, incsrc], - c_args: ['-DHAVE_CONFIG_H'], dependencies: deps, install: true, install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'), @@ -18,7 +17,7 @@ libdir = join_paths(get_option('prefix'), get_option('libdir')) cairosphinx_exe = executable('cairo-sphinx', cairo_sphinx_sources, include_directories: [incbase, incsrc, inccairoscript, incboilerplate], - c_args: ['-DHAVE_CONFIG_H', '-DLIBDIR="@0@"'.format(libdir)] + pthread_c_args, + c_args: ['-DLIBDIR="@0@"'.format(libdir)] + pthread_c_args, dependencies: deps + [glib_dep, rt_dep], link_with: [libcairo, libcairosphinx, libcairoscript, libcairoboilerplate], link_args: extra_link_args, diff --git a/util/cairo-sphinx/sphinx.c b/util/cairo-sphinx/sphinx.c index 5c5fcee77..9e248aff1 100644 --- a/util/cairo-sphinx/sphinx.c +++ b/util/cairo-sphinx/sphinx.c @@ -6,9 +6,7 @@ * delta-debugging to reduce that down to a minimal trace.) */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <stdio.h> #include <stdlib.h> diff --git a/util/cairo-trace/lookup-symbol.c b/util/cairo-trace/lookup-symbol.c index 9af0b5944..4bc1fac1a 100644 --- a/util/cairo-trace/lookup-symbol.c +++ b/util/cairo-trace/lookup-symbol.c @@ -45,11 +45,7 @@ This file was part of GNU Binutils. */ -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #define true 1 #define false 0 diff --git a/util/cairo-trace/meson.build b/util/cairo-trace/meson.build index 7048786eb..c4a504759 100644 --- a/util/cairo-trace/meson.build +++ b/util/cairo-trace/meson.build @@ -12,7 +12,7 @@ libcairotrace = library('cairo-trace', cairo_trace_sources, include_directories: [incbase, incsrc], dependencies: deps, link_args: extra_link_args, - c_args: ['-DSHARED_LIB_EXT="@0@"'.format(shared_lib_ext), '-DHAVE_CONFIG_H'] + pthread_c_args, + c_args: ['-DSHARED_LIB_EXT="@0@"'.format(shared_lib_ext),] + pthread_c_args, install: true, install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'cairo'), ) diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index 26ed2e506..babcc06fa 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -16,11 +16,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H #include "config.h" -#endif /* The autoconf on OpenBSD 4.5 produces the malformed constant name * SIZEOF_VOID__ rather than SIZEOF_VOID_P. Work around that here. */ diff --git a/util/meson.build b/util/meson.build index 55362b6d4..e3a1ace96 100644 --- a/util/meson.build +++ b/util/meson.build @@ -6,7 +6,7 @@ if feature_conf.get('CAIRO_HAS_GOBJECT_FUNCTIONS', 0) == 1 subdir('cairo-gobject') endif -if feature_conf.get('CAIRO_HAS_INTERPRETER', 0) == 1 +if conf.get('CAIRO_HAS_INTERPRETER', 0) == 1 subdir('cairo-script') endif diff --git a/util/show-contour.c b/util/show-contour.c index f3fa1babf..e09f6315f 100644 --- a/util/show-contour.c +++ b/util/show-contour.c @@ -1,4 +1,5 @@ -#define _GNU_SOURCE +#include "config.h" + #include <gtk/gtk.h> #include <stdlib.h> #include <stdio.h> diff --git a/util/show-edges.c b/util/show-edges.c index a85ad5f7e..c27900333 100644 --- a/util/show-edges.c +++ b/util/show-edges.c @@ -1,4 +1,5 @@ -#define _GNU_SOURCE +#include "config.h" + #include <gtk/gtk.h> #include <stdlib.h> #include <stdio.h> diff --git a/util/show-events.c b/util/show-events.c index 8bff3efc4..da824dd9d 100644 --- a/util/show-events.c +++ b/util/show-events.c @@ -1,4 +1,5 @@ -#define _GNU_SOURCE +#include "config.h" + #include <gtk/gtk.h> #include <stdlib.h> #include <stdio.h> diff --git a/util/show-polygon.c b/util/show-polygon.c index 35c0014d1..1157427f7 100644 --- a/util/show-polygon.c +++ b/util/show-polygon.c @@ -1,4 +1,5 @@ -#define _GNU_SOURCE +#include "config.h" + #include <gtk/gtk.h> #include <stdlib.h> #include <stdio.h> diff --git a/util/show-traps.c b/util/show-traps.c index f46c8b009..dc1093060 100644 --- a/util/show-traps.c +++ b/util/show-traps.c @@ -1,4 +1,5 @@ -#define _GNU_SOURCE +#include "config.h" + #include <gtk/gtk.h> #include <stdlib.h> #include <stdio.h> diff --git a/util/trace-to-xml.c b/util/trace-to-xml.c index a0f03ccff..b4295fbdd 100644 --- a/util/trace-to-xml.c +++ b/util/trace-to-xml.c @@ -1,6 +1,4 @@ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include <cairo-xml.h> #include <cairo-script-interpreter.h> |