Przeglądaj źródła

Improve SVGTexture lazy loading.

Pāvels Nadtočajevs 2 miesięcy temu
rodzic
commit
9f5c57c8c5
1 zmienionych plików z 6 dodań i 3 usunięć
  1. 6 3
      scene/resources/svg_texture.cpp

+ 6 - 3
scene/resources/svg_texture.cpp

@@ -237,8 +237,6 @@ void SVGTexture::_clear() {
 
 
 void SVGTexture::_update_texture() {
 void SVGTexture::_update_texture() {
 	_clear();
 	_clear();
-	_ensure_scale(1.0);
-
 	emit_changed();
 	emit_changed();
 }
 }
 
 
@@ -252,10 +250,12 @@ Ref<Image> SVGTexture::get_image() const {
 }
 }
 
 
 int SVGTexture::get_width() const {
 int SVGTexture::get_width() const {
+	_ensure_scale(1.0);
 	return size.x;
 	return size.x;
 }
 }
 
 
 int SVGTexture::get_height() const {
 int SVGTexture::get_height() const {
+	_ensure_scale(1.0);
 	return size.y;
 	return size.y;
 }
 }
 
 
@@ -342,7 +342,10 @@ void SVGTexture::set_size_override(const Size2i &p_size) {
 		return;
 		return;
 	}
 	}
 	size_override = p_size;
 	size_override = p_size;
-	size = base_size;
+	if (size_override.x == 0 || size_override.y == 0) {
+		_ensure_scale(1.0);
+		size = base_size;
+	}
 	if (size_override.x != 0) {
 	if (size_override.x != 0) {
 		size.x = size_override.x;
 		size.x = size_override.x;
 	}
 	}