update dc6 decoder to use binary writer
This commit is contained in:
parent
9dfc82804a
commit
e016bd7ec1
@ -1,9 +1,11 @@
|
|||||||
package dc6
|
package dc6
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/FooSoft/lazarus/streaming"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -72,9 +74,9 @@ func New(reader io.ReadSeeker) (*Dc6, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
buff := bytes.NewBuffer(make([]byte, frameHeader.Width*frameHeader.Height))
|
data := make([]byte, frameHeader.Width*frameHeader.Height)
|
||||||
// if err := extractFrame(reader, buff, frameHeader); err != nil {
|
writer := streaming.NewWriter(data)
|
||||||
if err := extractFrame(reader, nil, frameHeader); err != nil {
|
if err := extractFrame(reader, writer, frameHeader); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +85,7 @@ func New(reader io.ReadSeeker) (*Dc6, error) {
|
|||||||
int(frameHeader.Height),
|
int(frameHeader.Height),
|
||||||
int(frameHeader.OffsetX),
|
int(frameHeader.OffsetX),
|
||||||
int(frameHeader.OffsetY),
|
int(frameHeader.OffsetY),
|
||||||
buff.Bytes(),
|
data,
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite.Frames = append(sprite.Frames, frame)
|
sprite.Frames = append(sprite.Frames, frame)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package io
|
package streaming
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
Loading…
Reference in New Issue
Block a user