PNG: Remove unnecessary flooring

This commit is contained in:
Lars Mueller 2021-10-30 17:39:44 +02:00
parent 8e42d027a0
commit f5526205cb

@ -371,7 +371,7 @@ end
end end
for index, value in pairs(png.data) do for index, value in pairs(png.data) do
if color == "grayscale" then if color == "grayscale" then
local a, Y = rescale_depth(floor(value / (2^depth)), depth, 8), rescale_depth(floor(value % (2^depth)), depth, 8) local a, Y = rescale_depth(floor(value / (2^depth)), depth, 8), rescale_depth(value % (2^depth), depth, 8)
png.data[index] = a * 0x1000000 + Y * 0x10000 + Y * 0x100 + Y -- R = G = B = Y png.data[index] = a * 0x1000000 + Y * 0x10000 + Y * 0x100 + Y -- R = G = B = Y
else else
assert(color == "truecolor" and depth == 16) assert(color == "truecolor" and depth == 16)