3 commits - src/cairo-mutex-list-private.h src/win32
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 16 17:15:10 UTC 2025
src/cairo-mutex-list-private.h | 1 -
src/win32/cairo-dwrite-font.cpp | 3 +++
src/win32/cairo-win32-font.c | 12 +++++-------
3 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit 3ffb6d5c07087676fabf7bd4b75c1ed9eb7e624d
Merge: a3ca983ec ee554c861
Author: Tim-Philipp Müller <tim at centricular.com>
Date: Mon Jun 16 17:15:07 2025 +0000
Merge branch 'win32-fixes' into 'master'
Win32 Fixes
Closes #897
See merge request cairo/cairo!626
commit ee554c8610cb1f89ce18f8635f7ccb4d610314b4
Author: Luca Bacci <luca.bacci982 at gmail.com>
Date: Mon Jun 16 17:41:38 2025 +0200
DWrite: Fix switch for grid-fit mode
Ooops!
diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp
index bf5191967..9f6d362b3 100644
--- a/src/win32/cairo-dwrite-font.cpp
+++ b/src/win32/cairo-dwrite-font.cpp
@@ -1496,12 +1496,15 @@ _cairo_dwrite_scaled_font_init_glyph_surface (cairo_dwrite_scaled_font_t *scaled
switch (cairo_font_options_get_hint_style (&scaled_font->base.options)) {
case CAIRO_HINT_STYLE_DEFAULT:
grid_fit_mode = DWRITE_GRID_FIT_MODE_DEFAULT;
+ break;
case CAIRO_HINT_STYLE_NONE:
grid_fit_mode = DWRITE_GRID_FIT_MODE_DISABLED;
+ break;
case CAIRO_HINT_STYLE_SLIGHT:
case CAIRO_HINT_STYLE_MEDIUM:
case CAIRO_HINT_STYLE_FULL:
grid_fit_mode = DWRITE_GRID_FIT_MODE_ENABLED;
+ break;
}
cairo_subpixel_order_t subpixel_order;
commit d9a11c3736acc693c67c62ee98fdc19003bee946
Author: Luca Bacci <luca.bacci982 at gmail.com>
Date: Mon Jun 16 17:38:26 2025 +0200
Win32: Use cairo_atomic_once_t to initialize TLS slot
We were using the double-checked locking pattern, which requires
memory fences to be safe on architectures with weak memory
guarantess (e.g ARM64)
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/897
diff --git a/src/cairo-mutex-list-private.h b/src/cairo-mutex-list-private.h
index af5cc0517..48f74f2c3 100644
--- a/src/cairo-mutex-list-private.h
+++ b/src/cairo-mutex-list-private.h
@@ -53,7 +53,6 @@ CAIRO_MUTEX_DECLARE (_cairo_ft_unscaled_font_map_mutex)
#if CAIRO_HAS_WIN32_FONT
CAIRO_MUTEX_DECLARE (_cairo_win32_font_face_mutex)
-CAIRO_MUTEX_DECLARE (_cairo_win32_font_dc_mutex)
#endif
#if CAIRO_HAS_XLIB_SURFACE
diff --git a/src/win32/cairo-win32-font.c b/src/win32/cairo-win32-font.c
index 1412c8bbc..64c97e1b7 100644
--- a/src/win32/cairo-win32-font.c
+++ b/src/win32/cairo-win32-font.c
@@ -143,16 +143,14 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
static HDC
_get_global_font_dc (void)
{
+ static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
static DWORD hdc_tls_index;
HDC hdc;
- if (!hdc_tls_index) {
- CAIRO_MUTEX_LOCK (_cairo_win32_font_dc_mutex);
- if (!hdc_tls_index) {
- hdc_tls_index = TlsAlloc ();
- assert (hdc_tls_index != TLS_OUT_OF_INDEXES);
- }
- CAIRO_MUTEX_UNLOCK (_cairo_win32_font_dc_mutex);
+ if (!_cairo_atomic_init_once_enter (&once)) {
+ hdc_tls_index = TlsAlloc ();
+ assert (hdc_tls_index != TLS_OUT_OF_INDEXES);
+ _cairo_atomic_init_once_leave (&once);
}
hdc = TlsGetValue (hdc_tls_index);
More information about the cairo-commit
mailing list