This commit is contained in:
2026-05-23 06:45:18 +01:00
parent af0ec78eae
commit 9ad48ff310
5 changed files with 52 additions and 31 deletions
+7 -3
View File
@@ -14,6 +14,7 @@ import (
"os"
"path/filepath"
"sync"
"errors"
)
// global or app-level map/cache
@@ -46,7 +47,11 @@ func getTexture(path string) (gdk.Paintabler, error) {
return nil, err
}
textureCache.Store(path, tex)
return tex.(gdk.Paintabler), nil
t, ok := tex.(gdk.Paintabler)
if !ok {
return nil, errors.New("invalid type")
}
return t, nil
}
func newPictureFromPath(path string) (*gtk.Picture, error) {
@@ -63,8 +68,7 @@ func newImageFromPath(path string) (*gtk.Image, error) {
if err != nil {
return nil, err
}
img := gtk.NewImageFromPaintable(tex)
return img, nil
return gtk.NewImageFromPaintable(tex), nil
}
func newPictureFromWeb(url string) (*gtk.Picture, error) {