From a0a80bbc1f4fbd17c205de9e84c1f80d43b2de6c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 25 Feb 2023 21:13:20 +0900 Subject: [PATCH] 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. --- internal/restorable/image.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/internal/restorable/image.go b/internal/restorable/image.go index 02a1b6ab2..5e009e7e9 100644 --- a/internal/restorable/image.go +++ b/internal/restorable/image.go @@ -261,13 +261,11 @@ func (i *Image) BasePixelsForTesting() *Pixels { func (i *Image) makeStale(rect image.Rectangle) { i.stale = true - i.staleRegions = i.basePixels.AppendRegion(i.staleRegions) i.staleRegions = i.appendRegionsForDrawTriangles(i.staleRegions) if !rect.Empty() { i.staleRegions = append(i.staleRegions, rect) } - i.basePixels = Pixels{} i.clearDrawTrianglesHistory() // 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 { var rs []image.Rectangle if i.stale { - i.basePixels = Pixels{} rs = append(rs, i.staleRegions...) } else { rs = i.appendRegionsForDrawTriangles(rs)