Implement Primitive::Cached

This commit is contained in:
Héctor Ramón Jiménez 2020-03-07 23:45:54 +01:00
parent 37f0d97159
commit b74e7e7353
12 changed files with 151 additions and 105 deletions

View file

@ -123,7 +123,10 @@ impl<'a, Message> Widget<Message, Renderer> for Canvas<'a> {
primitives: self
.layers
.iter()
.map(|layer| layer.draw(origin, size))
.map(|layer| Primitive::Cached {
origin,
cache: layer.draw(size),
})
.collect(),
},
MouseCursor::Idle,