Drop dead Hextile and standalone Zlib encoding paths

This commit is contained in:
Viktor Liu
2026-05-17 08:48:21 +02:00
parent db5b6cfbb7
commit 6d937af7a0
5 changed files with 71 additions and 545 deletions

View File

@@ -2,10 +2,36 @@ package server
import (
"bytes"
"image"
"image/jpeg"
"testing"
)
func makeUniformImage(w, h int, r, g, b byte) *image.RGBA {
img := image.NewRGBA(image.Rect(0, 0, w, h))
for i := 0; i < len(img.Pix); i += 4 {
img.Pix[i+0] = r
img.Pix[i+1] = g
img.Pix[i+2] = b
img.Pix[i+3] = 0xff
}
return img
}
func makeTwoColorImage(w, h int) *image.RGBA {
img := makeUniformImage(w, h, 0x10, 0x20, 0x30)
fg := [3]byte{0xa0, 0xb0, 0xc0}
for y := 0; y < h; y++ {
for x := w / 4; x < w/2; x++ {
i := y*img.Stride + x*4
img.Pix[i+0] = fg[0]
img.Pix[i+1] = fg[1]
img.Pix[i+2] = fg[2]
}
}
return img
}
func decodeTightLength(buf []byte) (n, consumed int) {
b0 := buf[0]
n = int(b0 & 0x7f)