internal/atlas: clarify the logic when to update usedAsDestination

As the name is `usedAsDestination`, this should be updated whenever
the image is used as a rendering destination.

Confirmed that this change didn't cause a performance regression
like #2586.

Updates #2586
Updates #2676
This commit is contained in:
Hajime Hoshi 2023-08-06 15:22:12 +09:00
parent a50d9e6291
commit 2c9f5d9dad

View File

@ -230,6 +230,7 @@ func (i *Image) paddingSize() int {
func (i *Image) ensureIsolatedFromSource(backends []*backend) {
i.resetUsedAsSourceCount()
imagesUsedAsDestination[i] = struct{}{}
if i.backend == nil {
// `theSourceBackendsForOneFrame` already includes `backends`.
@ -245,8 +246,6 @@ func (i *Image) ensureIsolatedFromSource(backends []*backend) {
return
}
imagesUsedAsDestination[i] = struct{}{}
// Check if i has the same backend as the given backends.
var needsIsolation bool
for _, b := range backends {