Commit graph

13107 commits

Author SHA1 Message Date
Luca Bacci
a63d15a577 cairo-test: Do not define HAVE_MKDIR on MSVC
It's already defined by Meson. Fixes the following warning:
2026-03-27 18:26:27 +01:00
Luca Bacci
b36f49dd11 cairo-script: Fix unused variable warning 2026-03-27 18:19:17 +01:00
Luca Bacci
31c80beed1 Meson: drop -Werror-implicit-function-declaration
Implicit function declaration was removed in C99. GCC and CLang
have kept supporting it in C99 mode until GCC 14 and CLang 15.
There's little reason for enabling the relative -Werror.

This also fixes a warning when compiling C++ code:

  Compiling C++ object src/libcairo-2.dll.p/win32_cairo-dwrite-font.cpp.obj
  cc1plus.exe: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++

References:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91092#c21
2026-03-27 18:12:04 +01:00
Luca Bacci
4f970fd349 Make function static
Fixes the following warning:

../cairo/src/win32/cairo-dwrite-font.cpp:519:1: warning: no previous declaration for 'void _cairo_dwrite_glyph_run_from_glyphs(...)' [-Wmissing-declarations]
  519 | _cairo_dwrite_glyph_run_from_glyphs(cairo_glyph_t *glyphs,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-03-27 18:01:50 +01:00
Luca Bacci
f36c6f7e61 Handle all enum values in switches
Fixes -Wswitch-enum warnings on GCC
2026-03-27 18:01:29 +01:00
Luca Bacci
28484f7da1 Handle new PIXMAN_a16b16g16r16 format in switch
Introduced in Pixman 0.46.0.

References:

  https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/52
2026-03-27 17:51:55 +01:00
Luca Bacci
dc136311e9 perf: Use access also on Windows
Also fixes the following warnings on ClangCL:

Compiling C object perf/cairo-analyse-trace.exe.p/cairo-analyse-trace.c.obj
../cairo/perf/cairo-analyse-trace.c(384,18): warning: unused variable 'i' [-Wunused-variable]
  384 |     unsigned int i;
      |                  ^
1 warning generated.
Compiling C object perf/cairo-perf-trace.exe.p/cairo-perf-trace.c.obj
../cairo/perf/cairo-perf-trace.c(552,18): warning: unused variable 'i' [-Wunused-variable]
  552 |     unsigned int i;
      |                  ^
1 warning generated.
2026-03-27 17:44:37 +01:00
Luca Bacci
181e71d013 Boilerplate/Win32: Fix infinite loop
../cairo/boilerplate/cairo-boilerplate-win32.c:128:28: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  128 |         for (BYTE i = 0; i <= 255; i++) {
      |                            ^~
2026-03-27 16:25:29 +01:00
Luca Bacci
542ad4a959 cairo-win32-system.c: Include cairo-win32-private.h
Fixes the following warning:

Compiling C object src/libcairo-2.dll.p/win32_cairo-win32-system.c.obj
../cairo/src/win32/cairo-win32-system.c:62:1: warning: no previous declaration for '_cairo_win32_print_api_error' [-Wmissing-declarations]
   62 | _cairo_win32_print_api_error (const char *context, const char *api)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../cairo/src/win32/cairo-win32-system.c:92:1: warning: no previous declaration for '_cairo_win32_load_library_from_system32' [-Wmissing-declarations]
   92 | _cairo_win32_load_library_from_system32 (const wchar_t *name)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026-03-27 16:25:29 +01:00
Luca Bacci
ec88bcd217 Add cairo_nonstring attribute
Fixes the following warnings on GCC:

../cairo/src/cairo-base64-stream.c:52:1: warning: initializer-string for array of 'char' truncates N
UL terminator but destination lacks 'nonstring' attribute (65 chars into 64 available) [-Wunterminat
ed-string-initialization]
   52 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

References:

  https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Common-Variable-Attributes.html
2026-03-27 16:25:29 +01:00
Luca Bacci
21afef05af font/GDI: Add static specifier to function
Fixes the following warning:

Compiling C object src/libcairo-2.dll.p/win32_cairo-win32-font.c.obj
../cairo/src/win32/cairo-win32-font.c:1322:1: warning: no previous declaration for '_cairo_compute_glyph_mask' [-Wmissing-declarations]
 1322 | _cairo_compute_glyph_mask (cairo_surface_t *surface,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
2026-03-27 16:24:33 +01:00
Luca Bacci
53eaaf6505 Drop assert
Fixes #929
2026-03-27 16:01:15 +01:00
Luca Bacci
cb4325f013 Drop register qualifier
Fixes the following warning on CLangCL:

..\cairo\src\cairoint.h(178,5): warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register]
2026-03-27 15:57:20 +01:00
Luca Bacci
d885fd341a font/GDI: Drop check for Windows >= XP 2026-03-27 15:54:24 +01:00
Luca Bacci
1d3f17e293 Fix warnings on clang-cl 2026-03-27 15:45:14 +01:00
Luca Bacci
7d14d2a90e Fix compilation with clang-cl
Works around https://github.com/llvm/llvm-project/issues/25679
2026-03-27 15:45:06 +01:00
Luca Bacci
5679baa526 cairo-script: Fix warnings 2026-03-27 11:54:11 +01:00
Luca Bacci
5fc7d49101 MSVC: Disable warning C4267 2026-03-27 11:53:50 +01:00
Luca Bacci
7aff4a0a98 MSVC: Define _USE_MATH_DEFINES via meson.build 2026-03-27 11:30:42 +01:00
Luca Bacci
57f17fd8f4 MSVC: Do not warn on use of POSIX functions without underscore
We follow the UNIX convention that POSIX functions don't have
an underscore.
2026-03-27 11:30:35 +01:00
Luca Bacci
25dd4b12fd MSVC: Error-out on use of undefined function 2026-03-27 11:28:59 +01:00
Luca Bacci
72b447dc5a MSVC: Add necessary includes
Fixes the following warnings:

  ../cairo/test/cairo-test.c(317): warning C4013: '_access' undefined; assuming extern returning int

  ../cairo/test/pdf-tagged-text.c(553): warning C4013: 'open' undefined; assuming extern returning int
  ../cairo/test/pdf-tagged-text.c(562): warning C4013: 'close' undefined; assuming extern returning int

  ../cairo/test/any2ppm.c(118): warning C4013: 'write' undefined; assuming extern returning int
  ../cairo/test/any2ppm.c(887): warning C4013: '_setmode' undefined; assuming extern returning int
2026-03-27 11:28:47 +01:00
Emmanuele Bassi
d3a35678a2 Merge branch 'recording-surface-finish-internal-helper' into 'master'
recording surface: Implement finish via reset

Closes #928

See merge request cairo/cairo!649
2026-03-03 13:59:07 +00:00
Luca Bacci
1adaf1e7c5 recording surface: Implement finish via reset
Rather than the other way round.

Fixes #928
2026-03-02 18:51:00 +01:00
Emmanuele Bassi
4fb80a9aef Merge branch 'test-fixes' into 'master'
Fix test runner on Windows and run tests in CI

Closes #887

See merge request cairo/cairo!609
2026-03-02 10:26:54 +00:00
Emmanuele Bassi
7cd2141f09 Merge branch 'dwrite' into 'master'
DWrite: Add support for COLRv1 fonts

Closes #903

See merge request cairo/cairo!625
2026-03-02 10:08:30 +00:00
Behdad Esfahbod
2a45892663 Merge branch 'rectangle-box-negative-extents' into 'master'
[matrix] Handle bounding-box extents overflow during transformation

See merge request cairo/cairo!645
2026-02-08 19:44:55 +00:00
Behdad Esfahbod
f0674b4c98 [rectanble Handle overflow in _cairo_box_from_doubles 2026-02-07 13:01:49 -07:00
Uli Schlachter
6b9e6dd0b3 Merge branch 'work/fix-leak-in-_cairo_pdf_surface_finish' into 'master'
_cairo_pdf_surface_finish: Fix leak in error conditions

See merge request cairo/cairo!644
2026-01-27 16:00:15 +00:00
Albert Astals Cid
b94bf30f03 _cairo_pdf_surface_finish: Fix leak in error conditions
Make sure surface->object_stream.stream is cleaned up even if things
failed

In poppler oss-fuzz tests we are getting this leak reported

Direct leak of 64 byte(s) in 1 object(s) allocated from:
	    #0 0x5747417eabd9 in __interceptor_calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:74:3
	    #1 0x574742706f5b in _cairo_memory_stream_create cairo/src/cairo-output-stream.c:741:14
	    #2 0x5747426757b8 in _cairo_pdf_surface_open_object_stream cairo/src/cairo-pdf-surface.c:2307:34
	    #3 0x57474266b880 in _cairo_pdf_surface_finish cairo/src/cairo-pdf-surface.c:2700:14
	    #4 0x57474261afc6 in _cairo_surface_finish cairo/src/cairo-surface.c:1043:11
	    #5 0x57474261afc6 in cairo_surface_finish cairo/src/cairo-surface.c:1092:5
	    #6 0x57474270808a in _cairo_paginated_surface_finish cairo/src/cairo-paginated-surface.c:215:2
	    #7 0x5747426175c2 in _cairo_surface_finish cairo/src/cairo-surface.c:1043:11
	    #8 0x5747426175c2 in cairo_surface_destroy cairo/src/cairo-surface.c:978:2

This fixes it.

_cairo_pdf_surface_finish was succeeding past
_cairo_pdf_surface_open_object_stream that allocates surface->object_stream.stream,
failing when calling _cairo_pdf_surface_emit_font_subsets
and that memory was never freed
2026-01-24 11:37:50 +01:00
Luca Bacci
2050326dcc CI/MSVC: Exclude <builddir>/test/srcdir symlink from the artifacts
Otherwise latest GitLab fails with:

 > ERROR: Uploading artifacts as "archive" to coordinator... error
 >   error=couldn't execute POST against https://gitlab.freedesktop.org/api/v4/jobs/[...]/artifacts?artifact_format=zip[...]:
 >   Post "https://gitlab.freedesktop.org/api/v4/jobs/[...]/artifacts?artifact_format=zip[...]":
 >   read build/test/srcdir: Incorrect function. id=[...] token=[...]
2026-01-08 15:32:30 +01:00
Luca Bacci
1fdf7051d0 CI/MSVC: Build less
Avoid building subproject tests
2026-01-08 15:32:30 +01:00
Luca Bacci
30fdc7f338 CI: Do not store .git directory in artifacts
Otherwise gitlab-runner prints a few warnings:

 > Uploading artifacts...
 > WARNING: Part of .git directory is on the list of files to archive
 > WARNING: This may introduce unexpected problems
2026-01-08 15:32:30 +01:00
Luca Bacci
ce3a3e2d27 CI: Run tests on Windows 2026-01-08 15:32:30 +01:00
Luca Bacci
08dcac510b Tests/create-regions: skip if needed features are missing 2026-01-08 15:32:30 +01:00
Luca Bacci
15cb2d7acf Tests/font-variations: Cleanup resources in all cases
Otherwise the test runner detects leaks
2026-01-08 15:32:30 +01:00
Luca Bacci
1293ec674d Tests/pdf-operator-text: Check if pdf target is enabled
The same is done in pdf-mime-data.c
2026-01-08 15:32:30 +01:00
Luca Bacci
83e5d95ec2 Boilerplate/Win32: Switch to a DIB section
Thw Win32 boilerplate worked by creating an offscreen window
and creating a cairo surface that targets the client HDC.
However GDI clips the client HDC to the visible region of the
window, and that region is empty. In the end, every GDI drawing
operation turned into a no-op.

Rather than targeting HWNDs, it's much better to create a bitmap
(DIB Section) and draw via a memory HDC.

https://learn.microsoft.com/en-us/windows/win32/gdi/window-regions
https://devblogs.microsoft.com/oldnewthing/20030829-00/?p=42743
https://devblogs.microsoft.com/oldnewthing/20030902-00/?p=42693
2026-01-08 15:32:24 +01:00
Luca Bacci
2c354599a5 Boilerplate: Use backward slashes for system / popen commands on Windows
Both system() and popen() invoke the shell. Which shell is
invoked depends on the COMSPEC environment variable, but
usually it's CMD.exe.

CMD.exe doesn't quite like paths with forward slashes in its
command-line. Most of the times, the forward slash is mistaken
for a command line switch (the start of an option). For example:

  cmd /c "dir C:\Windows" works
  cmd /c "dir C:/Windows" doesn't work
2026-01-08 15:27:09 +01:00
Luca Bacci
626b3ab2f2 Boilerplate: Open pipe in binary mode on Windows
Open the pipe in binary mode on Windows to get the expected
byte counts. Note that the 'b' mode for popen is not portable
and so is used only on Windows:

> The behavior of popen() is specified for values of mode of "r",
> "w", "re", and "we". Other modes such as "rb" and "wb" might be
> supported by specific implementations, but these would not be
> portable features.

https://pubs.opengroup.org/onlinepubs/9799919799/functions/popen.html
2026-01-08 15:24:05 +01:00
Luca Bacci
652456af2d Meson: Use mklink to create the <builddir>/test/srcdir link on Windows
Create the directory symlink '<builddir>/test/srcdir' -> '<sourcedir>'
as done on UNIX with coreutils.
2026-01-08 15:23:33 +01:00
Uli Schlachter
200a02286b Merge branch 'patch-1' into 'master'
Add missing mutex cleanup in _cairo_recording_surface_finish

Closes #922

See merge request cairo/cairo!643
2025-12-20 06:29:18 +00:00
Alvin Wong
5833de29f3 Add missing mutex cleanup in _cairo_recording_surface_finish 2025-12-17 16:35:49 +00:00
Uli Schlachter
04656d7450 Merge branch 'tests-misc-fixes' into 'master'
Tests: Misc enhancements

See merge request cairo/cairo!634
2025-07-17 18:38:49 +00:00
Tim-Philipp Müller
6955595c60 Merge branch 'ci-macos-arm64' into 'master'
ci: add macOS arm64

See merge request cairo/cairo!498
2025-07-16 17:31:44 +00:00
Luca Bacci
a9e3eaccb8 CI: Add coverage-column-triangles to Quartz ignores
Fails with the following log:

Testing coverage-column-triangles with quartz target (dev offset 0 scale: 1)
963 pixels differ (with maximum difference of 9) from reference image
963 pixels differ (with maximum difference of 9) from reference image
OUTPUT: output/coverage-column-triangles.quartz.argb32.out.png
REFERENCE: ../../test/reference/coverage-column-triangles.ref.png
DIFFERENCE: output/coverage-column-triangles.quartz.argb32.diff.png
TEST: coverage-column-triangles TARGET: quartz FORMAT: argb32 OFFSET: 0 SCALE: 1 SIMILAR: 0 RESULT: FAIL
(...)
2025-07-16 11:52:45 +02:00
Luca Bacci
2e0713971f Update Quartz reference images 2025-07-16 11:52:45 +02:00
Tim-Philipp Müller
d371015d45 ci: add macOS arm64 2025-07-16 11:52:41 +02:00
Luca Bacci
355e421640 CI: Avoid running duplicated tests
...also simplifies .gitlab-ci.yml a bit
2025-07-15 14:28:27 +02:00
Luca Bacci
2b7ab8b895 Remove leftover scripts from the autotools build 2025-07-15 14:28:18 +02:00