Commit graph

441 commits

Author SHA1 Message Date
Adrian Johnson
c235bc4dee Fix bug in cairo-trace when writing A8 images
Fixes: #848
2024-06-27 07:07:22 +09:30
Adrian Johnson
1528c96da6 Fix implicit conversion warning
GCC 12.2 reports the following warning:

[3/16] Compiling C object util/cairo-script/libcairo-script-interpreter.so.2.11801.1.p/cairo-script-scanner.c.o
../util/cairo-script/cairo-script-scanner.c:1562:38: warning: implicit conversion from 'int' to 'float' changes value from 2147483647 to 2147483648 [-Wimplicit-const-int-float-conversion]
    if (real >= INT32_MIN && real <= INT32_MAX && (int) real == real)
                                  ~~ ^~~~~~~~~
/usr/include/stdint.h:123:22: note: expanded from macro 'INT32_MAX'
                                 ^~~~~~~~~~
2024-04-17 08:00:23 +09:30
Tim-Philipp Müller
e0d4c1c9a9 util: remove malloc-stats
Not really cairo-related and has now been moved into a
separate repository at https://github.com/behdad/malloc-stats

Fixes #640
2023-09-28 11:21:53 +02:00
Uli Schlachter
e6b0c58424 Remove cairo-sphinx
I tried to use cairo-sphinx do to something useful. I failed.

The cairo-sphinx binary was added in commit 6e0b3be903 in 2009 by ickle
with the explanation:

    Add cairo-sphinx utility for regression analysis

    sphinx is an alternate version of the current cairo-test-trace. It's
    purpose is to replay a live application (which may just be a replay of a
    trace) against a backend and its reference. The improvement over the
    original cairo-test-trace is that the reference backend may be from an
    older version of cairo.

Ever since this commit, there were only build fixes to this code (for
example to fix compilation on AIX or to fix compilation after
cairo-tee.h became optional). So, either this code was perfect from the
beginning or it was not much used.

Next, I tried to reverse-engineer a bit how to actually use this. The
non-existing documentation didn't help much. The result? Well...
something happened, but I am not quite sure what. Then the server
process just exited.

So, in this commit I am removing cairo-sphinx. The hope is that someone
speaks up and complains. That person then hopefully can provide some
explanation on how to use this. Alternatively, no one speaks up and we
no longer have to maintain this piece of code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-06 18:39:22 +02:00
Uli Schlachter
4d274aa259 Always build fdr.c into a shared library
The code in fdr.c is meant to interpose function calls, e.g. it defines
a cairo_create() function that records the call and then calls the real
cairo_create() (via dlsym(RTLD_NEXT)).

This obviously does not work in a static library. This was reported in
issue #791. This commit fixes that issue by always building this as a
shared library, even when -Ddefault_library=static is passed to meson.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-03 17:28:21 +02:00
Uli Schlachter
e453962981 Revert "Allow static builds of cairo-sphinx"
This reverts commit dfc15dd2e5.

The code in fdr.c is supposed to interpose function calls into cairo.
I.e., instead of calling cairo_create(), the application would call into
fdr.c, this call would be recorded, and then the call is forwarded to
the real cairo_create().

The commit that is being reverted here just completely broke this by
renaming the functions. Thus, no more interposition would happen.
2023-09-03 17:25:00 +02:00
Emmanuele Bassi
dfc15dd2e5 Allow static builds of cairo-sphinx
The Cairo FDR trampoline code overwrites the public Cairo API used by
cairo-sphinx in order to trace the calls; when building cairo-sphinx
against a static build of Cairo, we end up with duplicated symbols.

To avoid that, we can rename the symbols to avoid the conflict, and then
provide the original symbol as a C pre-processor macro.

Fixes: #791
2023-08-22 13:01:14 +01:00
Emmanuele Bassi
98e9a40985 build: Enable cairo-sphinx only if we have SysV's SHM
Otherwise the build fails on Android when enabling the tee surface.
2023-08-17 19:18:12 +01:00
Emmanuele Bassi
ba4d5fbd5d Build with hidden symbols by default
We should default on every platform we care about to hidden symbols, to
avoid leaking private symbols.

On Windows this is the default state of affairs with the MSVC toolchain;
with GCC and GCC-compatible toolchains, we need to opt into this
behaviour. Luckily for us, Cairo already has an annotation for public
symbols, so we can easily tweak it to include the visibility attribute.

When building ancillary libraries as part of the Cairo compilation on
Windows, we use a pre-processor symbol to ensure that we keep the
dllexport annotation. This avoids including the cairoint.h header file.

Fixes: #582
2023-08-16 16:33:04 +01:00
Emmanuele Bassi
77c2820840 Drop "slim" symbols
The original "slim" symbol rewriting was added without any shred of a
set of performance evaluation, and mostly copy-pasted from a very early
version of pixman. Pixman itself never used them, and most C
libraries—like GLib and GTK—have dropped similar mechanisms over the
past 15 years, as linkers have improved considerably in the meantime.

Modern linkers provide functionality to avoid intra-library PLT jump
through flags like `-Bsymbolic-functions`; we should use that, instead,
and keep the code base more maintainable and debuggable.
2023-08-16 16:33:04 +01:00
Sebastian Dröge
baf2593852 Hurd has no MAP_NORESERVE so don't use it there 2023-07-02 10:19:06 -04:00
Behdad Esfahbod
d08e348dd6 [gobject] Bind cairo_glyph_t and cairo_text_cluster_t 2023-03-09 13:04:50 -07:00
Uli Schlachter
af5a25a7f1 Merge branch 'unused-function' into 'master'
Fix -Wunused-function warnings

See merge request cairo/cairo!449
2023-03-03 15:50:32 +00:00
Khaled Hosny
a74ef93d82 Fix -Wunused-function warnings 2023-02-06 11:42:00 +02:00
Emmanuele Bassi
2bef8669bc Remove XML surface
According to the Debian code search tool, nothing uses it as part of the
Cairo public API, and it has been disabled for a long time with nobody
complaining about it.
2023-02-04 11:36:25 +01:00
Emmanuele Bassi
4b1e075171 util: Fix compiler warnings in cairo-sphinx
Though I'm not sure how useful this tool is.
2023-02-03 15:45:11 +01:00
Emmanuele Bassi
47a932bffc Merge branch 'no-more-gl' into 'master'
Drop cairo-gl

See merge request cairo/cairo!287
2023-01-29 01:32:55 +00:00
Emmanuele Bassi
b5793081d0 Drop cairo-gl
The GL support in Cairo has always been a prototype, and
nothing happened in the past 10+ years to make it work as
it was meant to.

GL support is not enabled by any downstream packagers of
Cairo, so nobody should notice its absence.
2023-01-27 19:21:46 +00:00
Behdad Esfahbod
25b6775cc6 [malloc-stats] Measure calloc 2023-01-26 14:20:12 -07:00
Adrian Johnson
cbcf962da2 svg-font: return SVG_FONT_ERROR on error 2023-01-20 20:37:45 +10:30
Uli Schlachter
b23ecf6322 Merge branch 'test-png16-load' into 'master'
Add test for loading 16 bit PNG images

See merge request cairo/cairo!241
2023-01-15 19:54:04 +00:00
Fujii Hironori
8520ef5221 Defining Windows version macros in meson.build
WINVER and _WIN32_WINNT macros were defined in each source files and
headers that were including <windows.h>. However, because DirectWrite
requires new Windows API, some files included <windows.h> without the
version macros. This inconsistency sometimes caused troubles.

Define the version macros in meson.build.
2023-01-13 05:47:03 +09:00
Manuel Stoeckl
b0a5c3a11f Add remaining image formats to cairo-script constants table
This makes it possible to read cairo-script files which embed
RGB30/RGB96F/RGBA128F images.
2023-01-11 06:38:43 -05:00
Adrian Johnson
efe303d9db Remove autotools build 2023-01-08 22:27:47 +10:30
Adrian Johnson
82aa3fb80e Fix bug in strndup implementation
The strlen() could go past the n bytes and into a memory address we
don't have read access to.
2023-01-03 15:27:05 +10:30
Behdad Esfahbod
71c4443139 [malloc-stats] Fix to not crash
Can't use constructor as malloc might be called before that.
2022-12-30 10:34:46 -07:00
Simon McVittie
179c27b1d7 meson: Only link cairo-script-interpreter with liblzo
The rest of cairo (and therefore most external packages that depend
on cairo) doesn't make any use of liblzo.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-07-18 10:01:38 +01:00
Emmanuele Bassi
74f2da7b70 Merge branch 'fix-build-with-newer-libbfd' into 'master'
Fix build with newer binutils-dev installed

Closes #581

See merge request cairo/cairo!342
2022-07-14 10:41:29 +00:00
Simon McVittie
24996e6ee2 Fix build with newer binutils-dev installed
It seems the PTR typedef (or macro?) has been removed from newer versions
of libbfd.

Resolves: https://gitlab.freedesktop.org/cairo/cairo/-/issues/581
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-07-14 10:27:41 +01:00
Simon McVittie
f02f70d88e util: Don't expose _csi_stack_push in public ABI
This wasn't previously marked as private because it was initially
static inline, and only became extern later.

Fixes: 9ffbf63d "fix warning: inlining failed in call to '_csi_stack_push'"
Resolves: https://gitlab.freedesktop.org/cairo/cairo/-/issues/580
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-07-14 10:21:57 +01:00
Pierre Labastie
c087722141 Update util/cairo-script/cairo-script-interpreter.pc.in 2022-05-14 16:56:17 +00:00
Adrian Johnson
5b18aeffbb Replace use of ctype functions with internal version where only ASCII chars are used
In !309 Taylor R Campbell found a number of instances of ctype
incorrectly passed a signed char. In many cases, where only ASCII
characters are used, the code should have been using the cairo version
of the ctype function to avoid locale issues.
2022-04-09 22:08:57 +09:30
Adrian Johnson
9bb2036369 Fix warning
../util/malloc-stats.c:295:1: warning: no previous declaration for ‘malloc_stats’ [-Wmissing-declarations]
2022-03-09 19:43:48 +10:30
Adrian Johnson
d2f1827cde Replace deprecated malloc_hook 2022-03-09 06:58:28 +10:30
Adrian Johnson
989d368dc5 DWrite font docs 2022-03-05 16:56:56 +10:30
Emmanuele Bassi
9b9028c160 Drop cairo-vg surface
OpenVG is a failed experiment from 10 years ago, and nobody has been
using the cairo-vg surface in pretty much the same amount of time.
2022-02-25 02:09:58 +00:00
Adrian Johnson
2822728f2a Fix some MinGW warnings
The FT change is because my MinGW build is using a more recent version
of FT.

Remove the disabled _cairo_win32_scaled_font_text_to_glyphs() code to
fix the defined but not used warning.

_cairo_win32_scaled_font_text_to_glyphs() was diabled in d9408041aa with
the comment:

  "Currently disable the win32-font text_to_glyphs(), until that one
   is updated.  Or better yet, remove it and implement
   ucs4_to_index().  It's the toy font API afterall."

_cairo_win32_scaled_font_ucs4_to_index() was added in d1c619bc7d.
2021-09-02 21:14:51 +09:30
Emmanuele Bassi
4c38b3db99 gobject: Remove the use of volatile
It is pointless, and it has been deprecated by GLib:

  https://gitlab.gnome.org/GNOME/glib/-/issues/600
  http://c.isvolatileusefulwiththreads.com/

Now we're just getting compiler warnings with recent versions of GCC.
2021-08-15 19:29:53 +01:00
Rick Yorgason
ecec0419f8 Added hairline support to cairo 2021-08-15 06:58:54 +00:00
Adrian Johnson
9fbf427548 Use uintptr_t for all casts between pointer and integer
On 64-bit windows, long is 32-bit. When compiling there are a large
number of warnings about mismatched sizes when casting long to/from a
pointer.

Use the (u)intptr_t type for any integer that will have a pointer stored
in it. Use a (u)intptr_t cast when integers are stored in pointers to
silence warnings.

Fixes #263
2021-07-25 11:01:20 +09:30
Uli Schlachter
1e34651420 Fix meson build without zlib
Trying to build with meson with -Dzlib=disabled failed with the
following error message:

cairo/test/meson.build:599:2: ERROR: Unknown variable
"libcairoscript_dep".

This commit fixes that problem by adding a not-found dependency if
cairo-script is not built.

Additionally, follow-up problems are fixed:

- any2ppm.c still tried to include cairo-script-interpreter.h, which was
  not found
- Building cairo-test-trace was attempted, but that also failed because
  of missing script support.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/475
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 08:16:47 +02:00
Uli Schlachter
1981fb6dfb meson: Use more dependency objects
For example, to depend on cairo-script, inccairoscript was added to
"include_directories:" and libcairoscript was added to "link_with:".
This commit instead uses the libcairoscript_dep dependency everywhere.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-22 07:59:52 +02:00
Uli Schlachter
45cca0c984 meson: Move CAIRO_HAS_INTERPRETER to config.h
This is what autoconf does and hopefully that means this is the correct
thing to do.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-05-02 21:25:48 +02:00
Emmanuele Bassi
bd13841257 Drop the conditional inclusion of config.h
We *always* generate this file, and we depend on its existence.

The idea behind HAVE_CONFIG_H was being able to include random files
from different projects, back in a time where "libraries" were literally
just random files instead of actual shared objects.

Since we're not in the '80s any more, and our build system(s) define
HAVE_CONFIG_H *and* generate the config.h header file, we don't need a
conditional guard around its inclusion.
2021-05-01 17:05:29 +01:00
Emmanuele Bassi
bfd1602db9 Remove stray _GNU_SOURCE definitions
We define _GNU_SOURCE globally in both the Autotools build, through the
use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with
add_project_arguments().
2021-05-01 16:58:15 +01:00
Emmanuele Bassi
8336309794 meson: Define HAVE_CONFIG_H as a project flag
Precisely what Autotools does, instead of adding it as per-target C
argument.

Once we remove HAVE_CONFIG_H checks in every source file, we'll be able
to drop it.
2021-05-01 16:55:38 +01:00
Uli Schlachter
64e1fd70ec Merge branch 'ebassi/warnings-fixes' into 'master'
Avoid a bunch of compiler warnings

See merge request cairo/cairo!166
2021-04-27 16:30:44 +00:00
Emmanuele Bassi
efab74f5a1 Drop volatile from the GType registration
The `volatile` is unnecessary, and newer versions of GLib and GCC will
complain if you use it.
2021-04-27 16:59:35 +01:00
Emmanuele Bassi
b7d38e048f Use g_memdup2() with newer versions of GLib
The g_memdup() function has been deprecated, as it takes the size of the
memory area as an unsigned integer. The g_memdup2() replacement uses the
more appropriate size_t type, instead.
2021-04-27 16:54:22 +01:00
Tim-Philipp Müller
ca478e0327 meson: make cairo-trace executable
Install with exec flag set and make sure tool is
executable in build directory as well (by making
the input file in the source directory executable).

Fixes #462
2021-03-09 10:59:57 +00:00