remove logging, use a more efficient/smart pad byte array
This commit is contained in:
parent
306f8d006f
commit
e1b5deae98
2 changed files with 3 additions and 6 deletions
9
esi.go
9
esi.go
|
@ -42,7 +42,6 @@ import (
|
|||
"image"
|
||||
"image/color"
|
||||
"io"
|
||||
"log"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -66,12 +65,8 @@ func Decode(r io.Reader) (o image.Image, err error) {
|
|||
return o, err
|
||||
}
|
||||
|
||||
log.Println(cfg)
|
||||
|
||||
bounds := image.Rect(0, 0, cfg.Width, cfg.Height)
|
||||
|
||||
log.Println(bounds)
|
||||
|
||||
img := image.NewRGBA(bounds)
|
||||
|
||||
buf.Next(8 + emptyBytes)
|
||||
|
@ -183,7 +178,9 @@ func Encode(w io.Writer, img image.Image) error {
|
|||
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 {
|
||||
return err
|
||||
}
|
||||
|
|
BIN
testpattern.png
Normal file
BIN
testpattern.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
Loading…
Add table
Reference in a new issue