From 7329880f405ea3d7574409ea4ed401bea5da319c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 19 Aug 2020 21:13:05 +0900 Subject: [PATCH] restorable: Make the image stale when volatile state changes --- internal/restorable/image.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/restorable/image.go b/internal/restorable/image.go index 2a072e5c2..6147a26e8 100644 --- a/internal/restorable/image.go +++ b/internal/restorable/image.go @@ -154,7 +154,11 @@ func NewImage(width, height int) *Image { // reading pixels from GPU are expensive operations. Volatile images can skip such oprations, but the image content // is cleared every frame instead. func (i *Image) SetVolatile(volatile bool) { + changed := i.volatile != volatile i.volatile = volatile + if changed { + i.makeStale() + } } // Extend extends the image by the given size.