From 31a8a9b2e15e7173be7225a60e0ceac4ec22623b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 7 Jul 2023 20:14:28 +0300 Subject: [PATCH] [TextServer] Remove excessive Dictionary checks. --- modules/text_server_adv/text_server_adv.cpp | 6 ++---- modules/text_server_fb/text_server_fb.cpp | 6 ++---- scene/resources/font.cpp | 12 ++++-------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index cbe48db494f..85e98eac76a 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -2383,10 +2383,8 @@ void TextServerAdvanced::_font_set_variation_coordinates(const RID &p_font_rid, ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); - if (fd->variation_coordinates != p_variation_coordinates) { - _font_clear_cache(fd); - fd->variation_coordinates = p_variation_coordinates; - } + _font_clear_cache(fd); + fd->variation_coordinates = p_variation_coordinates; } Dictionary TextServerAdvanced::_font_get_variation_coordinates(const RID &p_font_rid) const { diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index d0587bf6c06..5d4de7a0d6d 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -1376,10 +1376,8 @@ void TextServerFallback::_font_set_variation_coordinates(const RID &p_font_rid, ERR_FAIL_COND(!fd); MutexLock lock(fd->mutex); - if (fd->variation_coordinates != p_variation_coordinates) { - _font_clear_cache(fd); - fd->variation_coordinates = p_variation_coordinates; - } + _font_clear_cache(fd); + fd->variation_coordinates = p_variation_coordinates; } Dictionary TextServerFallback::_font_get_variation_coordinates(const RID &p_font_rid) const { diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index f5edc8d5e98..9d546c90c7c 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -2833,10 +2833,8 @@ Ref FontVariation::_get_base_font_or_default() const { } void FontVariation::set_variation_opentype(const Dictionary &p_coords) { - if (variation.opentype != p_coords) { - variation.opentype = p_coords; - _invalidate_rids(); - } + variation.opentype = p_coords; + _invalidate_rids(); } Dictionary FontVariation::get_variation_opentype() const { @@ -2877,10 +2875,8 @@ int FontVariation::get_variation_face_index() const { } void FontVariation::set_opentype_features(const Dictionary &p_features) { - if (opentype_features != p_features) { - opentype_features = p_features; - _invalidate_rids(); - } + opentype_features = p_features; + _invalidate_rids(); } Dictionary FontVariation::get_opentype_features() const {