summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorkleonc <9283098+kleonc@users.noreply.github.com>2021-09-25 12:18:18 +0200
committerkleonc <9283098+kleonc@users.noreply.github.com>2021-10-03 14:30:51 +0200
commitb266b59e56ff17cd5dd62587e4ad781ba9602fa4 (patch)
treec1b8761e54cd173aedddc71d53b315d28644d329 /scene/2d
parenta88e82078dfa1e06acad59eb34bf2bbb64ed5978 (diff)
Fix rendering centered odd-size texture in AnimatedSprite2D/AnimatedSprite3D
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite_2d.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp
index 96a3134691..fad4784d51 100644
--- a/scene/2d/animated_sprite_2d.cpp
+++ b/scene/2d/animated_sprite_2d.cpp
@@ -94,7 +94,7 @@ Rect2 AnimatedSprite2D::_get_rect() const {
Point2 ofs = offset;
if (centered) {
- ofs -= Size2(s) / 2;
+ ofs -= s / 2;
}
if (s == Size2(0, 0)) {
@@ -228,8 +228,7 @@ void AnimatedSprite2D::_notification(int p_what) {
RID ci = get_canvas_item();
- Size2i s;
- s = texture->get_size();
+ Size2 s = texture->get_size();
Point2 ofs = offset;
if (centered) {
ofs -= s / 2;