Browse Source

Merge pull request #2171 from donandren/prs/renderingartifacts

fixes some rare rendering artifacts when dpi != 100%
danwalmsley 7 years ago
parent
commit
f17fc51885
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/Windows/Avalonia.Win32/WindowImpl.cs

+ 4 - 4
src/Windows/Avalonia.Win32/WindowImpl.cs

@@ -281,10 +281,10 @@ namespace Avalonia.Win32
             var f = Scaling;
             var r = new UnmanagedMethods.RECT
             {
-                left = (int)(rect.X * f),
-                top = (int)(rect.Y * f),
-                right = (int)(rect.Right * f),
-                bottom = (int)(rect.Bottom * f),
+                left = (int)Math.Floor(rect.X * f),
+                top = (int)Math.Floor(rect.Y * f),
+                right = (int)Math.Ceiling(rect.Right * f),
+                bottom = (int)Math.Ceiling(rect.Bottom * f),
             };
 
             UnmanagedMethods.InvalidateRect(_hwnd, ref r, false);