proper support for linesizes
[nihav.git] / src / formats.rs
index aa053b2e75f55df7eb5cf6b7e0b64b3121a89a35..180e9800433bfc297bd2e2015c3e6d223f17a52a 100644 (file)
@@ -330,7 +330,11 @@ impl NAPixelChromaton {
     }
     pub fn get_linesize(&self, width: usize) -> usize {
         let d = self.depth as usize;
-        (self.get_width(width) * d + d - 1) >> 3
+        if self.packed {
+            (self.get_width(width) * d + d - 1) >> 3
+        } else {
+            self.get_width(width)
+        }
     }
     pub fn get_data_size(&self, width: usize, height: usize) -> usize {
         let nh = (height + ((1 << self.v_ss) - 1)) >> self.v_ss;