internal/uidriver/glfw: Avoid allocating a new slice

This commit is contained in:
Hajime Hoshi 2021-04-25 00:57:06 +09:00
parent e2ceb7b3a6
commit 091e51ae4c

View File

@ -967,8 +967,8 @@ func (u *UserInterface) loop() error {
// Create icon images in a different goroutine (#1478). // Create icon images in a different goroutine (#1478).
// In the fullscreen mode, SetIcon fails (#1578). // In the fullscreen mode, SetIcon fails (#1578).
if imgs := u.getIconImages(); imgs != nil && !u.isFullscreen() { if imgs := u.getIconImages(); len(imgs) > 0 && !u.isFullscreen() {
u.setIconImages(nil) u.setIconImages(imgs[:0])
// Convert the icons in the different goroutine, as (*ebiten.Image).At cannot be invoked // Convert the icons in the different goroutine, as (*ebiten.Image).At cannot be invoked
// from this goroutine. At works only in between BeginFrame and EndFrame. // from this goroutine. At works only in between BeginFrame and EndFrame.