Introduce Translate primitive in iced_wgpu
This commit is contained in:
parent
2381a9310c
commit
59b1e90661
10 changed files with 127 additions and 104 deletions
|
|
@ -57,21 +57,27 @@ impl Cache {
|
|||
if let State::Filled { bounds, primitive } = self.state.borrow().deref()
|
||||
{
|
||||
if *bounds == new_bounds {
|
||||
return Geometry::from_primitive(primitive.clone());
|
||||
return Geometry::from_primitive(Primitive::Cached {
|
||||
cache: primitive.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let mut frame = Frame::new(new_bounds);
|
||||
input.draw(&mut frame);
|
||||
|
||||
let primitive = Arc::new(frame.into_primitive());
|
||||
let primitive = {
|
||||
let geometry = frame.into_geometry();
|
||||
|
||||
Arc::new(geometry.into_primitive())
|
||||
};
|
||||
|
||||
*self.state.borrow_mut() = State::Filled {
|
||||
bounds: new_bounds,
|
||||
primitive: primitive.clone(),
|
||||
};
|
||||
|
||||
Geometry::from_primitive(primitive)
|
||||
Geometry::from_primitive(Primitive::Cached { cache: primitive })
|
||||
}
|
||||
|
||||
pub fn with<'a, T>(&'a self, input: T) -> impl crate::canvas::State + 'a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue