aboutsummaryrefslogtreecommitdiffstats
path: root/src/formats.rs
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2017-06-04 11:28:08 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2017-06-04 11:28:08 +0200
commit6c8e5c40938d4e34f062b53e9ad0d4bd6b147b26 (patch)
tree918c67ac308a088b9d8897c1abe54964ffbd77ea /src/formats.rs
parentb5bd2ae4704ee222d4173b63ff8469ba733d4d9f (diff)
downloadnihav-6c8e5c40938d4e34f062b53e9ad0d4bd6b147b26.tar.gz
proper support for linesizes
Diffstat (limited to 'src/formats.rs')
-rw-r--r--src/formats.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/formats.rs b/src/formats.rs
index aa053b2..180e980 100644
--- a/src/formats.rs
+++ b/src/formats.rs
@@ -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;