internal/restorable: reduce more duplicated regions

This commit is contained in:
Hajime Hoshi 2023-03-09 23:17:02 +09:00
parent f3b49e6543
commit 8f2097d55e

View File

@ -486,6 +486,7 @@ func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error
defer func() {
i.regionsCache = i.regionsCache[:0]
}()
i.regionsCache = removeDuplicatedRegions(i.regionsCache)
rs = i.regionsCache
}
@ -627,6 +628,7 @@ func (i *Image) restore(graphicsDriver graphicsdriver.Graphics) error {
defer func() {
i.regionsCache = i.regionsCache[:0]
}()
i.regionsCache = removeDuplicatedRegions(i.regionsCache)
for _, r := range i.regionsCache {
if r.Empty() {