diff options
author | Bernhard Liebl <Bernhard.Liebl@gmx.org> | 2018-01-08 18:09:41 +0100 |
---|---|---|
committer | Bernhard Liebl <Bernhard.Liebl@gmx.org> | 2018-01-08 18:09:41 +0100 |
commit | a64dc5af7409174a9e1ad9d053aa8cafb2da1abb (patch) | |
tree | 185cff24cd4702d8b33457b7a17c6478e8ac6ed0 | |
parent | 37ca542d2bfd9aac296e82e30a76117090dea08e (diff) |
Two potential glitches in font oversampling
-rw-r--r-- | scene/resources/dynamic_font.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 575c222cc1..b35a9ae963 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -631,6 +631,7 @@ bool DynamicFontAtSize::update_oversampling() { textures.clear(); char_map.clear(); oversampling = font_oversampling; + valid = false; _load(); return true; @@ -973,14 +974,26 @@ void DynamicFont::finish_dynamic_fonts() { void DynamicFont::update_oversampling() { + Vector<Ref<DynamicFont> > changed; + + if (dynamic_font_mutex) + dynamic_font_mutex->lock(); + SelfList<DynamicFont> *E = dynamic_fonts.first(); while (E) { if (E->self()->data_at_size.is_valid() && E->self()->data_at_size->update_oversampling()) { - E->self()->emit_changed(); + changed.push_back(E->self()); } E = E->next(); } + + if (dynamic_font_mutex) + dynamic_font_mutex->unlock(); + + for (int i = 0; i < changed.size(); i++) { + changed[i]->emit_changed(); + } } ///////////////////////// |