m[ft] No need to use atomic ops for cached_x_scale

We have added a mutex since, so no need for atomicity.
This commit is contained in:
Behdad Esfahbod 2021-02-22 12:50:41 -07:00
parent 2fbd34f89a
commit 12a283d513

View File

@ -84,7 +84,7 @@ struct hb_ft_font_t
bool symbol; /* Whether selected cmap is symbol cmap. */ bool symbol; /* Whether selected cmap is symbol cmap. */
bool unref; /* Whether to destroy ft_face when done. */ bool unref; /* Whether to destroy ft_face when done. */
mutable hb_atomic_int_t cached_x_scale; mutable int cached_x_scale;
mutable hb_advance_cache_t advance_cache; mutable hb_advance_cache_t advance_cache;
}; };
@ -101,7 +101,7 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING; ft_font->load_flags = FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING;
ft_font->cached_x_scale.set_relaxed (0); ft_font->cached_x_scale = 0;
ft_font->advance_cache.init (); ft_font->advance_cache.init ();
return ft_font; return ft_font;
@ -335,10 +335,10 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data,
int load_flags = ft_font->load_flags; int load_flags = ft_font->load_flags;
int mult = font->x_scale < 0 ? -1 : +1; int mult = font->x_scale < 0 ? -1 : +1;
if (font->x_scale != ft_font->cached_x_scale.get ()) if (font->x_scale != ft_font->cached_x_scale)
{ {
ft_font->advance_cache.clear (); ft_font->advance_cache.clear ();
ft_font->cached_x_scale.set (font->x_scale); ft_font->cached_x_scale = font->x_scale;
} }
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)