mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
restorable: Bug fix: Skip the screen image to check invalidation
This commit is contained in:
parent
24822c0a10
commit
ffb9871839
@ -154,6 +154,12 @@ func (i *Image) CopyPixels(src *Image) {
|
||||
}
|
||||
|
||||
func (i *Image) IsInvalidated() bool {
|
||||
if i.screen {
|
||||
// The screen image might not have a texture, and in this case it is impossible to detect whether
|
||||
// the image is invalidated or not.
|
||||
panic("graphicscommand: IsInvalidated cannot be called on the screen image")
|
||||
}
|
||||
|
||||
// i.image can be nil before initializing.
|
||||
if i.image == nil {
|
||||
return false
|
||||
|
@ -72,6 +72,10 @@ func RestoreIfNeeded() error {
|
||||
// As isInvalidated() is expensive, call this only for one image.
|
||||
// This assumes that if there is one image that is invalidated, all images are invalidated.
|
||||
for img := range theImages.images {
|
||||
// The screen image might not have a texture. Skip this.
|
||||
if img.screen {
|
||||
continue
|
||||
}
|
||||
r = img.isInvalidated()
|
||||
break
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user