Commit graph

12783 commits

Author SHA1 Message Date
Uli Schlachter
ac1ac72ff1 tests: Add more dithering tests
Use operator add to add the same source over and over again, to make the
dithering more pronounced.
2023-09-23 12:15:27 +01:00
Emmanuele Bassi
ac26a16171 Make Cairo dither to Pixman dither conversion static
We don't use it anywhere outside of the image surface, so there's no
need to make it a project-wide private function.

The name is also updated: it's a cairo function, so it should not abuse
the pixman namespace.
2023-09-07 15:42:44 +01:00
Marc Jeanmougin
e6ab85712c Enable access to the pixman dithering path
Newer versions of Pixman allow choosing the dithering format.
2023-09-07 15:42:21 +01:00
Emmanuele Bassi
7380d3dd7d Merge branch 'sphinx-static' into 'master'
Revert "Allow static builds of cairo-sphinx" and always build fdr.c as a shared library

See merge request cairo/cairo!509
2023-09-06 16:37:25 +00:00
Emmanuele Bassi
3c14ef78ab Merge branch 'ebassi/ci-static-linux-build' into 'master'
ci: Add a static build on Linux

See merge request cairo/cairo!507
2023-09-04 17:27:32 +00:00
Uli Schlachter
61e1c9fd1c Update FDO_DISTRIBUTION_TAG
The previous commit touched the list of packages that are installed in
our build container. This commit changes FDO_DISTRIBUTION_TAG to ensure
the container is rebuild with those changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-04 18:17:04 +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
Adrian Johnson
7a06f65d9b Merge branch 'bobby285271/fix-format-security' into 'master'
Fix building with -Werror=format-security

See merge request cairo/cairo!508
2023-09-02 05:49:05 +00:00
Bobby Rong
50c5f3cc76 Fix building with -Werror=format-security
../src/cairo-pdf-surface.c: In function '_cairo_pdf_surface_open_content_stream':
../src/cairo-pdf-surface.c:2537:45: error: format not a string literal and no format arguments [-Werror=format-security]
 2537 |                                             str);
      |                                             ^~~
cc1: some warnings being treated as errors
2023-09-02 00:46:45 +00:00
Emmanuele Bassi
7e3c764ff3 ci: Remove autotools from the Fedora image
We don't use Autotools any more.
2023-08-28 22:15:11 +01:00
Emmanuele Bassi
3a76936d66 ci: Add a static build on Linux
There are people building Cairo as a static library, so we should verify
that we are not breaking their builds.
2023-08-28 22:07:23 +01:00
Emmanuele Bassi
7645586223 Merge branch 'ebassi/sphinx-static-build' into 'master'
Allow static builds of cairo-sphinx

Closes #791

See merge request cairo/cairo!506
2023-08-23 10:44:27 +00: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
42c986fef3 Merge branch 'cairo-tee-checks' into 'master'
tee: Remove questionable terminology

See merge request cairo/cairo!505
2023-08-17 18:59:04 +00: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
77cdde124a 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.
2023-08-17 17:30:06 +01:00
Emmanuele Bassi
335c713ed7 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.
2023-08-17 17:28:56 +01:00
Emmanuele Bassi
1d3d24a48e Merge branch 'no-slim-symbols' into 'master'
Drop "slim" symbols

Closes #582

See merge request cairo/cairo!343
2023-08-17 16:23:27 +00:00
Emmanuele Bassi
eaffbc19d7 Merge branch 'issue-642' into 'master'
docs: Add override for feature symbols

Closes #642

See merge request cairo/cairo!501
2023-08-16 15:35:01 +00:00
Emmanuele Bassi
31fc7233a4 build: Remove unused files
We do not use slim symbols, and all the symbols are hidden by default;
this means we don't need to test those things any more.
2023-08-16 16:33:04 +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
ff02c2c268 Add surface-to-png in the quartz boilerplate
The cairo-boilerplate static library cannot use private API defined in
the main Cairo shared library, because it has no access to those
symbols.

Since the code is small, we can just dump it into the boilerplate
library.
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
Emmanuele Bassi
8dbc2fd5ae Merge branch 'ebassi/drop-autotools-check' into 'master'
build: Drop legacy build

See merge request cairo/cairo!502
2023-08-13 23:00:56 +00:00
Emmanuele Bassi
c68766370d build: Drop legacy build
It's been a while since we dropped the Autotools build; it's time to let
go of the past.
2023-08-13 16:45:24 +01:00
Emmanuele Bassi
8730e185cb docs: Add override for feature symbols
The old Autotools build generated a cairo-supported-features.h file for
the benefit of gtk-doc. These days, with a smaller features set, we can
get away with an override file.

Fixes: #642
2023-08-13 16:41:20 +01:00
Adrian Johnson
542bfac286 Merge branch 'big-endian-swap' into 'master'
Fix FT color glyphs on big endian systems

Closes #787

See merge request cairo/cairo!500
2023-07-30 10:45:38 +00:00
Uli Schlachter
05ba8e9751 Fix FT color glyphs on big endian systems
Andreas Falkenhahn reported the issue below and indicated that the color
channels are swapped. This commit fixes the byte swap.

The problem is that be32_to_cpu() is a no-op on big endian systems.
However, we also have a bswap_32() function available that always works.

Testing done: None by me, but Andreas Falkenhahn reported that his patch
fixes colors on a PowerPC system.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/787
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-07-30 11:15:49 +02:00
Tim-Philipp Müller
00d8d3117d Merge branch 'ci-remove-meson-prefix-from-job-names' into 'master'
ci: remove meson from job names

See merge request cairo/cairo!499
2023-07-29 10:00:57 +00:00
Tim-Philipp Müller
711f71e21d ci: remove meson from job names
Autotools is gone after all, it's all meson now.
2023-07-29 10:17:01 +01:00
Uli Schlachter
89f272e3d9 Merge branch 'master' into 'master'
fix SEGV in cairo_type1_font functioons

See merge request cairo/cairo!497
2023-07-22 06:08:22 +00:00
iasunsea
35da42b681 fix SEGV in cairo_type1_font functioons 2023-07-22 11:58:20 +08:00
Adrian Johnson
0560aa5819 Merge branch 'master' into 'master'
fix read memory access

See merge request cairo/cairo!496
2023-07-20 22:24:05 +00:00
iasunsea
9a2385d412 fix read memory access 2023-07-21 00:46:44 +08:00
Tim-Philipp Müller
48a4466631 Merge branch 'fix-pulling-ft2-and-fc' into 'master'
Don't pull in FreeType and Fontconfig on Windows and Darwin

See merge request cairo/cairo!495
2023-07-20 14:50:07 +00:00
Adrian Johnson
3f732bd3d9 Merge branch 'master' into 'master'
cairo truetype reverse cmap detected memory leaks

See merge request cairo/cairo!494
2023-07-18 21:53:09 +00:00
Adrian Johnson
35a38406f5 Merge branch '5898791338508288' into 'master'
Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152

See merge request cairo/cairo!493
2023-07-18 21:33:01 +00:00
Alex
af83da70f5 Refix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152 according to recommendations 2023-07-18 12:04:59 +00:00
Sergey Bugaev
7fe4f00721 Apply 1 suggestion(s) to 1 file(s) 2023-07-17 15:28:32 +00:00
Sergey Bugaev
bcb7937545 Consistently spell "FreeType" with capital T
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-07-17 15:35:40 +03:00
Sergey Bugaev
a3a7ca452f meson: Don't pull in FreeType and Fontconfig by default
Commit f6a3f6d8ad
"Don't build fontconfig on Windows" made an attempt to prevent Meson
from automatically building Fontconfig as a subproject on Windows when
the 'fontconfig' option has its default value of 'auto'.

Unfortunately, this only made things worse instead of fixing them.

Meson feature options can have three states: 'enabled', 'auto', and
'disabled'. They are primarily intended to be used as a value for the
'required' option of the 'dependency()' function. When the system
dependency is not found, but a fallback subproject is provided
explicitly with the 'fallback' option, a feature option in the 'auto'
state still causes the subproject to get built.

Since there's no apparent way to produce a value of the "feature option
object" type in a specific state, commit f6a3f6d8ad instead
set fontconfig_option = false (when it wasn't set to 'enabled', i.e. it
was either 'auto' or 'disabled') in an attempt to disable building the
subproject. However, a boolean value of false is equivalent to 'auto',
not to 'disabled'. This is documented at
https://mesonbuild.com/Build-options.html#features

So commit f6a3f6d8ad wanted to convert
'auto' to 'disabled', but instead effectively converted 'disabled' to
'auto', causing the Fontconfig subproject to be always built on Windows,
even when explicitly turned off with -D fontconfig=disabled.

A way to accomplish the original goal is available since Meson 0.59;
feature option objects gained the '.disable_auto_if()' method that
exactly converts 'auto' to 'disabled' if the boolean condition is true.
So make use of this method to properly turn off building Fontconfig on
Windows, unless explicitly enabled with -D fontconfig=enabled.

Apply the same for FreeType, which is also not very useful on Windows.

See also: 7f8135bfeb

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-07-17 15:34:44 +03:00
iasunsea
e2e826b0b1 cairo truetype reverse cmap detected memory leaks 2023-07-14 23:01:14 +08:00
Alex
90e38be99d Fix warning 2023-07-10 19:01:32 +00:00
Alex
2ecbfbce46 Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56152 memory read access because of incorrect size 2023-07-10 18:36:53 +00:00
Emmanuele Bassi
e97cfe0b73 Merge branch 'readme-gl' into 'master'
readme: drop reference to OpenGL backend

See merge request cairo/cairo!492
2023-07-10 11:58:50 +00:00
Simon Ser
0ccaf5bd68 readme: drop reference to OpenGL backend
The experimental OpenGL backend has been removed in [1]. Let's drop the
stale reference from the README.

[1]: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/287
2023-07-10 12:50:38 +02:00
Adrian Johnson
2919f392d3 Merge branch 'check-def-arches' into 'master'
meson-check-def: Exclude sections from symbol list seen on ARM & MIPS

See merge request cairo/cairo!488
2023-07-03 21:34:58 +00:00
Adrian Johnson
718e577adf Merge branch 'fix-no-png-build' into 'master'
Disable svg glyph renderer when PNG is disabled

Closes #784

See merge request cairo/cairo!489
2023-07-03 21:27:48 +00:00
Uli Schlachter
5ef0375a7d Disable svg glyph renderer when PNG is disabled
When trying to build with -Dpng=disabled with a new enough FreeType
version, the build would fail in cairo-svg-glyph-renderer.c:

    src/cairo-svg-glyph-render.c:1841:15: error: implicit declaration of
    function ‘cairo_image_surface_create_from_png_stream’; did you mean
    ‘cairo_image_surface_create_for_data’?
    [-Werror=implicit-function-declaration]

Fix this by disabling HAVE_FT_SVG_DOCUMENT when png is not enabled.

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/784
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-07-03 18:06:17 +02:00