mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +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)
|
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))
|
i.makeStale(image.Rect(x, y, x+width, y+height))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -341,11 +342,6 @@ func (i *Image) WritePixels(pixels []byte, x, y, width, height int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if i.stale {
|
|
||||||
// TODO: panic here?
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if pixels != nil {
|
if pixels != nil {
|
||||||
// pixels can point to a shared region.
|
// pixels can point to a shared region.
|
||||||
// This function is responsible to copy this.
|
// This function is responsible to copy this.
|
||||||
|
Loading…
Reference in New Issue
Block a user