|
@@ -343,6 +343,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
|
|
|
|
// something is queued, blend mode is not Src so we have to do merging
|
|
// something is queued, blend mode is not Src so we have to do merging
|
|
{
|
|
{
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
Chunk? committedChunk = MaybeGetCommittedChunk(chunkPos, ChunkResolution.Full);
|
|
Chunk? committedChunk = MaybeGetCommittedChunk(chunkPos, ChunkResolution.Full);
|
|
Chunk? latestChunk = GetLatestChunk(chunkPos, ChunkResolution.Full);
|
|
Chunk? latestChunk = GetLatestChunk(chunkPos, ChunkResolution.Full);
|
|
Color committedColor = committedChunk is null
|
|
Color committedColor = committedChunk is null
|
|
@@ -409,6 +410,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
// combine with committed and then draw
|
|
// combine with committed and then draw
|
|
using var tempChunk = Chunk.Create(ProcessingColorSpace, resolution);
|
|
using var tempChunk = Chunk.Create(ProcessingColorSpace, resolution);
|
|
tempChunk.Surface.DrawingSurface.Canvas.DrawSurface(committedChunk.Surface.DrawingSurface, 0, 0,
|
|
tempChunk.Surface.DrawingSurface.Canvas.DrawSurface(committedChunk.Surface.DrawingSurface, 0, 0,
|
|
@@ -467,6 +469,8 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
|
|
+
|
|
// combine with committed and then draw
|
|
// combine with committed and then draw
|
|
using var tempChunk = Chunk.Create(ProcessingColorSpace, resolution);
|
|
using var tempChunk = Chunk.Create(ProcessingColorSpace, resolution);
|
|
tempChunk.Surface.DrawingSurface.Canvas.DrawSurface(committedChunk.Surface.DrawingSurface, 0, 0,
|
|
tempChunk.Surface.DrawingSurface.Canvas.DrawSurface(committedChunk.Surface.DrawingSurface, 0, 0,
|
|
@@ -1016,6 +1020,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
{
|
|
{
|
|
lock (lockObject)
|
|
lock (lockObject)
|
|
{
|
|
{
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
ThrowIfDisposed();
|
|
ThrowIfDisposed();
|
|
var affectedArea = FindAffectedArea();
|
|
var affectedArea = FindAffectedArea();
|
|
|
|
|
|
@@ -1106,6 +1111,8 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
|
|
+
|
|
//blend
|
|
//blend
|
|
blendModePaint.BlendMode = blendMode;
|
|
blendModePaint.BlendMode = blendMode;
|
|
if (lockTransparency)
|
|
if (lockTransparency)
|
|
@@ -1467,6 +1474,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
/// </summary>
|
|
/// </summary>
|
|
private Chunk GetOrCreateCommittedChunk(VecI chunkPos, ChunkResolution resolution)
|
|
private Chunk GetOrCreateCommittedChunk(VecI chunkPos, ChunkResolution resolution)
|
|
{
|
|
{
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
// committed chunk of the same resolution exists
|
|
// committed chunk of the same resolution exists
|
|
Chunk? targetChunk = MaybeGetCommittedChunk(chunkPos, resolution);
|
|
Chunk? targetChunk = MaybeGetCommittedChunk(chunkPos, resolution);
|
|
if (targetChunk is not null)
|
|
if (targetChunk is not null)
|
|
@@ -1509,6 +1517,7 @@ public class ChunkyImage : IReadOnlyChunkyImage, IDisposable, ICloneable, ICache
|
|
/// </summary>
|
|
/// </summary>
|
|
private Chunk GetOrCreateLatestChunk(VecI chunkPos, ChunkResolution resolution)
|
|
private Chunk GetOrCreateLatestChunk(VecI chunkPos, ChunkResolution resolution)
|
|
{
|
|
{
|
|
|
|
+ using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
|
|
// latest chunk exists
|
|
// latest chunk exists
|
|
Chunk? targetChunk = MaybeGetLatestChunk(chunkPos, resolution);
|
|
Chunk? targetChunk = MaybeGetLatestChunk(chunkPos, resolution);
|
|
if (targetChunk is not null)
|
|
if (targetChunk is not null)
|