Include depth in linear_size calculation

This commit is contained in:
Ashley Ruglys
2021-02-22 17:19:36 +01:00
parent f1b75cfc4d
commit 5ce64c2a4e
+6 -2
View File
@@ -138,10 +138,12 @@ impl Header {
None => return Err(Error::UnsupportedFormat),
};
let depth = depth.unwrap_or(1);
if compressed {
header.flags = header.flags | HeaderFlags::LINEARSIZE;
header.linear_size = Some(
pitch * height / format.get_pitch_height()
pitch * height * depth / format.get_pitch_height()
);
} else {
header.flags = header.flags | HeaderFlags::PITCH;
@@ -192,10 +194,12 @@ impl Header {
None => return Err(Error::UnsupportedFormat),
};
let depth = depth.unwrap_or(1);
if compressed {
header.flags = header.flags | HeaderFlags::LINEARSIZE;
header.linear_size = Some(
pitch * height / format.get_pitch_height()
pitch * height * depth / format.get_pitch_height()
);
} else {
header.flags = header.flags | HeaderFlags::PITCH;