X-Git-Url: https://git.nihav.org/?p=nihav.git;a=blobdiff_plain;f=nihav-codec-support%2Fsrc%2Fdata%2Fmod.rs;h=eba029939a3a46643dea1fd3a650a7eccf1f3927;hp=b8980f2d9b5180d5c06916650cff93200f7e789e;hb=379524159c95f1c3639976ccf35f9d47cd9732ac;hpb=e65c00402a7bfdeb7e1922a46fab0fbabb7bbf33 diff --git a/nihav-codec-support/src/data/mod.rs b/nihav-codec-support/src/data/mod.rs index b8980f2..eba0299 100644 --- a/nihav-codec-support/src/data/mod.rs +++ b/nihav-codec-support/src/data/mod.rs @@ -44,17 +44,17 @@ impl GenericCache { stride, height, xpos: 0, - data: Vec::with_capacity((height + 1) * stride), + data: Vec::with_capacity((height + 1) * stride + 1), default, }; ret.reset(); ret } /// Reports the total amount of elements stored. - pub fn full_size(&self) -> usize { self.stride * (self.height + 1) } + pub fn full_size(&self) -> usize { self.stride * (self.height + 1) + 1 } /// Resets the cache state. pub fn reset(&mut self) { - self.data.truncate(0); + self.data.clear(); let size = self.full_size(); self.data.resize(size, self.default); self.xpos = self.stride + 1;