From cf7815ab57ce9a86c78805a29fd413c2508b5f48 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sun, 23 Jul 2023 21:33:17 +0100 Subject: [PATCH 1/2] Don't actually re-load our images when they are resized unless SVG If the pixel info is loaded the GPU can do the rest --- canvas/image.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/canvas/image.go b/canvas/image.go index e22381fbdf..a2bb85b180 100644 --- a/canvas/image.go +++ b/canvas/image.go @@ -180,7 +180,11 @@ func (i *Image) Resize(s fyne.Size) { } i.baseObject.Resize(s) - i.Refresh() + if i.isSVG { + i.Refresh() // we need to rasterise at the new size + } else { + Refresh(i) // just re-size using GPU scaling + } } // NewImageFromFile creates a new image from a local file. From d8b451da8f0da5430e94ec85c169be2f1e885beb Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 24 Jul 2023 15:16:43 +0100 Subject: [PATCH 2/2] If we have not rendered before a resize could refresh... Mostly used for testing but no big deal --- canvas/image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canvas/image.go b/canvas/image.go index a2bb85b180..c80653b066 100644 --- a/canvas/image.go +++ b/canvas/image.go @@ -180,7 +180,7 @@ func (i *Image) Resize(s fyne.Size) { } i.baseObject.Resize(s) - if i.isSVG { + if i.isSVG || i.Image == nil { i.Refresh() // we need to rasterise at the new size } else { Refresh(i) // just re-size using GPU scaling