Skip to content

Commit 183b655

Browse files
authored
Merge pull request LykosAI#955 from ionite34/inference-improvements-to-main
inference improvements to main
2 parents bd35d4b + 152c707 commit 183b655

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
1212
- Fixed [#1078](https://github.com/LykosAI/StabilityMatrix/issues/1078) - "Call from invalid thread" error after one-click install finishes
1313
- Fixed [#1080](https://github.com/LykosAI/StabilityMatrix/issues/1080) - Some models not displayed in Checkpoint Manager
1414
- Fixed Inference image selector card buttons taking up the whole height of the card
15+
- Fixed Inference mask editor failing to paint to the right-most edge on large images
16+
- Fixed Inference mask editor not showing the entire image in certain circumstances
1517

1618
## v2.13.0
1719
### Added

StabilityMatrix.Avalonia/Controls/Painting/PaintCanvas.axaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private void HandlePointerMoved(PointerEventArgs e)
260260
// penPath.Path.LineTo(cursorPosition.ToSKPoint());
261261

262262
// Get bounds for discarding invalid points
263-
var canvasBounds = MainCanvas?.Bounds ?? new Rect();
263+
var canvasBounds = new Rect(0, 0, MainCanvas?.Bounds.Width ?? 0, MainCanvas?.Bounds.Height ?? 0);
264264

265265
// Add points
266266
foreach (var point in points)

StabilityMatrix.Avalonia/ViewModels/Controls/PaintCanvasViewModel.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,22 @@ public void RenderToSurface(
215215
}
216216
else
217217
{
218-
layer.Surface.Canvas.Clear(SKColors.Transparent);
218+
var currentInfo = layer.Surface.Canvas.DeviceClipBounds;
219+
if (currentInfo.Width != CanvasSize.Width || currentInfo.Height != CanvasSize.Height)
220+
{
221+
// Dispose the old surface
222+
layer.Surface.Dispose();
223+
224+
// Create a brand-new SKSurface with the new size
225+
layer.Surface = SKSurface.Create(
226+
new SKImageInfo(CanvasSize.Width, CanvasSize.Height)
227+
);
228+
}
229+
else
230+
{
231+
// No resize needed, just clear
232+
layer.Surface.Canvas.Clear(SKColors.Transparent);
233+
}
219234
}
220235
}
221236
}

StabilityMatrix.Avalonia/ViewModels/Dialogs/RecommendedModelsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public override async Task OnLoadedAsync()
115115
)
116116
);
117117
}
118-
catch (ApiException e)
118+
catch (Exception e)
119119
{
120120
// hide dialog and show error msg
121121
logger.LogError(e, "Failed to get recommended models");

StabilityMatrix.Avalonia/ViewModels/Inference/SelectImageCardViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Text.Json.Serialization;
88
using System.Threading.Tasks;
99
using AsyncAwaitBestPractices;
10+
using Avalonia.Controls.Notifications;
1011
using Avalonia.Input;
1112
using Avalonia.Platform.Storage;
1213
using Avalonia.Threading;
@@ -206,6 +207,11 @@ private async Task OpenEditMaskDialogAsync()
206207
if (await ImageSource.GetBitmapAsync() is not { } currentBitmap)
207208
{
208209
Logger.Warn("GetBitmapAsync returned null for image {Path}", ImageSource.LocalFile?.FullPath);
210+
notificationService.ShowPersistent(
211+
"Error Loading Image",
212+
"Could not load mask editor for the provided image.",
213+
NotificationType.Error
214+
);
209215
return;
210216
}
211217
MaskEditorViewModel.PaintCanvasViewModel.BackgroundImage = currentBitmap.ToSKBitmap();

0 commit comments

Comments
 (0)