Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,31 @@ public partial class InfiniteCanvasVirtualDrawingSurface
internal void ReDraw(Rect viewPort, float zoom)
{
var toDraw = GetDrawingBoundaries(viewPort);

var scale = _screenScale * zoom;
var rect = ScaleRect(toDraw, scale);
var dpi = BaseCanvasDPI * (float)scale;

using (var drawingSession = CanvasComposition.CreateDrawingSession(_drawingSurface, ScaleRect(toDraw, scale), BaseCanvasDPI * (float)scale))
try
{
drawingSession.Clear(Colors.White);
foreach (var drawable in _visibleList)
using (var drawingSession = CanvasComposition.CreateDrawingSession(_drawingSurface, rect, dpi))
{
drawable.Draw(drawingSession, toDraw);
drawingSession.Clear(Colors.White);
foreach (var drawable in _visibleList)
{
drawable.Draw(drawingSession, toDraw);
}
}
}
catch (ArgumentException)
{
/* CanvasComposition.CreateDrawingSession has an internal
* limit on the size of the updateRectInPixels parameter,
* which we dont know, so we can get an ArgumentException
* if there is a lot of extreme zooming and panning
* Therefore, the only solution is to silently catch the
* exception and allow the app to continue
*/
}
}

private Rect ScaleRect(Rect rect, double scale)
Expand Down