fix testCodec

This commit is contained in:
andri lim 2019-06-06 12:01:11 +07:00
parent b69b705a34
commit 63bbcb7643
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 4 additions and 5 deletions

View File

@ -254,10 +254,10 @@ proc makeChunkType*(val: string): PNGChunkType =
proc `$`*(tag: PNGChunkType): string = proc `$`*(tag: PNGChunkType): string =
result = newString(4) result = newString(4)
let t = int(tag) let t = int(tag)
result[0] = chr(toU32(t shr 24) and 0xFF) result[0] = chr(uint32(t shr 24) and 0xFF)
result[1] = chr(toU32(t shr 16) and 0xFF) result[1] = chr(uint32(t shr 16) and 0xFF)
result[2] = chr(toU32(t shr 8) and 0xFF) result[2] = chr(uint32(t shr 8) and 0xFF)
result[3] = chr(toU32(t) and 0xFF) result[3] = chr(uint32(t) and 0xFF)
proc `==`(a, b: PNGChunkType): bool = int(a) == int(b) proc `==`(a, b: PNGChunkType): bool = int(a) == int(b)
#proc isAncillary(a: PNGChunkType): bool = (int(a) and (32 shl 24)) != 0 #proc isAncillary(a: PNGChunkType): bool = (int(a) and (32 shl 24)) != 0

View File

@ -24,7 +24,6 @@ proc getNumColorChannels(colorType: PNGcolorType): int =
of LCT_PALETTE: result = 1 of LCT_PALETTE: result = 1
of LCT_GREY_ALPHA: result = 2 of LCT_GREY_ALPHA: result = 2
of LCT_RGBA: result = 4 of LCT_RGBA: result = 4
else: result = 0
proc generateTestImage(width, height: int, colorType = LCT_RGBA, bitDepth = 8): Image = proc generateTestImage(width, height: int, colorType = LCT_RGBA, bitDepth = 8): Image =
new(result) new(result)