render: make surfaces own rectangles, to drop a clone

This commit is contained in:
2024-12-14 14:48:31 +01:00
parent f180171ee7
commit e9bbdd13c2
3 changed files with 14 additions and 15 deletions

View File

@@ -30,7 +30,7 @@ pub trait Shader: Send + Sync {
pub trait Surfaces: Send + Sync {
type Surface: Surface;
type Error: Debug;
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>;
fn render_to<S: Sample>(&self, output: &mut S, frame: usize);
}
@@ -38,7 +38,7 @@ pub trait Surface: Send + Sync {
fn set_shader(&mut self, shader: Box<dyn Shader>);
fn clear_shader(&mut self);
fn set_rect(&mut self, rect: &Rectangle<Virtual>);
fn set_rect(&mut self, rect: Rectangle<Virtual>);
fn set_opacity(&mut self, opacity: u8);
}