Fix build with CAIRO_NO_MUTEX

The LibreOffice project builds Cairo with -DCAIRO_NO_MUTEX.
IMHO that's quite risky for big projects where you don't
control all the code that uses Cairo, but I assume they know
what they're doing.

This change should have been part of commit 87f7c60bf7, but
admittetly CAIRO_NO_MUTEX builds are not actively tested.

Fixes #921
This commit is contained in:
Luca Bacci 2026-04-27 18:44:06 +02:00
parent 8a8262e9cd
commit 01e522b200

View file

@ -62,9 +62,10 @@
#endif
#if PIXMAN_HAS_ATOMIC_OPS
static pixman_image_t *__pixman_transparent_image;
static pixman_image_t *__pixman_black_image;
static pixman_image_t *__pixman_white_image;
static cairo_atomic_intptr_t __pixman_transparent_image; /* (pixman_image_t *) */
static cairo_atomic_intptr_t __pixman_black_image;
static cairo_atomic_intptr_t __pixman_white_image;
static pixman_image_t *
_pixman_transparent_image (void)
@ -73,7 +74,7 @@ _pixman_transparent_image (void)
TRACE ((stderr, "%s\n", __FUNCTION__));
image = __pixman_transparent_image;
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_transparent_image);
if (unlikely (image == NULL)) {
pixman_color_t color;
@ -105,7 +106,7 @@ _pixman_black_image (void)
TRACE ((stderr, "%s\n", __FUNCTION__));
image = __pixman_black_image;
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_black_image);
if (unlikely (image == NULL)) {
pixman_color_t color;
@ -137,7 +138,7 @@ _pixman_white_image (void)
TRACE ((stderr, "%s\n", __FUNCTION__));
image = __pixman_white_image;
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_white_image);
if (unlikely (image == NULL)) {
pixman_color_t color;
@ -178,6 +179,7 @@ static struct {
static int n_cached;
#else /* !PIXMAN_HAS_ATOMIC_OPS */
static pixman_image_t *
_pixman_transparent_image (void)
{
@ -198,6 +200,7 @@ _pixman_white_image (void)
TRACE ((stderr, "%s\n", __FUNCTION__));
return _pixman_image_for_color (CAIRO_COLOR_WHITE);
}
#endif /* !PIXMAN_HAS_ATOMIC_OPS */