mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
internal/restorable: extend the staleRegion when the image is already stale on WritePixels
This is a kind of refactoring. There seems no case that this condition change is really needed, but this is more logical.
This commit is contained in:
parent
67ceaf5874
commit
6b906bb813
@ -314,7 +314,8 @@ func (i *Image) WritePixels(pixels []byte, x, y, width, height int) {
|
||||
i.image.WritePixels(make([]byte, 4*width*height), x, y, width, height)
|
||||
}
|
||||
|
||||
if !needsRestoring() || !i.needsRestoring() {
|
||||
// Even if the image is already stale, call makeStale to extend the stale region.
|
||||
if !needsRestoring() || !i.needsRestoring() || i.stale {
|
||||
i.makeStale(image.Rect(x, y, x+width, y+height))
|
||||
return
|
||||
}
|
||||
@ -341,11 +342,6 @@ func (i *Image) WritePixels(pixels []byte, x, y, width, height int) {
|
||||
return
|
||||
}
|
||||
|
||||
if i.stale {
|
||||
// TODO: panic here?
|
||||
return
|
||||
}
|
||||
|
||||
if pixels != nil {
|
||||
// pixels can point to a shared region.
|
||||
// This function is responsible to copy this.
|
||||
|
Loading…
Reference in New Issue
Block a user