Redesign iced_wgpu layering architecture

This commit is contained in:
Héctor Ramón Jiménez 2024-04-03 21:07:54 +02:00
parent 99a904112c
commit b05e61f5c8
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
36 changed files with 2781 additions and 2048 deletions

View file

@ -49,7 +49,7 @@ where
) -> Renderer::Geometry {
use std::ops::Deref;
if let State::Filled {
let previous = if let State::Filled {
bounds: cached_bounds,
geometry,
} = self.state.borrow().deref()
@ -57,12 +57,16 @@ where
if *cached_bounds == bounds {
return Cached::load(geometry);
}
}
Some(geometry.clone())
} else {
None
};
let mut frame = Frame::new(renderer, bounds);
draw_fn(&mut frame);
let geometry = frame.into_geometry().cache();
let geometry = frame.into_geometry().cache(previous);
let result = Cached::load(&geometry);
*self.state.borrow_mut() = State::Filled { bounds, geometry };