type cleanup
This commit is contained in:
parent
56ab677790
commit
301512515b
@ -28,26 +28,26 @@ type fileHeader struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type directionHeader struct {
|
type directionHeader struct {
|
||||||
CodedSize uint
|
CodedSize uint32
|
||||||
HasRawPixelEncoding bool
|
HasRawPixelEncoding bool
|
||||||
CompressEqualCells bool
|
CompressEqualCells bool
|
||||||
Variable0Bits uint
|
Variable0Bits uint8
|
||||||
WidthBits uint
|
WidthBits uint8
|
||||||
HeightBits uint
|
HeightBits uint8
|
||||||
OffsetXBits uint
|
OffsetXBits uint8
|
||||||
OffsetYBits uint
|
OffsetYBits uint8
|
||||||
OptionalBytesBits uint
|
OptionalBytesBits uint8
|
||||||
CodedBytesBits uint
|
CodedBytesBits uint8
|
||||||
}
|
}
|
||||||
|
|
||||||
type frameHeader struct {
|
type frameHeader struct {
|
||||||
Variable0 uint
|
Variable0 uint32
|
||||||
Width uint
|
Width uint32
|
||||||
Height uint
|
Height uint32
|
||||||
OffsetX int
|
OffsetX int32
|
||||||
OffsetY int
|
OffsetY int32
|
||||||
OptionalBytes uint
|
OptionalBytes uint32
|
||||||
CodedBytes uint
|
CodedBytes uint32
|
||||||
FrameBottomUp bool
|
FrameBottomUp bool
|
||||||
Extents extents
|
Extents extents
|
||||||
}
|
}
|
||||||
@ -88,16 +88,16 @@ func NewFromReader(reader io.ReadSeeker) (*Sprite, error) {
|
|||||||
func readDirectionHeader(bitReader *streaming.BitReader) *directionHeader {
|
func readDirectionHeader(bitReader *streaming.BitReader) *directionHeader {
|
||||||
var dirHead directionHeader
|
var dirHead directionHeader
|
||||||
|
|
||||||
dirHead.CodedSize = uint(bitReader.ReadUint(32))
|
dirHead.CodedSize = uint32(bitReader.ReadUint(32))
|
||||||
dirHead.HasRawPixelEncoding = bitReader.ReadBool()
|
dirHead.HasRawPixelEncoding = bitReader.ReadBool()
|
||||||
dirHead.CompressEqualCells = bitReader.ReadBool()
|
dirHead.CompressEqualCells = bitReader.ReadBool()
|
||||||
dirHead.Variable0Bits = uint(bitReader.ReadUint(4))
|
dirHead.Variable0Bits = uint8(bitReader.ReadUint(4))
|
||||||
dirHead.WidthBits = uint(bitReader.ReadUint(4))
|
dirHead.WidthBits = uint8(bitReader.ReadUint(4))
|
||||||
dirHead.HeightBits = uint(bitReader.ReadUint(4))
|
dirHead.HeightBits = uint8(bitReader.ReadUint(4))
|
||||||
dirHead.OffsetXBits = uint(bitReader.ReadInt(4))
|
dirHead.OffsetXBits = uint8(bitReader.ReadInt(4))
|
||||||
dirHead.OffsetYBits = uint(bitReader.ReadInt(4))
|
dirHead.OffsetYBits = uint8(bitReader.ReadInt(4))
|
||||||
dirHead.OptionalBytesBits = uint(bitReader.ReadUint(4))
|
dirHead.OptionalBytesBits = uint8(bitReader.ReadUint(4))
|
||||||
dirHead.CodedBytesBits = uint(bitReader.ReadUint(4))
|
dirHead.CodedBytesBits = uint8(bitReader.ReadUint(4))
|
||||||
|
|
||||||
return &dirHead
|
return &dirHead
|
||||||
}
|
}
|
||||||
@ -105,13 +105,13 @@ func readDirectionHeader(bitReader *streaming.BitReader) *directionHeader {
|
|||||||
func readFrameHeader(bitReader *streaming.BitReader, dirHead directionHeader) *frameHeader {
|
func readFrameHeader(bitReader *streaming.BitReader, dirHead directionHeader) *frameHeader {
|
||||||
var frameHead frameHeader
|
var frameHead frameHeader
|
||||||
|
|
||||||
frameHead.Variable0 = uint(bitReader.ReadUintPacked(int(dirHead.Variable0Bits)))
|
frameHead.Variable0 = uint32(bitReader.ReadUintPacked(int(dirHead.Variable0Bits)))
|
||||||
frameHead.Width = uint(bitReader.ReadUintPacked(int(dirHead.WidthBits)))
|
frameHead.Width = uint32(bitReader.ReadUintPacked(int(dirHead.WidthBits)))
|
||||||
frameHead.Height = uint(bitReader.ReadUintPacked(int(dirHead.HeightBits)))
|
frameHead.Height = uint32(bitReader.ReadUintPacked(int(dirHead.HeightBits)))
|
||||||
frameHead.OffsetX = int(bitReader.ReadIntPacked(int(dirHead.OffsetXBits)))
|
frameHead.OffsetX = int32(bitReader.ReadIntPacked(int(dirHead.OffsetXBits)))
|
||||||
frameHead.OffsetY = int(bitReader.ReadIntPacked(int(dirHead.OffsetYBits)))
|
frameHead.OffsetY = int32(bitReader.ReadIntPacked(int(dirHead.OffsetYBits)))
|
||||||
frameHead.OptionalBytes = uint(bitReader.ReadUintPacked(int(dirHead.OptionalBytesBits)))
|
frameHead.OptionalBytes = uint32(bitReader.ReadUintPacked(int(dirHead.OptionalBytesBits)))
|
||||||
frameHead.CodedBytes = uint(bitReader.ReadUintPacked(int(dirHead.CodedBytesBits)))
|
frameHead.CodedBytes = uint32(bitReader.ReadUintPacked(int(dirHead.CodedBytesBits)))
|
||||||
frameHead.FrameBottomUp = bitReader.ReadBool()
|
frameHead.FrameBottomUp = bitReader.ReadBool()
|
||||||
|
|
||||||
return &frameHead
|
return &frameHead
|
||||||
|
Loading…
Reference in New Issue
Block a user