From 30ed7413493825ff3a7cb1a83be171c340851a57 Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Sun, 24 Nov 2024 23:51:03 +0100 Subject: [PATCH] buffers: update threaded implementations --- src/buffers.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/buffers.rs b/src/buffers.rs index 04ad382..1cbc900 100644 --- a/src/buffers.rs +++ b/src/buffers.rs @@ -85,7 +85,8 @@ impl Default for BoundSurface>> { Self { binding: Arc::new(Mutex::new(ShaderBinding { shader: None, - rect: Rectangle::everything() + rect: Rectangle::everything(), + opacity: 255 })), } } @@ -96,7 +97,6 @@ impl Surface for BoundSurface>> { fn rect(&self) -> Rectangle { let r = self.binding.lock().unwrap(); r.rect.clone() - //self.binding.lock().unwrap().rect.clone() } fn with_shader(&self, mut f: F) { @@ -112,6 +112,18 @@ impl Surface for BoundSurface>> { fn clear_shader(&mut self) { self.binding.lock().unwrap().shader = None; } + + fn set_rect(&mut self, rect: &Rectangle) { + 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")]