restorable: Make the image stale when volatile state changes

This commit is contained in:
Hajime Hoshi 2020-08-19 21:13:05 +09:00
parent 7ec63acd1d
commit 7329880f40

View File

@ -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 // reading pixels from GPU are expensive operations. Volatile images can skip such oprations, but the image content
// is cleared every frame instead. // is cleared every frame instead.
func (i *Image) SetVolatile(volatile bool) { func (i *Image) SetVolatile(volatile bool) {
changed := i.volatile != volatile
i.volatile = volatile i.volatile = volatile
if changed {
i.makeStale()
}
} }
// Extend extends the image by the given size. // Extend extends the image by the given size.