diff --git a/internal/restorable/image.go b/internal/restorable/image.go index 1312c2733..85e5a0a7a 100644 --- a/internal/restorable/image.go +++ b/internal/restorable/image.go @@ -283,8 +283,7 @@ func (i *Image) WritePixels(pixels *graphics.ManagedBytes, region image.Rectangl clearImage(i.image, region) } - // Even if the image is already stale, call makeStale to extend the stale region. - if !needsRestoration() || !i.needsRestoration() || i.stale { + if !needsRestoration() || !i.needsRestoration() { i.makeStale(region) return } @@ -302,6 +301,12 @@ func (i *Image) WritePixels(pixels *graphics.ManagedBytes, region image.Rectangl 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. if len(i.drawTrianglesHistory) > 0 { i.makeStale(region)