move these out of header decoding
This commit is contained in:
parent
1445558050
commit
35a8f6ec4e
|
@ -76,14 +76,6 @@ proc decodeHeader(data: pointer): PngHeader =
|
|||
if result.interlaceMethod notin [0.uint8, 1]:
|
||||
raise newException(PixieError, "Invalid PNG interlace method")
|
||||
|
||||
# Not yet supported:
|
||||
|
||||
if result.bitDepth == 16:
|
||||
raise newException(PixieError, "PNG 16 bit depth not supported yet")
|
||||
|
||||
if result.interlaceMethod != 0:
|
||||
raise newException(PixieError, "Interlaced PNG not supported yet")
|
||||
|
||||
proc decodePalette(data: pointer, len: int): seq[ColorRGB] =
|
||||
if len == 0 or len mod 3 != 0:
|
||||
failInvalid()
|
||||
|
@ -451,6 +443,12 @@ proc decodePng*(data: pointer, len: int): Png {.raises: [PixieError].} =
|
|||
failCRC()
|
||||
inc(pos, 4) # CRC
|
||||
|
||||
# Not yet supported:
|
||||
if header.bitDepth == 16:
|
||||
raise newException(PixieError, "PNG 16 bit depth not supported yet")
|
||||
if header.interlaceMethod != 0:
|
||||
raise newException(PixieError, "Interlaced PNG not supported yet")
|
||||
|
||||
while true:
|
||||
if pos + 8 > len:
|
||||
failInvalid()
|
||||
|
|
Loading…
Reference in a new issue