Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit f54c481

Browse files
committed
Merge pull request #6 from vtolstov/fix
fix build
2 parents 4267aa6 + d02a1e9 commit f54c481

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

encoding.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ func (*RawEncoding) Read(c *ClientConn, rect *Rectangle, r io.Reader) (Encoding,
3737
byteOrder = binary.BigEndian
3838
}
3939

40-
color := &colors[int(y)*int(rect.Width)+int(x)]
40+
colors := make([]Color, int(rect.Height)*int(rect.Width))
41+
4142
for y := uint16(0); y < rect.Height; y++ {
4243
for x := uint16(0); x < rect.Width; x++ {
4344
if _, err := io.ReadFull(r, pixelBytes); err != nil {
@@ -53,7 +54,7 @@ func (*RawEncoding) Read(c *ClientConn, rect *Rectangle, r io.Reader) (Encoding,
5354
rawPixel = byteOrder.Uint32(pixelBytes)
5455
}
5556

56-
color := &colors[x+y]
57+
color := &colors[int(y)*int(rect.Width)+int(x)]
5758
if c.PixelFormat.TrueColor {
5859
color.R = uint16((rawPixel >> c.PixelFormat.RedShift) & uint32(c.PixelFormat.RedMax))
5960
color.G = uint16((rawPixel >> c.PixelFormat.GreenShift) & uint32(c.PixelFormat.GreenMax))

0 commit comments

Comments
 (0)