internal/png: go generate

This commit is contained in:
Hajime Hoshi 2024-09-24 00:01:15 +09:00
parent a499a976f7
commit f0d4147ed5

View File

@ -297,12 +297,6 @@ func filter(cr *[nFilter][]byte, pr []byte, bpp int) int {
return filter return filter
} }
func zeroMemory(v []uint8) {
for i := range v {
v[i] = 0
}
}
func (e *encoder) writeImage(w io.Writer, m image.Image, cb int, level int) error { func (e *encoder) writeImage(w io.Writer, m image.Image, cb int, level int) error {
if e.zw == nil || e.zwLevel != level { if e.zw == nil || e.zwLevel != level {
zw, err := zlib.NewWriterLevel(w, level) zw, err := zlib.NewWriterLevel(w, level)
@ -361,7 +355,7 @@ func (e *encoder) writeImage(w io.Writer, m image.Image, cb int, level int) erro
e.pr = make([]uint8, sz) e.pr = make([]uint8, sz)
} else { } else {
e.pr = e.pr[:sz] e.pr = e.pr[:sz]
zeroMemory(e.pr) clear(e.pr)
} }
pr := e.pr pr := e.pr