infra
/
goutils
Archived
1
0
Fork 0
This repository has been archived on 2022-04-06. You can view files and clone it, but cannot push or open issues or pull requests.
goutils/image/png_encoder_buf_pool.go

23 lines
332 B
Go

package image
import (
"sync"
"image/png"
)
type PNGEncoderBufPool struct {
pool sync.Pool
}
func (p *PNGEncoderBufPool) Get() *png.EncoderBuffer {
v := p.pool.Get()
if v == nil {
return &png.EncoderBuffer{}
}
return v.(*png.EncoderBuffer)
}
func (p *PNGEncoderBufPool) Put(buf *png.EncoderBuffer) {
p.pool.Put(buf)
}