mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Avoid debugger crashing the whole app
Cleaned up bitmap brush
This commit is contained in:
1 parent
a2871541b9
commit
e5d7dbae26
3 files changed
+18
-18
No files matched your search
@@ -49,17 +49,24 @@ namespace Artemis.UI.Screens.Settings.Debug
|
||||
return;
|
||||
}
|
||||
|
||||
using (var skiaImage = SKImage.FromPixels(e.BitmapBrush.Bitmap.PeekPixels()))
|
||||
try
|
||||
{
|
||||
var info = new SKImageInfo(skiaImage.Width, skiaImage.Height);
|
||||
writeableBitmap.Lock();
|
||||
using (var pixmap = new SKPixmap(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
|
||||
using (var skiaImage = SKImage.FromPixels(e.BitmapBrush.Bitmap.PeekPixels()))
|
||||
{
|
||||
skiaImage.ReadPixels(pixmap, 0, 0);
|
||||
}
|
||||
var info = new SKImageInfo(skiaImage.Width, skiaImage.Height);
|
||||
writeableBitmap.Lock();
|
||||
using (var pixmap = new SKPixmap(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
|
||||
{
|
||||
skiaImage.ReadPixels(pixmap, 0, 0);
|
||||
}
|
||||
|
||||
writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight));
|
||||
writeableBitmap.Unlock();
|
||||
writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight));
|
||||
writeableBitmap.Unlock();
|
||||
}
|
||||
}
|
||||
catch (AccessViolationException)
|
||||
{
|
||||
// oops
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user