mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 19:02:26 +01:00
Assert that pixel data is encoded
This commit is contained in:
parent
7b94fc026d
commit
1f9c446a98
6
init.lua
6
init.lua
@ -76,6 +76,7 @@ function image:encode_data(properties)
|
||||
local color_format = properties.color_format
|
||||
local compression = properties.compression
|
||||
|
||||
local data_length_before = #self.data
|
||||
if "Y8" == color_format and "RAW" == compression then
|
||||
if 8 == self.pixel_depth then
|
||||
self:encode_data_Y8_as_Y8_raw()
|
||||
@ -99,6 +100,11 @@ function image:encode_data(properties)
|
||||
self:encode_data_R8G8B8A8_as_B8G8R8A8_raw()
|
||||
end
|
||||
end
|
||||
local data_length_after = #self.data
|
||||
assert(
|
||||
data_length_after ~= data_length_before,
|
||||
"No data encoded for color format: " .. color_format
|
||||
)
|
||||
end
|
||||
|
||||
function image:encode_data_Y8_as_Y8_raw()
|
||||
|
Loading…
Reference in New Issue
Block a user