I have no idea why this commit fixes #15392

This commit is contained in:
Juan Linietsky 2018-01-21 16:18:52 -03:00
parent 28744b704d
commit 8daf5491ab
2 changed files with 12 additions and 15 deletions

View File

@ -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();
}

View File

@ -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;
}
};