mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix cursor index out of range error.
This commit is contained in:
parent
bf6181764b
commit
5d00e0bdbd
@ -246,11 +246,11 @@ func GetCursorImage() *types.CursorImage {
|
|||||||
pixels := C.GoBytes(unsafe.Pointer(cur.pixels), C.int(width*height*8))
|
pixels := C.GoBytes(unsafe.Pointer(cur.pixels), C.int(width*height*8))
|
||||||
|
|
||||||
img := image.NewRGBA(image.Rect(0, 0, width, height))
|
img := image.NewRGBA(image.Rect(0, 0, width, height))
|
||||||
for row := 0; row < height; row++ {
|
for y := 0; y < height; y++ {
|
||||||
for col := 0; col < width; col++ {
|
for x := 0; x < width; x++ {
|
||||||
pos := ((row * height) + col) * 8
|
pos := ((y * width) + x) * 8
|
||||||
|
|
||||||
img.SetRGBA(col, row, color.RGBA{
|
img.SetRGBA(x, y, color.RGBA{
|
||||||
A: pixels[pos+3],
|
A: pixels[pos+3],
|
||||||
R: pixels[pos+2],
|
R: pixels[pos+2],
|
||||||
G: pixels[pos+1],
|
G: pixels[pos+1],
|
||||||
|
Loading…
Reference in New Issue
Block a user