go-gl/glfw

`(*glfw.Window).SetIcon` doesn't consider strides

hajimehoshi opened this issue · 0 comments

I tested this with github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210410170116-ea3d685f79fb.

	pix := make([]byte, 4*32*16)
	for j := 0; j < 16; j++ {
		for i := 0; i < 16; i++ {
			pix[4*(i+32*j)] = 0xff
			pix[4*(i+32*j)+1] = 0
			pix[4*(i+32*j)+2] = 0
			pix[4*(i+32*j)+3] = 0xff
		}
		for i := 16; i < 32; i++ {
			pix[4*(i+32*j)] = 0
			pix[4*(i+32*j)+1] = 0xff
			pix[4*(i+32*j)+2] = 0
			pix[4*(i+32*j)+3] = 0xff
		}
	}
	icon := &image.NRGBA{
		Pix:    pix,
		Stride: 4*32,
		Rect:   image.Rect(0, 0, 16, 16),
	}
	window.SetIcon([]image.Image{icon})

The icon should be a red square, but the actual icon was a square with red and green stripes.

I believe glfw.CreateCursor has the same issue.