Browse Source

Glitches

pull/8105/head
Nikita Tsukanov 4 years ago
parent
commit
85c5377307
  1. 2
      src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
  2. 18
      src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs

2
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs

@ -152,6 +152,8 @@ namespace Avalonia.Rendering.Composition.Server
}
}
public Rect SnapToDevicePixels(Rect rect) => SnapToDevicePixels(rect, Scaling);
private static Rect SnapToDevicePixels(Rect rect, double scale)
{
return new Rect(

18
src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs

@ -47,7 +47,7 @@ namespace Avalonia.Rendering.Composition.Server
canvas.PushOpacity(Opacity);
var boundsRect = new Rect(new Size(Size.X, Size.Y));
if(ClipToBounds)
canvas.PushClip(boundsRect);
canvas.PushClip(Root!.SnapToDevicePixels(boundsRect));
if (Clip != null)
canvas.PushGeometryClip(Clip);
if(OpacityMaskBrush != null)
@ -162,22 +162,28 @@ namespace Avalonia.Rendering.Composition.Server
if (wasVisible != IsVisibleInFrame)
_isDirtyForUpdate = true;
var dirtyOldBounds = false;
// Invalidate previous rect and queue new rect based on visibility
if (positionChanged)
{
if(wasVisible)
AddDirtyRect(oldTransformedContentBounds.Intersect(oldCombinedTransformedClipBounds));
if (wasVisible)
dirtyOldBounds = true;
if (IsVisibleInFrame)
_isDirtyForUpdate = true;
}
// Invalidate new bounds
if (IsVisibleInFrame && _isDirtyForUpdate)
if (IsVisibleInFrame && _isDirtyForUpdate)
{
dirtyOldBounds = true;
AddDirtyRect(TransformedOwnContentBounds.Intersect(_combinedTransformedClipBounds));
}
if (dirtyOldBounds && wasVisible)
AddDirtyRect(oldTransformedContentBounds.Intersect(oldCombinedTransformedClipBounds));
_isDirtyForUpdate = false;
// Update readback indices

Loading…
Cancel
Save