فهرست منبع

Merge pull request #17262 from poke1024/fix-sprite-get-rects

Fix uninitialized data in Sprite::_get_rects()
Rémi Verschelde 7 سال پیش
والد
کامیت
6a6aab498e
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      scene/2d/sprite.cpp

+ 2 - 2
scene/2d/sprite.cpp

@@ -73,8 +73,8 @@ void Sprite::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_cli
 		s = s / Size2(hframes, vframes);
 
 		r_src_rect.size = s;
-		r_src_rect.position.x += float(frame % hframes) * s.x;
-		r_src_rect.position.y += float(frame / hframes) * s.y;
+		r_src_rect.position.x = float(frame % hframes) * s.x;
+		r_src_rect.position.y = float(frame / hframes) * s.y;
 	}
 
 	Point2 ofs = offset;