Skip to content

Commit

Permalink
DXCanvas: fixed posibility monitor can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
d2phap committed May 18, 2024
1 parent c7ad52c commit 990729b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Components/ImageGlass.Views/DXCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1559,16 +1559,22 @@ protected override void OnRender(IGraphics g)

if (EnableDebug)
{
var text = "";
var monitor = DirectN.Monitor.FromWindow(TopLevelControl.Handle);

var text = $"Monitor={monitor.Bounds.Size}; Dpi={DeviceDpi} ({(int)monitor.ScaleFactor}%); Renderer={Source}";
if (monitor != null)
{
text = $"Monitor={monitor?.Bounds.Size}; {(int)monitor.ScaleFactor}%; ";
}

text = $"Dpi={DeviceDpi}; Renderer={Source}; ";
if (UseWebview2)
{
text += $"; v{Web2.Webview2Version}";
text += $"v{Web2.Webview2Version}; ";
}
else
{
text += $"; Opacity={_imageOpacity}; FPS={FPS}";
text += $"Opacity={_imageOpacity}; FPS={FPS}; ";
}

var textSize = g.MeasureText(text, Font.Name, Font.Size, textDpi: DeviceDpi);
Expand Down

0 comments on commit 990729b

Please sign in to comment.