mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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)
|
clearImage(i.image, region)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even if the image is already stale, call makeStale to extend the stale region.
|
if !needsRestoration() || !i.needsRestoration() {
|
||||||
if !needsRestoration() || !i.needsRestoration() || i.stale {
|
|
||||||
i.makeStale(region)
|
i.makeStale(region)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -302,6 +301,12 @@ func (i *Image) WritePixels(pixels *graphics.ManagedBytes, region image.Rectangl
|
|||||||
return
|
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.
|
// Records for DrawTriangles cannot come before records for WritePixels.
|
||||||
if len(i.drawTrianglesHistory) > 0 {
|
if len(i.drawTrianglesHistory) > 0 {
|
||||||
i.makeStale(region)
|
i.makeStale(region)
|
||||||
|
Loading…
Reference in New Issue
Block a user