Skip to content

Commit

Permalink
Merge pull request #3 from travisgrigsby/travisg_20230330-expose_priv…
Browse files Browse the repository at this point in the history
…ate_options_fields

whoops
  • Loading branch information
tgrigsby-sc authored Mar 30, 2023
2 parents 7f99873 + a88289c commit bde705c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ func NewDecoder(r io.Reader, options *Options) (d *Decoder, err error) {
options = &Options{}
}

if options.imageFactory == nil {
options.imageFactory = &DefaultImageFactory{}
if options.ImageFactory == nil {
options.ImageFactory = &DefaultImageFactory{}
}

buf := bytes.NewBuffer(options.buffer)
buf := bytes.NewBuffer(options.Buffer)

if _, err = io.Copy(buf, r); err != nil {
return nil, err
Expand Down Expand Up @@ -92,7 +92,7 @@ func (d *Decoder) Decode() (image.Image, error) {
d.config.output.colorspace = C.MODE_RGBA
d.config.output.is_external_memory = 1

img := d.options.imageFactory.Get(int(d.config.output.width), int(d.config.output.height))
img := d.options.ImageFactory.Get(int(d.config.output.width), int(d.config.output.height))

buff := (*C.WebPRGBABuffer)(unsafe.Pointer(&d.config.output.u[0]))
buff.stride = C.int(img.Stride)
Expand Down
2 changes: 1 addition & 1 deletion decoder/decoder_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func BenchmarkDecodePooled(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
buf := bufferPool.Get()
decoder, err := NewDecoder(bytes.NewReader(data), &Options{imageFactory: imagePool, buffer: buf})
decoder, err := NewDecoder(bytes.NewReader(data), &Options{ImageFactory: imagePool, Buffer: buf})
img, err := decoder.Decode()
if err != nil {
b.Fatal(err)
Expand Down

0 comments on commit bde705c

Please sign in to comment.