diff --git a/internal/restorable/image.go b/internal/restorable/image.go index 68544de26..1fd0b4612 100644 --- a/internal/restorable/image.go +++ b/internal/restorable/image.go @@ -103,6 +103,11 @@ func NewScreenFramebufferImage(width, height int) *Image { return i } +func (i *Image) Clear() { + theImages.makeStaleIfDependingOn(i) + i.clear() +} + func (i *Image) clear() { if i.priority { panic("restorable: clear cannot be called on a priority image") diff --git a/internal/shareable/shareable.go b/internal/shareable/shareable.go index 6bc3207fa..92442c1a3 100644 --- a/internal/shareable/shareable.go +++ b/internal/shareable/shareable.go @@ -278,6 +278,11 @@ func (i *Image) Fill(r, g, b, a uint8) { i.ensureNotShared() backendsM.Unlock() + if r == 0 && g == 0 && b == 0 && a == 0 { + i.backend.restorable.Clear() + return + } + rf := float32(0) gf := float32(0) bf := float32(0)