Commit graph

8216 commits

Author SHA1 Message Date
Luca Bacci
85f308f690 Win32: Avoid checking the last error for GDI functions that don't set it
Most GDI functions do not set the last error, so GetLastError() returns
unrelated error codes. There are some exceptions, however, like BitBlt
and CreateDIBSection.

Whether a GDI function sets the last error is stated in the reference
documentation on MSDN.
2025-01-21 11:06:48 +01:00
Luca Bacci
e10adb1c2b Win32: Pass FORMAT_MESSAGE_IGNORE_INSERTS
This should always be passed when retreving messages from third
parties (unless the third party documents format strings)

See https://devblogs.microsoft.com/oldnewthing/20071128-00/?p=24353
2025-01-16 16:49:05 +01:00
Luca Bacci
d0ee67a142 Win32: Remove unused code and defines for old toolchains 2025-01-16 16:49:05 +01:00
Luca Bacci
361240657c Win32: Do not load msimg32.dll at runtime
This commit drops support for Windows 98
2025-01-16 16:49:05 +01:00
Luca Bacci
613df92660 Win32: Remove check for Windows 98 2025-01-16 16:49:05 +01: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
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
Adrian Johnson
f19e2fe080 cff: Don't fail if no local subs
Fixes: #870
2024-09-13 06:29:25 +09:30
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
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
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
Adrian Johnson
64301c6105 doc: Ensure @ in "@cairo:" is escaped when referring the the font family name
Fixes: #851
2024-06-27 07:07:22 +09:30
Adrian Johnson
c8ce9f1900 Check return value of _cairo_boxes_copy_to_clip()
Fixes: #850
2024-06-27 07:07:22 +09:30
Adrian Johnson
545073d7ed Ensure extent_y_scale is initialized
Fixes: #849
2024-06-27 07:07:22 +09:30
Adrian Johnson
fff7b8f392 Make Coverity happy
Fixes: #847
2024-06-27 07:07:22 +09:30
Adrian Johnson
2f671582ee Ensure face variables in cairo_stroker_t are initialized
Fixes: #846
2024-06-27 07:07:22 +09:30
Adrian Johnson
6967beb24e ps: fix max form size
Fixes: #845
2024-06-27 07:07:22 +09:30
Adrian Johnson
16dd5cd4c2 Merge branch 'wip/otte/xlib-overflow' into 'master'
xlib: Enlarge array for new formats

See merge request cairo/cairo!567
2024-06-24 21:26:26 +00:00
Adrian Johnson
409a6b5229 Merge branch 'master' into 'master'
Fix a memory leak

See merge request cairo/cairo!568
2024-06-24 21:18:07 +00:00
Matthias Clasen
f1d1f0ac77 Avoid an uninitialized use
Coverity complained that val may be used uninitialized in this
function, and I think it is right in this case.
2024-06-24 14:25:32 -04:00
Matthias Clasen
dd40d34fee Fix a memory leak
Coverity flagged this minor memory leak.
2024-06-24 14:17:00 -04:00
Benjamin Otte
18bb4f50cf xlib: Enlarge array for new formats
Fixes a potential overflow in _cairo_xlib_display_get_xrender_format().

Caught by Coverity
2024-06-24 18:08:47 +00:00
Adrian Johnson
0cae2a4a74 Use _cairo_calloc() to allocate structs
To avoid any possibility of uninitialized memory.

The exceptions are:
 - where the allocation is immediately overwritten by a memcpy or struct copy.
 - arrays of structs to avoid any performance impact (except when the
   array is returned by the public API).
2024-06-21 10:32:23 +09:30
Adrian Johnson
8da24bf7fb Make _cairo_calloc() consistent with _cairo_malloc()
ie

  _cairo_calloc(size)
  _cairo_calloc_ab(a, size)
2024-06-21 08:53:01 +09:30
Adrian Johnson
00ce12846a Fix cairo-ft-font.c build failure when fontconfig not available 2024-06-10 11:07:46 +09:30
Adrian Johnson
b0b5562b9e Set CLOEXEC when opening files
Based on the patch by Christian Persch in #213.

Closes #213
2024-06-08 06:40:55 +09:30
Adrian Johnson
f0a651e1ac Merge branch 'c11-atomics' into 'master'
Add support for C11 atomics

See merge request cairo/cairo!479
2024-05-31 09:40:37 +00:00
Adrian Johnson
09779a7e58 Merge branch 'update-fontconfig-and-libpng' into 'master'
Update fontconfig and libpng versions

See merge request cairo/cairo!558
2024-05-26 23:09:52 +00:00
Adrian Johnson
87f7c60bf7 Add support for C11 atomics 2024-05-26 21:17:39 +09:30
Uli Schlachter
5d67d28ff0 Remove two unused files
There are two check-link.c files which were "tests" in the autotools
build and are unused ever since the autotools build was removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2024-05-26 07:14:57 +02:00
Adrian Johnson
8d0650bb60 Use intptr_t for cairo_atomic_intptr_t
Since we now require C11 we can use intptr_t instead of figuring out
the right int size.
2024-05-25 19:05:44 +09:30
Adrian Johnson
b3656ed596 Update required libpng version 2024-05-25 10:25:51 +09:30
Adrian Johnson
bc4dfe51d2 Update required fontconfig version 2024-05-25 10:19:30 +09:30
Adrian Johnson
7f88aea155 ft: replace deprecated FT_Get_X11_Font_Format() 2024-05-25 09:02:53 +09:30
Adrian Johnson
94e3c5ce81 Update minimum FreeType to 2.10
and remove feature guards for FT functions that are in 2.10 or later.
2024-05-25 09:02:53 +09:30
Adrian Johnson
212f458949 Merge branch 'cff-global-subs-fix' into 'master'
CFF Fix crash when allocating zero size array

See merge request cairo/cairo!553
2024-05-24 21:44:13 +00:00
Uli Schlachter
f43dcc212d Merge branch 'fix-gradient-scale-crash' into 'master'
Fix "out of memory" when using linear gradient

Closes #789

See merge request cairo/cairo!535
2024-05-24 15:41:38 +00:00
Koichi Akabe
d163670f97 Merge branch 'master' into fix-gradient-scale-crash 2024-05-22 10:19:50 +09:00
Adrian Johnson
e29bd3f642 pdf: return subset status and always cleanup
_cairo_pdf_surface_finish() was not returning the status when
subsetting fails. Also ensure the surface is always cleaned up when
there is an error.
2024-05-22 07:38:18 +09:30
Emmanuele Bassi
d253188651 Merge branch 'moz-bug-1896173' into 'master'
pdf tags: Fix crash when popping the top most group following by a show_text

See merge request cairo/cairo!549
2024-05-21 11:59:14 +00:00
Emmanuele Bassi
4b775b97bf Merge branch 'moz-bug-1897561' into 'master'
Fix crash if font error in recording surface

See merge request cairo/cairo!551
2024-05-21 11:56:52 +00:00
Adrian Johnson
d465f44911 cff: Don't try allocating a zero sized array 2024-05-21 20:38:20 +09:30
Adrian Johnson
3715d93bdf Create _cairo_calloc() macro to replace calloc()
Not all platforms handle a zero sized allocation in calloc the
same. This macro ensures that _cairo_calloc(0) always returns NULL
similar to _cairo_malloc(0).
2024-05-21 20:20:49 +09:30
Adrian Johnson
3d46485365 Only use PIXMAN_r8g8b8_sRGB if available
Pixman 0.42.3 added PIXMAN_r8g8b8_sRGB to pixman_format_code_t. CI
fails if it is missing from switch statements. Building with pixman <
0.42.3 will fail if the enum is used. So put it in a versioned #if.
2024-05-21 19:47:55 +09:30
Adrian Johnson
54cbe51481 Merge branch 'update-to-fedora-40' into 'master'
Update CI to Fedora 40

See merge request cairo/cairo!546
2024-05-21 09:41:13 +00:00
Adrian Johnson
0cd376ba0b Fix crash if font error in recording surface
https://bugzilla.mozilla.org/show_bug.cgi?id=1897561
2024-05-21 18:47:18 +09:30
Adrian Johnson
1a0933d67d pdf tags: Fix crash when popping the top most group following by a show_text
https://bugzilla.mozilla.org/show_bug.cgi?id=1896173
2024-05-19 10:53:54 +09:30
Adrian Johnson
c75997a4ea Merge branch 'dest-and-uri' into 'master'
Allow links to specify 'dest' and 'uri'

See merge request cairo/cairo!547
2024-05-15 22:12:24 +00:00