mirror of
https://github.com/encounter/ddsfile.git
synced 2026-07-10 03:18:46 -07:00
Include depth in linear_size calculation
This commit is contained in:
+6
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user