diff --git a/src/buffers.rs b/src/buffers.rs index 0de96d6..eee4c37 100644 --- a/src/buffers.rs +++ b/src/buffers.rs @@ -59,6 +59,10 @@ impl Surface for BoundSurface>> { fn clear_shader(&mut self) { self.binding.borrow_mut().shader = None; } + + fn set_rect(&mut self, rect: &Rectangle) { + self.binding.borrow_mut().rect = rect.clone(); + } } #[cfg(feature="threads")] @@ -132,8 +136,9 @@ impl SurfacePool { } impl Surfaces for SurfacePool { - fn new_surface(&mut self, _area: &Rectangle) -> Result { - let surface = S::default(); + fn new_surface(&mut self, area: &Rectangle) -> Result { + let mut surface = S::default(); + surface.set_rect(area); self.surfaces.push(surface.clone()); return Ok(surface); } diff --git a/src/render.rs b/src/render.rs index 8117c98..c78c763 100644 --- a/src/render.rs +++ b/src/render.rs @@ -22,6 +22,7 @@ pub trait Surface: Default + Clone + Debug { fn clear_shader(&mut self); fn rect(&self) -> Rectangle; + fn set_rect(&mut self, rect: &Rectangle); } pub trait Framed {