Skip to content

Commit bee0e99

Browse files
committed
Merge pull request godotengine#109139 from bruvzg/svg_sz_ov
[SVGTexture] Always use real values for `texture_set_size_override`.
2 parents ef917c2 + 6705d97 commit bee0e99

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scene/resources/svg_texture.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ RID SVGTexture::_load_at_scale(double p_scale, bool p_set_size) const {
203203
img->adjust_bcs(1.0, 1.0, saturation);
204204
}
205205

206+
Size2 current_size = size;
206207
if (p_set_size) {
207208
size.x = img->get_width();
208209
base_size.x = img->get_width();
@@ -214,10 +215,15 @@ RID SVGTexture::_load_at_scale(double p_scale, bool p_set_size) const {
214215
if (size_override.y != 0) {
215216
size.y = size_override.y;
216217
}
218+
current_size = size;
219+
}
220+
if (current_size.is_zero_approx()) {
221+
current_size.x = img->get_width();
222+
current_size.y = img->get_height();
217223
}
218224

219225
RID rid = RenderingServer::get_singleton()->texture_2d_create(img);
220-
RenderingServer::get_singleton()->texture_set_size_override(rid, size.x, size.y);
226+
RenderingServer::get_singleton()->texture_set_size_override(rid, current_size.x, current_size.y);
221227
return rid;
222228
}
223229

0 commit comments

Comments
 (0)