Fix out-of-bounds error when color picking outside the image (#291)

This commit is contained in:
Michael Alexsander 2020-08-06 06:13:45 -03:00 committed by GitHub
parent 65828b328a
commit f715b566b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -229,7 +229,7 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
# Different method for scale3x
if interpolation == 5:
var times : Vector2 = Vector2(ceil(width/(3.0*sprite.get_width())),ceil(height/(3.0*sprite.get_height())))
for j in range(max(times.x,times.y)):
for _j in range(max(times.x,times.y)):
sprite.copy_from(scale3X(sprite))
sprite.resize(width, height, 0)
else: