1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

Optimize and improve built-in PNG writer (#14020)

This commit is contained in:
sfan5
2023-12-27 11:56:48 +01:00
committed by GitHub
parent 5054918efc
commit 93dfa8a6d8
4 changed files with 120 additions and 26 deletions

View File

@@ -64,6 +64,13 @@ function core.encode_png(width, height, data, compression)
error("Incorrect type for 'height', expected number, got " .. type(height))
end
if width < 1 then
error("Incorrect value for 'width', must be at least 1")
end
if height < 1 then
error("Incorrect value for 'height', must be at least 1")
end
local expected_byte_count = width * height * 4
if type(data) ~= "table" and type(data) ~= "string" then