Commit 52b65ad7 authored by Romain Vimont's avatar Romain Vimont Committed by Thomas Daede

Expose whole plane as a region

Add convenience methods to access a whole plane as a region.
parent 6c76da2e
......@@ -287,6 +287,16 @@ impl<T: Pixel> Plane<T> {
PlaneRegionMut::new(self, rect)
}
#[inline(always)]
pub fn as_region(&self) -> PlaneRegion<'_, T> {
self.region(Area::StartingAt { x: 0, y: 0 })
}
#[inline(always)]
pub fn as_region_mut(&mut self) -> PlaneRegionMut<'_, T> {
self.region_mut(Area::StartingAt { x: 0, y: 0 })
}
#[inline]
fn index(&self, x: usize, y: usize) -> usize {
(y + self.cfg.yorigin) * self.cfg.stride + (x + self.cfg.xorigin)
......
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