mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-31 15:47:26 +00:00
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:
parent
fe9ee50209
commit
ea358d9b2c
5 changed files with 13 additions and 25 deletions
|
@ -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| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue