mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +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 {
|
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.
|
// i.image can be nil before initializing.
|
||||||
if i.image == nil {
|
if i.image == nil {
|
||||||
return false
|
return false
|
||||||
|
@ -72,6 +72,10 @@ func RestoreIfNeeded() error {
|
|||||||
// As isInvalidated() is expensive, call this only for one image.
|
// 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.
|
// This assumes that if there is one image that is invalidated, all images are invalidated.
|
||||||
for img := range theImages.images {
|
for img := range theImages.images {
|
||||||
|
// The screen image might not have a texture. Skip this.
|
||||||
|
if img.screen {
|
||||||
|
continue
|
||||||
|
}
|
||||||
r = img.isInvalidated()
|
r = img.isInvalidated()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user