geometry: cut down on <> noise with associated types

This commit is contained in:
2024-11-29 00:10:52 +01:00
parent 5488f85792
commit 2f9b99c2b0
5 changed files with 100 additions and 106 deletions

View File

@@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex};
#[derive(Debug)]
pub struct ShaderBinding {
shader: Option<Box<dyn Shader>>,
rect: Rectangle<u8, Virtual>,
rect: Rectangle<Virtual>,
opacity: u8
}
@@ -45,7 +45,7 @@ impl Default for BoundSurface<Rc<RefCell<ShaderBinding>>>{
}
impl Surface for BoundSurface<Rc<RefCell<ShaderBinding>>> {
fn rect(&self) -> Rectangle<u8, Virtual> {
fn rect(&self) -> Rectangle<Virtual> {
self.binding.borrow().rect.clone()
}
@@ -63,7 +63,7 @@ impl Surface for BoundSurface<Rc<RefCell<ShaderBinding>>> {
self.binding.borrow_mut().shader = None;
}
fn set_rect(&mut self, rect: &Rectangle<u8, Virtual>) {
fn set_rect(&mut self, rect: &Rectangle<Virtual>) {
self.binding.borrow_mut().rect = rect.clone();
}
@@ -159,7 +159,7 @@ impl<S: Surface + Default> SurfacePool<S> {
}
impl<S: Surface + Default> Surfaces<S> for SurfacePool<S> {
fn new_surface(&mut self, area: &Rectangle<u8, Virtual>) -> Result<S, io::Error> {
fn new_surface(&mut self, area: &Rectangle<Virtual>) -> Result<S, io::Error> {
let mut surface = S::default();
surface.set_rect(area);
self.surfaces.push(surface.clone());