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;