[TextServer] Pass Dictionary properties by value and check property values instead of references..

This commit is contained in:
bruvzg 2023-09-07 11:59:51 +03:00
parent 8449592d92
commit 1ced1f9c99
No known key found for this signature in database
GPG Key ID: 7960FCF39844EC38
3 changed files with 18 additions and 10 deletions

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {