buffers: update threaded implementations

This commit is contained in:
Victoria Fischer 2024-11-24 23:51:03 +01:00
parent 3783bc60b2
commit 30ed741349

View File

@ -85,7 +85,8 @@ impl Default for BoundSurface<Arc<Mutex<ShaderBinding>>> {
Self { Self {
binding: Arc::new(Mutex::new(ShaderBinding { binding: Arc::new(Mutex::new(ShaderBinding {
shader: None, shader: None,
rect: Rectangle::everything() rect: Rectangle::everything(),
opacity: 255
})), })),
} }
} }
@ -96,7 +97,6 @@ impl Surface for BoundSurface<Arc<Mutex<ShaderBinding>>> {
fn rect(&self) -> Rectangle<u8, Virtual> { fn rect(&self) -> Rectangle<u8, Virtual> {
let r = self.binding.lock().unwrap(); let r = self.binding.lock().unwrap();
r.rect.clone() r.rect.clone()
//self.binding.lock().unwrap().rect.clone()
} }
fn with_shader<F: FnMut(&dyn Shader)>(&self, mut f: F) { fn with_shader<F: FnMut(&dyn Shader)>(&self, mut f: F) {
@ -112,6 +112,18 @@ impl Surface for BoundSurface<Arc<Mutex<ShaderBinding>>> {
fn clear_shader(&mut self) { fn clear_shader(&mut self) {
self.binding.lock().unwrap().shader = None; self.binding.lock().unwrap().shader = None;
} }
fn set_rect(&mut self, rect: &Rectangle<u8, Virtual>) {
self.binding.lock().unwrap().rect = rect.clone();
}
fn opacity(&self) -> u8 {
self.binding.lock().unwrap().opacity
}
fn set_opacity(&mut self, opacity: u8) {
self.binding.lock().unwrap().opacity = opacity
}
} }
#[cfg(feature="threads")] #[cfg(feature="threads")]