mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/restorable: do not reset basePixels at makeStale
This information is still available even after context-lost happens, so this doesn't have to be reset.
This commit is contained in:
parent
ff1621885d
commit
a0a80bbc1f
@ -261,13 +261,11 @@ func (i *Image) BasePixelsForTesting() *Pixels {
|
|||||||
func (i *Image) makeStale(rect image.Rectangle) {
|
func (i *Image) makeStale(rect image.Rectangle) {
|
||||||
i.stale = true
|
i.stale = true
|
||||||
|
|
||||||
i.staleRegions = i.basePixels.AppendRegion(i.staleRegions)
|
|
||||||
i.staleRegions = i.appendRegionsForDrawTriangles(i.staleRegions)
|
i.staleRegions = i.appendRegionsForDrawTriangles(i.staleRegions)
|
||||||
if !rect.Empty() {
|
if !rect.Empty() {
|
||||||
i.staleRegions = append(i.staleRegions, rect)
|
i.staleRegions = append(i.staleRegions, rect)
|
||||||
}
|
}
|
||||||
|
|
||||||
i.basePixels = Pixels{}
|
|
||||||
i.clearDrawTrianglesHistory()
|
i.clearDrawTrianglesHistory()
|
||||||
|
|
||||||
// Don't have to call makeStale recursively here.
|
// Don't have to call makeStale recursively here.
|
||||||
@ -484,7 +482,6 @@ func (i *Image) makeStaleIfDependingOnShader(shader *Shader) {
|
|||||||
func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error {
|
func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error {
|
||||||
var rs []image.Rectangle
|
var rs []image.Rectangle
|
||||||
if i.stale {
|
if i.stale {
|
||||||
i.basePixels = Pixels{}
|
|
||||||
rs = append(rs, i.staleRegions...)
|
rs = append(rs, i.staleRegions...)
|
||||||
} else {
|
} else {
|
||||||
rs = i.appendRegionsForDrawTriangles(rs)
|
rs = i.appendRegionsForDrawTriangles(rs)
|
||||||
|
Loading…
Reference in New Issue
Block a user