render: make surfaces own rectangles, to drop a clone
This commit is contained in:
@@ -82,9 +82,9 @@ impl Surface for BufferedSurface {
|
||||
});
|
||||
}
|
||||
|
||||
fn set_rect(&mut self, rect: &Rectangle<Virtual>) {
|
||||
fn set_rect(&mut self, rect: Rectangle<Virtual>) {
|
||||
self.updater.push(SurfaceUpdate {
|
||||
rect: Some(rect.clone()),
|
||||
rect: Some(rect),
|
||||
slot: self.slot,
|
||||
..Default::default()
|
||||
});
|
||||
@@ -179,12 +179,12 @@ impl Surfaces for ShaderChain {
|
||||
type Error = ();
|
||||
type Surface = BufferedSurface;
|
||||
|
||||
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
fn new_surface(&mut self, area: Rectangle<Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
let next_slot = self.bindings.len();
|
||||
self.bindings.push(ShaderBinding {
|
||||
opacity: 255,
|
||||
shader: None,
|
||||
rect: area.clone()
|
||||
rect: area
|
||||
});
|
||||
|
||||
Ok(BufferedSurface {
|
||||
@@ -225,7 +225,7 @@ impl BufferedSurfacePool {
|
||||
impl Surfaces for BufferedSurfacePool {
|
||||
type Error = ();
|
||||
type Surface = <ShaderChain as Surfaces>::Surface;
|
||||
fn new_surface(&mut self, area: &crate::geometry::Rectangle<crate::geometry::Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
fn new_surface(&mut self, area: crate::geometry::Rectangle<crate::geometry::Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
self.pool.write().unwrap().new_surface(area)
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ impl Surface for SharedSurface {
|
||||
self.binding.lock().unwrap().shader = None;
|
||||
}
|
||||
|
||||
fn set_rect(&mut self, rect: &Rectangle<Virtual>) {
|
||||
self.binding.lock().unwrap().rect = rect.clone();
|
||||
fn set_rect(&mut self, rect: Rectangle<Virtual>) {
|
||||
self.binding.lock().unwrap().rect = rect;
|
||||
}
|
||||
|
||||
fn set_opacity(&mut self, opacity: u8) {
|
||||
@@ -296,7 +296,7 @@ impl SurfacePool {
|
||||
impl Surfaces for SurfacePool {
|
||||
type Surface = SharedSurface;
|
||||
type Error = io::Error;
|
||||
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
fn new_surface(&mut self, area: Rectangle<Virtual>) -> Result<Self::Surface, Self::Error> {
|
||||
let mut surface = SharedSurface::default();
|
||||
surface.set_rect(area);
|
||||
self.surfaces.push(surface.clone());
|
||||
|
Reference in New Issue
Block a user