From 0a80f904b19ca1e88fc57c261388d24a682ac294 Mon Sep 17 00:00:00 2001 From: SolarLune Date: Thu, 3 Oct 2019 23:44:10 -0700 Subject: [PATCH] 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. --- raylib/raylib.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raylib/raylib.go b/raylib/raylib.go index 446a9b7..9c1168c 100644 --- a/raylib/raylib.go +++ b/raylib/raylib.go @@ -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)) } }