Simplify internal image_size API

We don't need a property reference anymore, a plain image reference is fine AFAICS.

Dirtyness of the source is tracked on the caller side of layouting_info()
or in the draw_image_impl anyway.
This commit is contained in:
Simon Hausmann 2021-05-12 19:40:09 +02:00
parent fe9ee50209
commit ea358d9b2c
5 changed files with 13 additions and 25 deletions

View file

@ -125,14 +125,11 @@ impl PlatformWindow for TestingWindow {
Some(Box::new(TestingFontMetrics::default()))
}
fn image_size(
&self,
source: std::pin::Pin<&sixtyfps_corelib::Property<ImageReference>>,
) -> Size {
match source.get() {
fn image_size(&self, source: &ImageReference) -> Size {
match source {
ImageReference::None => Default::default(),
ImageReference::EmbeddedRgbaImage { width, height, .. } => {
Size::new(width as _, height as _)
Size::new(*width as _, *height as _)
}
ImageReference::AbsoluteFilePath(path) => image::open(Path::new(path.as_str()))
.map(|img| {