|
@@ -137,26 +137,24 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable
|
|
|
return rect;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public RectI? FindPreciseBounds()
|
|
|
+
|
|
|
+ /// <exception cref="ObjectDisposedException">This image is disposed</exception>
|
|
|
+ public RectI? FindPreciseCommittedBounds()
|
|
|
{
|
|
|
lock (lockObject)
|
|
|
{
|
|
|
ThrowIfDisposed();
|
|
|
- RectI? chunkBounds = FindLatestBounds();
|
|
|
- if(!chunkBounds.HasValue) return null;
|
|
|
|
|
|
RectI? preciseBounds = null;
|
|
|
-
|
|
|
- foreach (var chunk in committedChunks[ChunkResolution.Full])
|
|
|
+ foreach (var (chunkPos, chunk) in committedChunks[ChunkResolution.Full])
|
|
|
{
|
|
|
- if(!chunkBounds.Value.Intersects(new RectI(chunk.Key, new VecI(FullChunkSize)))) continue;
|
|
|
-
|
|
|
- RectI? chunkPreciseBounds = chunk.Value.FindPreciseBounds();
|
|
|
- if(!chunkPreciseBounds.HasValue) continue;
|
|
|
-
|
|
|
- preciseBounds ??= chunkPreciseBounds.Value;
|
|
|
- preciseBounds = preciseBounds.Value.Union(chunkPreciseBounds.Value);
|
|
|
+ RectI? chunkPreciseBounds = chunk.FindPreciseBounds();
|
|
|
+ if(chunkPreciseBounds is null)
|
|
|
+ continue;
|
|
|
+ RectI globalChunkBounds = chunkPreciseBounds.Value.Offset(chunkPos * FullChunkSize);
|
|
|
+
|
|
|
+ preciseBounds ??= globalChunkBounds;
|
|
|
+ preciseBounds = preciseBounds.Value.Union(globalChunkBounds);
|
|
|
}
|
|
|
|
|
|
return preciseBounds;
|