Commit f3aa26a1 authored by Romain Vimont's avatar Romain Vimont Committed by Luca Barbato

Do not expose multirows slices in PlaneSlice

Remove as_slice() and similar methods from PlaneSlice which expose
slices spanning multiple rows.
parent bd0f459b
......@@ -375,24 +375,6 @@ impl<'a, T: Pixel> PlaneSlice<'a, T> {
}
}
pub fn as_slice(&self) -> &'a [T] {
let stride = self.plane.cfg.stride;
let base = (self.y + self.plane.cfg.yorigin as isize) as usize * stride
+ (self.x + self.plane.cfg.xorigin as isize) as usize;
&self.plane.data[base..]
}
pub fn as_slice_clamped(&self) -> &'a [T] {
let stride = self.plane.cfg.stride;
let y = (self.y.min(self.plane.cfg.height as isize)
+ self.plane.cfg.yorigin as isize)
.max(0) as usize;
let x = (self.x.min(self.plane.cfg.width as isize)
+ self.plane.cfg.xorigin as isize)
.max(0) as usize;
&self.plane.data[y * stride + x..]
}
pub fn clamp(&self) -> PlaneSlice<'a, T> {
PlaneSlice {
plane: self.plane,
......@@ -407,13 +389,6 @@ impl<'a, T: Pixel> PlaneSlice<'a, T> {
}
}
pub fn as_slice_w_width(&self, width: usize) -> &'a [T] {
let stride = self.plane.cfg.stride;
let base = (self.y + self.plane.cfg.yorigin as isize) as usize * stride
+ (self.x + self.plane.cfg.xorigin as isize) as usize;
&self.plane.data[base..base + width]
}
pub fn iter_width(&self, width: usize) -> IterWidth<'a, T> {
IterWidth { ps: *self, width }
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment