mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
feat(sointu, tracker,...): restructure domain & tracker models
send targets are now by ID and Song has "Score" part, which is the notes for it. also, moved the model part separate of the actual gioui dependend stuff. sorry to my future self about the code bomb; ended up too far and did not find an easy way to rewrite the history to make the steps smaller, so in the end, just squashed everything.
This commit is contained in:
22
tracker/gioui/iconcache.go
Normal file
22
tracker/gioui/iconcache.go
Normal file
@ -0,0 +1,22 @@
|
||||
package gioui
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"gioui.org/widget"
|
||||
)
|
||||
|
||||
var iconCache = map[*byte]*widget.Icon{}
|
||||
|
||||
// widgetForIcon returns a widget for IconVG data, but caching the results
|
||||
func widgetForIcon(icon []byte) *widget.Icon {
|
||||
if widget, ok := iconCache[&icon[0]]; ok {
|
||||
return widget
|
||||
}
|
||||
widget, err := widget.NewIcon(icon)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
iconCache[&icon[0]] = widget
|
||||
return widget
|
||||
}
|
Reference in New Issue
Block a user