Commit graph

12809 commits

Author SHA1 Message Date
Emmanuele Bassi
ac9ffd3e8a docs: Add missing docblocks for content tags 2023-09-23 15:18:31 +01:00
Emmanuele Bassi
1678bfb2ec Ensure that argument names in declarations match definitions
The name of an argument in the header must match the name of the
argument in the source, otherwise gtk-doc will raise a warning.
2023-09-23 15:18:31 +01:00
Emmanuele Bassi
1b77892a18 docs: Add missing long description for cairo-quartz-font section 2023-09-23 15:18:31 +01:00
Emmanuele Bassi
cfd8356a75 docs: Do not make private symbols with docblocks
Otherwise gtk-doc will warn about undocumented/unused symbols.
2023-09-23 15:18:31 +01:00
Emmanuele Bassi
6c7fb34627 docs: Add missing docblocks for the device observer API 2023-09-23 13:20:07 +01:00
Emmanuele Bassi
98867c6cf3 docs: Add missing section docblock for cairo-tee 2023-09-23 13:19:43 +01:00
Emmanuele Bassi
b770d57b26 Remove pointless CAIRO_HAS_DITHER
The support for dithering is not conditional, and it can be checked
using the Cairo version.
2023-09-23 13:18:34 +01:00
Emmanuele Bassi
1445068291 docs: Add missing tee surface section 2023-09-23 13:12:23 +01:00
Emmanuele Bassi
7c5d0de2d2 docs: Hide private docs
If a private symbol gets a docblock stanza, gtk-doc becomes *very*
confused.
2023-09-23 13:11:46 +01:00
Emmanuele Bassi
d2790e2b1a docs: Update the symbols list 2023-09-23 12:54:24 +01:00
Emmanuele Bassi
10163e4870 docs: Fix versioned symbol indices
Something changed in the docbook XSL, and we cannot use the `index`
element for the versioned indices any more. Using `chapter` brings the
indices back.
2023-09-23 12:50:45 +01:00
Emmanuele Bassi
900b713af1 Merge branch 'ebassi/dithering' into 'master'
Enable access to the pixman dithering path

See merge request cairo/cairo!511
2023-09-23 11:49:49 +00:00
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
6f9dbdad81 Merge branch 'remove-sphinx' into 'master'
Remove cairo-sphinx

See merge request cairo/cairo!510
2023-09-23 11:11:17 +00:00
Emmanuele Bassi
6d2d6f312b Merge branch 'leak-bug-431' into 'master'
Fix leak in test/bug-431.c

See merge request cairo/cairo!513
2023-09-23 11:10:47 +00:00
Emmanuele Bassi
86d7025af5 Merge branch 'wip-fix-352' into 'master'
Avoid assert when drawing arcs with NaN angles

Closes #352

See merge request cairo/cairo!515
2023-09-23 11:10:16 +00:00
Uli Schlachter
ed86d953a6 Merge branch 'leak' into 'master'
Fix font options leak in _cairo_gstate_ensure_scaled_font()

See merge request cairo/cairo!514
2023-09-20 14:28:47 +00:00
Tim Serong
09643ee1ab Avoid assert when drawing arcs with NaN angles
I hit the problem with _cairo_arc_in_direction() failing the
angle_max >= angle_min assertion earlier this year when using
Thunderbird on openSUSE Tumbleweed.  Thunderbird would crash
when rendering some (but not all) HTML email due to this
assert.  For some reason, one of the angles passed in was
NaN.  Making _cairo_arc_in_direction() return immediately if
either angle is not finite fixed the problem for me, but I
don't know enough about the internals of Cairo to know if
this is, strictly speaking, the "right" fix.  Also, having
tested again today _without_ this change applied, I am now
no longer able to reproduce the problem :-/  I still have the
same version of Cairo installed (1.17.8), but various other
packages on that system have been updated in the meantime,
so maybe that's a factor.  Or maybe I'm just lucky and
haven't hit a "bad" HTML email this time...?

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/352
Signed-off-by: Tim Serong <tserong@suse.com>
2023-09-19 18:26:39 +10:00
Christian Hesse
e364946957 Fix font options leak in _cairo_gstate_ensure_scaled_font()
Font options are allocated in _cairo_gstate_ensure_scaled_font() for local
processing, but never freed. Run _cairo_font_options_fini() on these and
fix the leak.

Signed-off-by: Christian Hesse <mail@eworm.de>
2023-09-18 23:31:23 +02:00
Emmanuele Bassi
c45e373fb4 Merge branch 'font-option-leaks' into 'master'
Fix font options leak in gstate

Closes #795

See merge request cairo/cairo!512
2023-09-18 17:40:52 +00:00
Uli Schlachter
14ae7c7fd2 Fix leak in test/bug-431.c
This test creates surfaces and patterns that it never cleans up. Found via
running:

  CAIRO_TEST_TARGET=image valgrind --leak-check=full ./cairo-test-suite -f bug-431

Output before this commit:

==21310==
==21310== HEAP SUMMARY:
==21310==     in use at exit: 569,788 bytes in 26 blocks
==21310==   total heap usage: 1,523 allocs, 1,497 frees, 2,034,252 bytes allocated
==21310==
==21310== 336 bytes in 2 blocks are definitely lost in loss record 5 of 17
==21310==    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310==    by 0x48BE2B0: _cairo_pattern_create_solid (cairo-pattern.c:614)
==21310==    by 0x48BE4B1: cairo_pattern_create_rgba (cairo-pattern.c:720)
==21310==    by 0x1358C6: draw (bug-431.c:50)
==21310==    by 0x129EDB: cairo_test_for_target (cairo-test.c:938)
==21310==    by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310==    by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310==    by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== 278,534 (144 direct, 278,390 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 17
==21310==    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310==    by 0x48BE51E: cairo_pattern_create_for_surface (cairo-pattern.c:756)
==21310==    by 0x135838: draw (bug-431.c:41)
==21310==    by 0x129EDB: cairo_test_for_target (cairo-test.c:938)
==21310==    by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310==    by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310==    by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== 278,534 (144 direct, 278,390 indirect) bytes in 1 blocks are definitely lost in loss record 16 of 17
==21310==    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21310==    by 0x48BE51E: cairo_pattern_create_for_surface (cairo-pattern.c:756)
==21310==    by 0x488274D: _cairo_default_context_set_source_surface (cairo-default-context.c:327)
==21310==    by 0x49063DB: cairo_set_source_surface (cairo.c:977)
==21310==    by 0x1AC1DD: _cairo_boilerplate_get_image_surface (cairo-boilerplate.c:337)
==21310==    by 0x12A486: cairo_test_for_target (cairo-test.c:1145)
==21310==    by 0x12B36A: _cairo_test_context_run_for_target (cairo-test.c:1545)
==21310==    by 0x12C370: _cairo_test_runner_draw (cairo-test-runner.c:258)
==21310==    by 0x12DEA0: main (cairo-test-runner.c:962)
==21310==
==21310== LEAK SUMMARY:
==21310==    definitely lost: 624 bytes in 4 blocks
==21310==    indirectly lost: 556,780 bytes in 16 blocks
==21310==      possibly lost: 0 bytes in 0 blocks
==21310==    still reachable: 12,384 bytes in 6 blocks
==21310==         suppressed: 0 bytes in 0 blocks
==21310== Reachable blocks (those to which a pointer was found) are not shown.
==21310== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==21310==
==21310== For lists of detected and suppressed errors, rerun with: -s
==21310== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 12:26:19 +02:00
Uli Schlachter
06864022c8 Fix font options leak in cairo script surface
I added options->variations = strdup("slnt=0,wght=400,wdth=100"); to the
end of _cairo_font_options_init_default(). This makes all font option
objects own some memory that needs to be freed. Then I ran some random
test under valgrind and found memory leaks.

This commit makes the script surface finish the font options that it
contains. This fixes the following valgrind report:

 25 bytes in 1 blocks are definitely lost in loss record 8 of 21
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4ECBC99: strdup (strdup.c:42)
    by 0x4886B7F: _cairo_font_options_init_default (cairo-font-options.c:86)
    by 0x49768F4: _cairo_script_implicit_context_init (cairo-script-surface.c:3676)
    by 0x4976B22: _cairo_script_surface_create_internal (cairo-script-surface.c:3733)
    by 0x4976EA1: cairo_script_surface_create (cairo-script-surface.c:3962)
    by 0x1B0A97: _cairo_boilerplate_script_create_surface (cairo-boilerplate-script.c:63)
    by 0x129B7F: cairo_test_for_target (cairo-test.c:824)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 10:00:51 +02:00
Uli Schlachter
29087868cd Fix font options leak in _cairo_surface_copy_similar_properties()
I added options->variations = strdup("slnt=0,wght=400,wdth=100"); to the
end of _cairo_font_options_init_default(). This makes all font option
objects own some memory that needs to be freed. Then I ran some random
test under valgrind and found memory leaks.

_cairo_surface_copy_similar_properties() gets the font options of a
surface via cairo_surface_get_font_options(). This creates a copy of the
font variations that I added above. _cairo_surface_set_font_options()
then copies this again (it calls _cairo_font_options_init_copy). Thus,
the original copy is still owned by
_cairo_surface_copy_similar_properties() and needs to be freed.

This commit fixes four leaks in "valgrind --leak-check=full
./cairo-test-suite -f leaks-set-scaled-font". A random example is:

 25 bytes in 1 blocks are definitely lost in loss record 4 of 25
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4ECBC99: strdup (strdup.c:42)
    by 0x4886C0C: _cairo_font_options_init_copy (cairo-font-options.c:99)
    by 0x48F1DDE: cairo_surface_get_font_options (cairo-surface.c:1620)
    by 0x48F0691: _cairo_surface_copy_similar_properties (cairo-surface.c:454)
    by 0x48F087C: cairo_surface_create_similar (cairo-surface.c:528)
    by 0x1B168A: _cairo_boilerplate_pdf_create_surface (cairo-boilerplate-pdf.c:92)
    by 0x129B7F: cairo_test_for_target (cairo-test.c:824)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 09:51:51 +02:00
Uli Schlachter
4c1987b0f0 Fix font options leak in cairo-surface.c
When calling cairo_surface_get_font_options(), a font options instance
is allocated for the surface. Normally, this just initialised some
otherwise uninitialised fields in cairo_surface_t. Since commit
67eeed44, cairo_font_options_t can contain an extra allocation for a
custom palette. Since commit edf9497c3a, cairo_font_options_t can
contain an extra allocation for a string. Before these commit, font
options could just be dropped, but now they need to be freed.

This commit makes cairo_surface_destroy() finish the contained font
options if they were initialised.

I didn't manage to produce a self-contained test case for this leak. I
found it by just looking at the code. However, I found a way to force a
leak: By adding options->variations=strdtup("slnt=0,wght=400,wdth=100");
to the end of _cairo_font_options_init_default(), all font option
instances now cause a leak unless they are finished. With this extra
change, this commit fixes a memory leak that is simply caused by calling
cairo_surface_get_font_options().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 09:45:04 +02:00
Uli Schlachter
7bf743a92f Fix font options leak in scaled font
A scaled font contains font options. Since commit 67eeed44, this can
contain an extra allocation for a custom palette. Since commit
edf9497c3a, this contains an extra allocation for a string. Before these
commit, font options could just be dropped, but now they need to be
freed.

This commit makes the relevant code for creating and finishing scaled
fonts also clean up the font options.

The test added in the previous commit also hits this bug (I only found
these leaks accidentially!). Running "valgrind --leak-check=full
./cairo-test-suite -f leaks-set-scaled-font" no longer reports the following
after this change:

 40 bytes in 1 blocks are definitely lost in loss record 1 of 11
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4886C62: _cairo_font_options_init_copy (cairo-font-options.c:105)
    by 0x48DAFFB: _cairo_scaled_font_init_key (cairo-scaled-font.c:675)
    by 0x48DC077: cairo_scaled_font_create (cairo-scaled-font.c:1096)
    by 0x15BF08: leaks_set_scaled_font (leaks.c:43)
    by 0x129EF0: cairo_test_for_target (cairo-test.c:938)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

 40 bytes in 1 blocks are definitely lost in loss record 2 of 11
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4886C62: _cairo_font_options_init_copy (cairo-font-options.c:105)
    by 0x49337BB: _cairo_ft_font_face_scaled_font_create (cairo-ft-font.c:2073)
    by 0x48DC340: cairo_scaled_font_create (cairo-scaled-font.c:1176)
    by 0x15BF08: leaks_set_scaled_font (leaks.c:43)
    by 0x129EF0: cairo_test_for_target (cairo-test.c:938)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

 40 bytes in 1 blocks are definitely lost in loss record 3 of 11
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4886C62: _cairo_font_options_init_copy (cairo-font-options.c:105)
    by 0x48DB280: _cairo_scaled_font_init (cairo-scaled-font.c:742)
    by 0x4933804: _cairo_ft_font_face_scaled_font_create (cairo-ft-font.c:2076)
    by 0x48DC340: cairo_scaled_font_create (cairo-scaled-font.c:1176)
    by 0x15BF08: leaks_set_scaled_font (leaks.c:43)
    by 0x129EF0: cairo_test_for_target (cairo-test.c:938)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 09:32:10 +02:00
Uli Schlachter
9529d02f6a Fix font options leak in gstate
cairo_gstate_t contains a cairo_font_options_t. Since commit 67eeed44,
this can contain an extra allocation for a custom palette. Since commit
edf9497c3a, this contains an extra allocation for a string. Before these
commit, font options could just be dropped, but now they need to be
freed.

This commit makes _cairo_gstate_fini() finish the font options to free
the memory allocation.

The new test was run via "valgrind --leak-check=full ./cairo-test-suite
-f leaks-set-scaled-font". The following reported leak goes away thanks
to this commit:

 1,040 bytes in 26 blocks are definitely lost in loss record 6 of 12
    at 0x48407B4: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x4886C62: _cairo_font_options_init_copy (cairo-font-options.c:105)
    by 0x488C029: _cairo_gstate_set_font_options (cairo-gstate.c:1757)
    by 0x48841D7: _cairo_default_context_set_scaled_font (cairo-default-context.c:1310)
    by 0x490809A: cairo_set_scaled_font (cairo.c:3318)
    by 0x15BF1F: leaks_set_scaled_font (leaks.c:45)
    by 0x129EF0: cairo_test_for_target (cairo-test.c:938)
    by 0x12B37F: _cairo_test_context_run_for_target (cairo-test.c:1545)
    by 0x12C385: _cairo_test_runner_draw (cairo-test-runner.c:258)
    by 0x12DEB5: main (cairo-test-runner.c:962)

Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/795
Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-09-17 09:22:29 +02: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
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
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