remove logging, use a more efficient/smart pad byte array

This commit is contained in:
41666 2017-08-06 18:42:16 -05:00
parent 306f8d006f
commit e1b5deae98
2 changed files with 3 additions and 6 deletions

9
esi.go
View file

@ -42,7 +42,6 @@ import (
"image" "image"
"image/color" "image/color"
"io" "io"
"log"
) )
var ( var (
@ -66,12 +65,8 @@ func Decode(r io.Reader) (o image.Image, err error) {
return o, err return o, err
} }
log.Println(cfg)
bounds := image.Rect(0, 0, cfg.Width, cfg.Height) bounds := image.Rect(0, 0, cfg.Width, cfg.Height)
log.Println(bounds)
img := image.NewRGBA(bounds) img := image.NewRGBA(bounds)
buf.Next(8 + emptyBytes) buf.Next(8 + emptyBytes)
@ -183,7 +178,9 @@ func Encode(w io.Writer, img image.Image) error {
configByte |= 32 configByte |= 32
} }
_, err = w.Write([]byte{configByte, 0, 0, 0, 0, 0}) cfgpad := make([]byte, 2+emptyBytes) // 1 byte for config, 1 empty byte, and a number of empty bytes.
cfgpad[0] = configByte
_, err = w.Write(cfgpad)
if err != nil { if err != nil {
return err return err
} }

BIN
testpattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B