mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-01 16:30:15 +00:00
Merge branch 'matthiasc/for-main' into 'main'
gsk: Avoid some allocations See merge request GNOME/gtk!7047
This commit is contained in:
commit
e1406d2e95
@ -44,9 +44,9 @@ gsk_reload_font (PangoFont *font,
|
||||
cairo_hint_style_t hint_style,
|
||||
cairo_antialias_t antialias)
|
||||
{
|
||||
cairo_font_options_t *options;
|
||||
cairo_scaled_font_t *sf;
|
||||
static cairo_font_options_t *options = NULL;
|
||||
static PangoContext *context = NULL;
|
||||
cairo_scaled_font_t *sf;
|
||||
#if !PANGO_VERSION_CHECK (1, 52, 0)
|
||||
PangoFontDescription *desc;
|
||||
FcPattern *pattern;
|
||||
@ -80,7 +80,9 @@ gsk_reload_font (PangoFont *font,
|
||||
g_set_object (&last_font, font);
|
||||
g_clear_object (&last_result);
|
||||
|
||||
options = cairo_font_options_create ();
|
||||
if (G_UNLIKELY (options == NULL))
|
||||
options = cairo_font_options_create ();
|
||||
|
||||
sf = pango_cairo_font_get_scaled_font (PANGO_CAIRO_FONT (font));
|
||||
cairo_scaled_font_get_font_options (sf, options);
|
||||
|
||||
@ -100,7 +102,6 @@ gsk_reload_font (PangoFont *font,
|
||||
cairo_font_options_get_subpixel_order (options) == CAIRO_SUBPIXEL_ORDER_DEFAULT)
|
||||
{
|
||||
last_result = g_object_ref (font);
|
||||
cairo_font_options_destroy (options);
|
||||
return g_object_ref (font);
|
||||
}
|
||||
|
||||
@ -109,11 +110,10 @@ gsk_reload_font (PangoFont *font,
|
||||
cairo_font_options_set_antialias (options, antialias);
|
||||
cairo_font_options_set_subpixel_order (options, CAIRO_SUBPIXEL_ORDER_DEFAULT);
|
||||
|
||||
if (!context)
|
||||
if (G_UNLIKELY (context == NULL))
|
||||
context = pango_context_new ();
|
||||
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
cairo_font_options_destroy (options);
|
||||
|
||||
#if PANGO_VERSION_CHECK (1, 52, 0)
|
||||
last_result = pango_font_map_reload_font (pango_font_get_font_map (font), font, scale, context, NULL);
|
||||
@ -123,14 +123,9 @@ gsk_reload_font (PangoFont *font,
|
||||
if (FcPatternGetDouble (pattern, FC_DPI, 0, &dpi) == FcResultMatch)
|
||||
pango_cairo_context_set_resolution (context, dpi);
|
||||
|
||||
desc = pango_font_describe (font);
|
||||
desc = pango_font_describe_with_absolute_size (font);
|
||||
size = pango_font_description_get_size (desc);
|
||||
|
||||
if (pango_font_description_get_size_is_absolute (desc))
|
||||
pango_font_description_set_absolute_size (desc, size * scale);
|
||||
else
|
||||
pango_font_description_set_size (desc, (int) floor (size * scale + .5));
|
||||
|
||||
pango_font_description_set_absolute_size (desc, size * scale);
|
||||
last_result = pango_font_map_load_font (pango_font_get_font_map (font), context, desc);
|
||||
pango_font_description_free (desc);
|
||||
#endif
|
||||
@ -178,15 +173,16 @@ gsk_get_unhinted_glyph_string_extents (PangoGlyphString *glyphs,
|
||||
cairo_hint_style_t
|
||||
gsk_font_get_hint_style (PangoFont *font)
|
||||
{
|
||||
static cairo_font_options_t *options = NULL;
|
||||
cairo_scaled_font_t *sf;
|
||||
cairo_font_options_t *options;
|
||||
cairo_hint_style_t style;
|
||||
|
||||
if (G_UNLIKELY (options == NULL))
|
||||
options = cairo_font_options_create ();
|
||||
|
||||
sf = pango_cairo_font_get_scaled_font (PANGO_CAIRO_FONT (font));
|
||||
options = cairo_font_options_create ();
|
||||
cairo_scaled_font_get_font_options (sf, options);
|
||||
style = cairo_font_options_get_hint_style (options);
|
||||
cairo_font_options_destroy (options);
|
||||
|
||||
return style;
|
||||
}
|
||||
|
@ -75,6 +75,8 @@
|
||||
* On Wayland, the settings are obtained either via a settings portal,
|
||||
* or by reading desktop settings from DConf.
|
||||
*
|
||||
* On macOS, the settings are obtained from `NSUserDefaults`.
|
||||
*
|
||||
* In the absence of these sharing mechanisms, GTK reads default values for
|
||||
* settings from `settings.ini` files in `/etc/gtk-4.0`, `$XDG_CONFIG_DIRS/gtk-4.0`
|
||||
* and `$XDG_CONFIG_HOME/gtk-4.0`. These files must be valid key files (see
|
||||
|
@ -226,6 +226,7 @@ compare_xfails = {
|
||||
'conic-gradient-with-64-colorstops': ['clipped', 'colorflipped'],
|
||||
'blur-child-bounds-oversize-nogl': ['clipped'], # 6450
|
||||
'rounded-clip-with-huge-bounds-nogl': ['plain','flipped','rotated','repeated','masked','replayed','clipped','colorflipped'], # 6532
|
||||
'big-checkerboard': ['clipped'], # 6444
|
||||
},
|
||||
'vulkan': {
|
||||
'radial-gradient-with-64-colorstops': ['clipped', 'colorflipped'],
|
||||
@ -234,6 +235,7 @@ compare_xfails = {
|
||||
'repeat-repeats-nested-nogl': ['clipped'], # 6522
|
||||
'repeating-radial-gradient-edge-colors': ['colorflipped'],
|
||||
'rounded-clip-with-huge-bounds-nogl': ['plain','flipped','rotated','repeated','masked','replayed','clipped','colorflipped'], # 6532
|
||||
'big-checkerboard': ['clipped'], # 6444
|
||||
},
|
||||
'gl': {
|
||||
# 6525
|
||||
|
Loading…
Reference in New Issue
Block a user