summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-09-07 11:59:51 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-09-07 11:59:51 +0300
commit1ced1f9c9981c923a4c6bf8d461028f8ffa622f6 (patch)
tree2d463fd98799d004e85f5832c3deee0c302143a2
parent8449592d92eaeef990f5502b419d491ee3eeb7a6 (diff)
downloadredot-engine-1ced1f9c9981c923a4c6bf8d461028f8ffa622f6.tar.gz
[TextServer] Pass Dictionary properties by value and check property values instead of references..
-rw-r--r--modules/text_server_adv/text_server_adv.cpp6
-rw-r--r--modules/text_server_fb/text_server_fb.cpp6
-rw-r--r--scene/resources/font.cpp16
3 files changed, 18 insertions, 10 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 85e98eac76..f2c1d4e007 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -2383,8 +2383,10 @@ void TextServerAdvanced::_font_set_variation_coordinates(const RID &p_font_rid,
ERR_FAIL_COND(!fd);
MutexLock lock(fd->mutex);
- _font_clear_cache(fd);
- fd->variation_coordinates = p_variation_coordinates;
+ if (!fd->variation_coordinates.recursive_equal(p_variation_coordinates, 1)) {
+ _font_clear_cache(fd);
+ fd->variation_coordinates = p_variation_coordinates.duplicate();
+ }
}
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 5d4de7a0d6..26d16a1ec9 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -1376,8 +1376,10 @@ void TextServerFallback::_font_set_variation_coordinates(const RID &p_font_rid,
ERR_FAIL_COND(!fd);
MutexLock lock(fd->mutex);
- _font_clear_cache(fd);
- fd->variation_coordinates = p_variation_coordinates;
+ if (!fd->variation_coordinates.recursive_equal(p_variation_coordinates, 1)) {
+ _font_clear_cache(fd);
+ fd->variation_coordinates = p_variation_coordinates.duplicate();
+ }
}
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 9d546c90c7..b9256107b7 100644
--- a/scene/resources/font.cpp
+++ b/scene/resources/font.cpp
@@ -2833,12 +2833,14 @@ Ref<Font> FontVariation::_get_base_font_or_default() const {
}
void FontVariation::set_variation_opentype(const Dictionary &p_coords) {
- variation.opentype = p_coords;
- _invalidate_rids();
+ if (!variation.opentype.recursive_equal(p_coords, 1)) {
+ variation.opentype = p_coords.duplicate();
+ _invalidate_rids();
+ }
}
Dictionary FontVariation::get_variation_opentype() const {
- return variation.opentype;
+ return variation.opentype.duplicate();
}
void FontVariation::set_variation_embolden(float p_strength) {
@@ -2875,12 +2877,14 @@ int FontVariation::get_variation_face_index() const {
}
void FontVariation::set_opentype_features(const Dictionary &p_features) {
- opentype_features = p_features;
- _invalidate_rids();
+ if (!opentype_features.recursive_equal(p_features, 1)) {
+ opentype_features = p_features.duplicate();
+ _invalidate_rids();
+ }
}
Dictionary FontVariation::get_opentype_features() const {
- return opentype_features;
+ return opentype_features.duplicate();
}
void FontVariation::set_spacing(TextServer::SpacingType p_spacing, int p_value) {