Fix: NewImageFromImage height incorrect.

Previously, the function broke on non-rectangular images.
y needs to be multiplied by the horizontal width, not the image's reported height.
This commit is contained in:
SolarLune 2019-10-03 23:44:10 -07:00
parent 4b4860959e
commit 0a80f904b1

View file

@ -1113,7 +1113,7 @@ func NewImageFromImage(img image.Image) *Image {
for x := 0; x < size.X; x++ {
color := img.At(x, y)
r, g, b, a := color.RGBA()
pixels[x+y*size.Y] = NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
pixels[x+y*size.X] = NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
}
}