More conversions to fix compilation errors

This commit is contained in:
Yuriy Glukhov 2017-11-03 13:20:53 +02:00
parent 22b4278e75
commit f0b4016779
1 changed files with 10 additions and 10 deletions

View File

@ -1493,7 +1493,7 @@ proc RGBA8FromRGBA16(p: var RGBA8, input: DataBuf, px: int, mode: PNGColorMode)
proc RGBA16FromGrey(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) = proc RGBA16FromGrey(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) =
let i = px * 2 let i = px * 2
let val = 256'u16 * ord(input[i]) + ord(input[i + 1]) let val = 256'u16 * uint16(input[i]) + uint16(input[i + 1])
p.r = val p.r = val
p.g = val p.g = val
p.b = val p.b = val
@ -1502,27 +1502,27 @@ proc RGBA16FromGrey(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode)
proc RGBA16FromRGB(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) = proc RGBA16FromRGB(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) =
let i = px * 6 let i = px * 6
p.r = 256'u16 * ord(input[i]) + ord(input[i+1]) p.r = 256'u16 * uint16(input[i]) + uint16(input[i+1])
p.g = 256'u16 * ord(input[i+2]) + ord(input[i+3]) p.g = 256'u16 * uint16(input[i+2]) + uint16(input[i+3])
p.b = 256'u16 * ord(input[i+4]) + ord(input[i+5]) p.b = 256'u16 * uint16(input[i+4]) + uint16(input[i+5])
if mode.keyDefined and (int(p.r) == mode.keyR) and if mode.keyDefined and (int(p.r) == mode.keyR) and
(int(p.g) == mode.keyG) and (int(p.b) == mode.keyB): p.a = 0 (int(p.g) == mode.keyG) and (int(p.b) == mode.keyB): p.a = 0
else: p.a = 65535 else: p.a = 65535
proc RGBA16FromGreyAlpha(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) = proc RGBA16FromGreyAlpha(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) =
let i = px * 4 let i = px * 4
let val = 256'u16 * ord(input[i]) + ord(input[i + 1]) let val = 256'u16 * uint16(input[i]) + uint16(input[i + 1])
p.r = val p.r = val
p.g = val p.g = val
p.b = val p.b = val
p.a = 256'u16 * ord(input[i + 2]) + ord(input[i + 3]) p.a = 256'u16 * uint16(input[i + 2]) + uint16(input[i + 3])
proc RGBA16FromRGBA(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) = proc RGBA16FromRGBA(p: var RGBA16, input: DataBuf, px: int, mode: PNGColorMode) =
let i = px * 8 let i = px * 8
p.r = 256'u16 * ord(input[i]) + ord(input[i+1]) p.r = 256'u16 * uint16(input[i]) + uint16(input[i+1])
p.g = 256'u16 * ord(input[i+2]) + ord(input[i+3]) p.g = 256'u16 * uint16(input[i+2]) + uint16(input[i+3])
p.b = 256'u16 * ord(input[i+4]) + ord(input[i+5]) p.b = 256'u16 * uint16(input[i+4]) + uint16(input[i+5])
p.a = 256'u16 * ord(input[i+6]) + ord(input[i+7]) p.a = 256'u16 * uint16(input[i+6]) + uint16(input[i+7])
proc RGBA8ToGrey8(p: RGBA8, output: var DataBuf, px: int, mode: PNGColorMode, ct: ColorTree8) = proc RGBA8ToGrey8(p: RGBA8, output: var DataBuf, px: int, mode: PNGColorMode, ct: ColorTree8) =
output[px] = p.r output[px] = p.r