diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-01-21 16:18:52 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2018-01-21 16:19:35 -0300 |
commit | 8daf5491ab6bc60434e4d952830bdd258eaf0e53 (patch) | |
tree | 3e1acd4703effe8789229c97aa19116028edd28b | |
parent | 28744b704d384b1aff0f9a695fbf652406e84587 (diff) |
I have no idea why this commit fixes #15392
-rw-r--r-- | scene/resources/dynamic_font.cpp | 11 | ||||
-rw-r--r-- | scene/resources/dynamic_font.h | 16 |
2 files changed, 12 insertions, 15 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index b35a9ae963..e9d5ca969e 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -35,13 +35,7 @@ bool DynamicFontData::CacheID::operator<(CacheID right) const { - if (size < right.size) - return true; - if (mipmaps != right.mipmaps) - return right.mipmaps; - if (filter != right.filter) - return right.filter; - return false; + return key < right.key; } Ref<DynamicFontAtSize> DynamicFontData::_get_dynamic_font_at_size(CacheID p_cache_id) { @@ -654,6 +648,7 @@ DynamicFontAtSize::~DynamicFontAtSize() { FT_Done_FreeType(library); } font->size_cache.erase(id); + font.unref(); } ///////////////////////// @@ -983,7 +978,7 @@ void DynamicFont::update_oversampling() { while (E) { if (E->self()->data_at_size.is_valid() && E->self()->data_at_size->update_oversampling()) { - changed.push_back(E->self()); + changed.push_back(Ref<DynamicFont>(E->self())); } E = E->next(); } diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index a949892086..92bb77bed3 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -50,15 +50,17 @@ class DynamicFontData : public Resource { public: struct CacheID { - int size; - bool mipmaps; - bool filter; - + union { + struct { + uint32_t size : 16; + bool mipmaps : 1; + bool filter : 1; + }; + uint32_t key; + }; bool operator<(CacheID right) const; CacheID() { - size = 16; - mipmaps = false; - filter = false; + key = 0; } }; |