Commit graph

12980 commits

Author SHA1 Message Date
Emmanuele Bassi
e2a52c0870 Merge branch 'dwrite-font-variations' into 'master'
DWrite: Add support for font variations

Closes #877

See merge request cairo/cairo!601
2025-01-30 09:26:49 +00:00
Emmanuele Bassi
ed7b0a54b9 Merge branch 'dwrite-fix-warnings' into 'master'
DWrite: Fix warnings

See merge request cairo/cairo!603
2025-01-30 09:25:57 +00:00
Luca Bacci
e0287e09f4 DWrite/GeometryRecorder: Add final specifier 2025-01-21 13:55:27 +01:00
Luca Bacci
46153a0408 DWrite/GeometryRecorder: Complete implementation of QueryInterface
...by checking for IUnknown.

This makes GeometryRecorder::QueryInterface compliant with the
rules of COM.

QueryInterface for IUnknown has a special meaning in COM: it's
used to check whether two interface pointers refer to the same
object.
2025-01-21 13:55:26 +01:00
Luca Bacci
59197e7791 DWrite/GeometryRecorder: Add noexcept specifier
STDMETHOD / IFACEMETHOD macros already add __declspec(nothrow), but
noexcept is better. From MSDN [1]:

  We recommend that all new code use the noexcept operator rather than
  __declspec(nothrow).
  This attribute tells the compiler that the declared function and the
  functions it calls never throw an exception. However, it does not
  enforce the directive. In other words, it never causes std::terminate
  to be invoked, unlike noexcept, or in std:c++17 mode (Visual Studio
  2017 version 15.5 and later), throw().

See also [2]:

  Non-throwing functions are permitted to call potentially-throwing
  functions. Whenever an exception is thrown and the search for a handler
  encounters the outermost block of a non-throwing function, the function
  std::terminate is called:

  extern void f(); // potentially-throwing

  void g() noexcept {
    f();      // valid, even if f throws
    throw 42; // valid, effectively a call to std::terminate
  }

References:

 [1] https://learn.microsoft.com/en-us/cpp/cpp/nothrow-cpp?view=msvc-170
 [2] https://en.cppreference.com/w/cpp/language/noexcept_spec
2025-01-21 13:55:19 +01:00
Luca Bacci
8107086c6a DWrite/GeometryRecorder: Add override specifier
IFACEMETHOD already adds the __override / __allowed(on_function) SAL
annotation (only on Windows SDK, not mingw-w64), which is understood
by some code analysis tools [1]. Since we're compiling in C++11 mode,
we can add the override specifier, so that the compiler is informed
as well.

[1] https://devblogs.microsoft.com/oldnewthing/20200911-00/?p=104205
2025-01-21 12:16:35 +01:00
Luca Bacci
bdac729974 DWrite/GeometryRecorder: Use IFACEMETHOD consistently
Fixes the following warnings on CLang:

  ../cairo/src/win32/cairo-dwrite-font.cpp:869:27: warning: exception specification
  of overriding function is more lax than base version [-Wmicrosoft-exception-spec]
    869 |     IFACEMETHODIMP_(void) SetFillMode(D2D1_FILL_MODE fillMode)
        |                           ^
  D:/msys64/clang64/include/d2d1.h:1491:22: note: overridden virtual function is here
   1491 |     STDMETHOD_(void, SetFillMode)(D2D1_FILL_MODE fillMode) PURE;
        |

COM objects are usually implemented like that:

1. The class is defined with only method declarations. For that,
   one should use IFACEMETHOD macros.
2. Then methods are implemented (defined), outside of the class
   definition. For that, one should use the IFACEMETHODIMP macros

If one really wants to provide inline method definitions (that is,
inside the class definition), then IFACEMETHOD macros should be used
(and not IFACEMETHODIMP, though it's a definition / implementation).
2025-01-21 12:02:51 +01:00
Uli Schlachter
727966dfca Merge branch 'depth-mask-ub' into 'master'
cairo-xcb-connection.c: fix undefined behavior in DEPTH_MASK

See merge request cairo/cairo!604
2025-01-13 16:52:21 +00:00
bandithedoge
6e0f760117 cairo-xcb-connection.c: fix undefined behavior in DEPTH_MASK
Bit-shifting a signed integer (which is what 1 is here) left is
undefined behavior – you can see it when compiling with
`-fsanitize=undefined`. Explicitly declaring 1 as unsigned fixes this.
2025-01-13 13:17:56 +01:00
Luca Bacci
56b8933ede DWrite: Remove unused variables 2025-01-08 11:06:26 +01:00
Luca Bacci
b84b3542d1 DWrite: Add support for font variations
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/877
2024-11-11 19:41:07 +01:00
Luca Bacci
6cd0a7d395 DWrite: Add IDWriteFontFace field in the scaled font subclass
...and make the code use that instead of the original IDWriteFontFace
in the font face subclass. We do that because to apply a few settings
(font variations) a new IDWriteFontFace must be created out of the
original one.

For now the IDWriteFontFace in the scaled font is a copy of the one in
the font face. In the next commit we'll add code to create a different
object.
2024-11-08 17:00:45 +01:00
Tim-Philipp Müller
33173d9f1a Merge branch 'mingw11' into 'master'
dwrite: Fix build with MinGW 11

Closes #874

See merge request cairo/cairo!600
2024-10-26 14:29:19 +00:00
Uli Schlachter
17ea368a18 Merge branch 'gitlab' into 'master'
BUGS: update bug database links to use gitlab instead of bugzilla

See merge request cairo/cairo!598
2024-10-19 09:11:31 +00:00
Nirbheek Chauhan
0835add95c dwrite: Fix build with MinGW 11
DWRITE_GLYPH_IMAGE_FORMATS is now defined by dcommon.h

In file included from C:/msys64/ucrt64/include/minwindef.h:163,
                 from C:/msys64/ucrt64/include/windef.h:9,
                 from C:/msys64/ucrt64/include/windows.h:69,
                 from ..\src/cairo-mutex-impl-private.h:182,
                 from ..\src/cairo-mutex-type-private.h:45,
                 from ..\src/cairo-scaled-font-private.h:45,
                 from ..\src/cairoint.h:415,
                 from ../src/win32/cairo-dwrite-font.cpp:37:
../src/win32/dw-extra.h:26:1: error: redefinition of 'DWRITE_GLYPH_IMAGE_FORMATS operator|(DWRITE_GLYPH_IMAGE_FORMATS, DWRITE_GLYPH_IMAGE_FORMATS)'
   26 | DEFINE_ENUM_FLAG_OPERATORS(DWRITE_GLYPH_IMAGE_FORMATS);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/ucrt64/include/dcommon.h:67:1: note: 'DWRITE_GLYPH_IMAGE_FORMATS operator|(DWRITE_GLYPH_IMAGE_FORMATS, DWRITE_GLYPH_IMAGE_FORMATS)' previously defined here
   67 | DEFINE_ENUM_FLAG_OPERATORS(DWRITE_GLYPH_IMAGE_FORMATS)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
2024-10-18 04:33:55 +05:30
Emmanuele Bassi
5111be12d4 Merge branch 'solaris' into 'master'
Fix cairo-perf-print & pdf-structure test builds on Solaris

See merge request cairo/cairo!599
2024-10-13 22:19:15 +00:00
Alan Coopersmith
78f7dbcba8 Fix cairo-perf-print build on Solaris
Adds include of <termios.h> if system has it, in order to fix:

../perf/cairo-perf-print.c: In function ‘report_print’:
../perf/cairo-perf-print.c:62:28: error: storage size of ‘ws’ isn’t known
   62 |             struct winsize ws;
      |                            ^~
../perf/cairo-perf-print.c:64:26: error: ‘TIOCGWINSZ’ undeclared
 (first use in this function)
   64 |             if(ioctl(fd, TIOCGWINSZ, &ws) == 0 ) {
      |                          ^~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-10-13 11:07:44 -07:00
Alan Coopersmith
936f20c37e Fix pdf-structure test build on Solaris
Adds include of <sys/wait.h> if system has it, in order to fix:

../test/pdf-structure.c: In function ‘check_pdf’:
../test/pdf-structure.c:551:21: error: implicit declaration of function
 ‘WIFEXITED’ [-Wimplicit-function-declaration]
  551 |                     WIFEXITED (ret) ? WEXITSTATUS (ret) : -1);
      |                     ^~~~~~~~~
../test/pdf-structure.c:551:39: error: implicit declaration of function
 ‘WEXITSTATUS’ [-Wimplicit-function-declaration]
  551 |                     WIFEXITED (ret) ? WEXITSTATUS (ret) : -1);
      |                                       ^~~~~~~~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-10-13 11:01:59 -07:00
Adrian Johnson
21e6b2c6ad Merge branch 'feature/bugfix-include-ft-color' into 'master'
cairo-ft-private.h: fix missing FT_Color error

Closes #792

See merge request cairo/cairo!597
2024-10-03 22:04:01 +00:00
Alan Coopersmith
6702561c74 BUGS: update bug database links to use gitlab instead of bugzilla
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2024-09-30 18:58:00 -07:00
Thomas Devoogdt
9607e19a9e
cairo-ft-private.h: fix missing FT_Color error
In file included from ../src/cairo-colr-glyph-render.c:37:
../src/cairo-ft-private.h:87:30: error: unknown type name 'FT_Color'
   87 |                              FT_Color               *palette,
      |                              ^~~~~~~~

Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/792

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
2024-09-20 15:26:21 +02:00
Emmanuele Bassi
b9eed915f9 Merge branch 'issue-870' into 'master'
cff: Don't fail if no local subs

Closes #870

See merge request cairo/cairo!595
2024-09-12 23:36:36 +00:00
Adrian Johnson
f19e2fe080 cff: Don't fail if no local subs
Fixes: #870
2024-09-13 06:29:25 +09:30
Tim-Philipp Müller
62d99c8a65 Merge branch 'hgr/lzo_option' into 'master'
meson: expose lzo as a meson option

See merge request cairo/cairo!590
2024-09-10 15:14:58 +00:00
Håvard Graff
c1748e79f0 meson: expose lzo as a meson option 2024-09-10 16:26:21 +02:00
Uli Schlachter
65a29e787a Merge branch 'landing-page' into 'master'
Add a landing page for GitLab pages

See merge request cairo/cairo!594
2024-09-06 16:06:20 +00:00
Uli Schlachter
781cf20bf9 Merge branch 'lzo' into 'master'
Fix include paths for LZO headers

See merge request cairo/cairo!583
2024-09-06 15:27:02 +00:00
Federico Mena Quintero
1ed8bb6543 Oops, don't list the analysis stage twice 2024-09-05 10:13:53 -06:00
Federico Mena Quintero
3f709d0050 Add a landing page for GitLab pages
GitLab pages for cairo appear in
https://cairo.pages.freedesktop.org/cairo/ but there is nothing there
right now, so it gives a 404.  Only
https://cairo.pages.freedesktop.org/cairo/coverage works so far.

So, add public/index.html as a minimal landing page.  My intention is
to link other things from there - an HTMLized report of the test
suite, a development guide, things like that.
2024-09-05 10:09:26 -06:00
Benjamin Gilbert
9735309da6 Fix include paths for LZO headers
lzo2's pkg-config file has always specified "Cflags: -I${includedir}/lzo".
Including <lzo/lzo2a.h> happens to work if ${includedir} is already on the
header search path, e.g. it's /usr/include.  However, if lzo2 is in an
unusual location and we're depending on pkg-config to tell us where it is,
we'll end up looking for ${includedir}/lzo/lzo/lzo2a.h and failing the
build:

    util/cairo-script/cairo-script-file.c:45:10: fatal error: 'lzo/lzo2a.h' file not found

Fix the include paths.
2024-09-04 22:30:41 -07:00
Adrian Johnson
39ba22d7e6 Merge branch 'coverage' into 'master'
Add CI jobs for static analysis and a test coverage report

See merge request cairo/cairo!574
2024-09-02 11:13:59 +00:00
Emmanuele Bassi
ad53e74fd2 Merge branch 'ebassi/release-1-18-2' into 'master'
Release Cairo 1.18.2

See merge request cairo/cairo!581
2024-09-01 14:02:38 +00:00
Emmanuele Bassi
e90b49ed50 Post-release version bump to 1.18.3 2024-09-01 14:21:28 +01:00
Emmanuele Bassi
200441e685 Release Cairo 1.18.2 2024-09-01 14:09:23 +01:00
Federico Mena Quintero
dd4da92782 Keep artifacts for the static-scan job 2024-08-27 21:20:53 -06:00
Federico Mena Quintero
acb5e2e80a CI: Add a job for static analysis
We add this in a new 'analysis' stage in the CI, which is where we'll
put jobs for sanitizers, test coverage reports, etc.
2024-08-27 21:20:00 -06:00
Federico Mena Quintero
e6e76c5c25 Move the analysis stage to just before deploy 2024-08-27 21:18:41 -06:00
Federico Mena Quintero
2366646d93 Deploy the coverage report to gitlab pages
It should appear in https://cairo.pages.gitlab.freedesktop.org/coverage
2024-08-27 21:18:40 -06:00
Federico Mena Quintero
744f4d75b3 CI: Add a basic test coverage job
Later we'll add one coverage job per backend, and aggregate all of the
results at the end for the coverage report.
2024-08-27 21:18:10 -06:00
Federico Mena Quintero
b5c6ef2853 CI: Install rust and grcov
The Rust toolchain is so that we can build and install grcov, which is
Mozilla's tool to aggregate test coverage data into a report.
2024-08-27 21:15:38 -06:00
Uli Schlachter
bbf385d35c Merge branch 'remove-win32-readme' into 'master'
Remove README.win32

See merge request cairo/cairo!578
2024-08-10 07:27:51 +00:00
Adrian Johnson
b5b1c8505a Remove README.win32
These instructions are for the autotools build. The Meson build does
not require special instructions for Windows.
2024-08-10 14:36:23 +09:30
Uli Schlachter
43e08aed8b Merge branch 'fix_glyph_path' into 'master'
Fix cairo_glyph_path() early clipping

See merge request cairo/cairo!576
2024-08-02 16:57:48 +00:00
Heiko Lewin
d8c1db11dd
Fix cairo_glyph_path() early clipping 2024-07-26 08:18:20 +02:00
Adrian Johnson
2d7fcf17f7 Merge branch 'msys-clang-fix' into 'master'
Fix MSYS clang build error

See merge request cairo/cairo!575
2024-07-25 22:18:50 +00:00
Adrian Johnson
1d20d8f476 meson: use has_define() to check if define exists 2024-07-25 08:27:37 +09:30
Adrian Johnson
b69d569c3c Windows should always use win32 atomics
instead of gcc builtins.
2024-07-25 08:25:57 +09:30
Adrian Johnson
b99f6ff534 Fix MSYS clang build error
../src/cairo-atomic-private.h:210:43: warning: incompatible pointer types passing 'void **' to param
eter of type 'cairo_atomic_intptr_t *' (aka 'long long *') [-Wincompatible-pointer-types]
  210 |     return __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
_CST);
      |                                           ^~~~~~~~~
../src/cairo-atomic-private.h:210:54: error: incompatible pointer to integer conversion passing 'voi
d *' to parameter of type 'cairo_atomic_intptr_t' (aka 'long long') [-Wint-conversion]
  210 |     return __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
_CST);
      |                                                      ^~~~
../src/cairo-atomic-private.h:220:43: warning: incompatible pointer types passing 'void **' to param
eter of type 'cairo_atomic_intptr_t *' (aka 'long long *') [-Wincompatible-pointer-types]
  220 |     (void) __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
_CST);
      |                                           ^~~~~~~~~
../src/cairo-atomic-private.h:220:54: error: incompatible pointer to integer conversion passing 'voi
d *' to parameter of type 'cairo_atomic_intptr_t' (aka 'long long') [-Wint-conversion]
  220 |     (void) __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
_CST);
      |                                                      ^~~~
2024-07-25 08:23:46 +09:30
Federico Mena Quintero
5f1fc5fa00 CI: install some more llvm/clang packages for coverage and sanitizers 2024-07-24 14:32:57 -06:00
Adrian Johnson
0275440533 Merge branch 'bugfix/compile-without-cpp' into 'master'
meson: only require cpp for windows

See merge request cairo/cairo!573
2024-07-18 22:32:13 +00:00