mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/restorable: restore a stale image at clearing pixels
This commit is contained in:
parent
26f0479f16
commit
aa8e112414
@ -283,8 +283,7 @@ func (i *Image) WritePixels(pixels *graphics.ManagedBytes, region image.Rectangl
|
||||
clearImage(i.image, region)
|
||||
}
|
||||
|
||||
// Even if the image is already stale, call makeStale to extend the stale region.
|
||||
if !needsRestoration() || !i.needsRestoration() || i.stale {
|
||||
if !needsRestoration() || !i.needsRestoration() {
|
||||
i.makeStale(region)
|
||||
return
|
||||
}
|
||||
@ -302,6 +301,12 @@ func (i *Image) WritePixels(pixels *graphics.ManagedBytes, region image.Rectangl
|
||||
return
|
||||
}
|
||||
|
||||
if i.stale {
|
||||
// Even if the image is already stale, call makeStale to extend the stale region.
|
||||
i.makeStale(region)
|
||||
return
|
||||
}
|
||||
|
||||
// Records for DrawTriangles cannot come before records for WritePixels.
|
||||
if len(i.drawTrianglesHistory) > 0 {
|
||||
i.makeStale(region)
|
||||
|
Loading…
Reference in New Issue
Block a user