Browse Source
Extend dirty rect when UseLayoutRounding=false (#18511)
Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
pull/19055/head
Julien Lebosquain
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
19 additions and
0 deletions
-
src/Avalonia.Base/Layout/Layoutable.cs
-
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
-
src/Avalonia.Base/composition-schema.xml
|
|
|
@ -948,5 +948,17 @@ namespace Avalonia.Layout |
|
|
|
{ |
|
|
|
return new Size(Math.Max(size.Width, 0), Math.Max(size.Height, 0)); |
|
|
|
} |
|
|
|
|
|
|
|
internal override void SynchronizeCompositionProperties() |
|
|
|
{ |
|
|
|
base.SynchronizeCompositionProperties(); |
|
|
|
|
|
|
|
if (CompositionVisual is { } visual) |
|
|
|
{ |
|
|
|
// If the visual isn't using layout rounding, it's possible that antialiasing renders to pixels
|
|
|
|
// outside the current bounds. Extend the dirty rect by 1px in all directions in this case.
|
|
|
|
visual.ShouldExtendDirtyRect = !UseLayoutRounding; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -254,6 +254,12 @@ namespace Avalonia.Rendering.Composition.Server |
|
|
|
{ |
|
|
|
if (rc == default) |
|
|
|
return; |
|
|
|
|
|
|
|
// If the visual isn't using layout rounding, it's possible that antialiasing renders to pixels
|
|
|
|
// outside the current bounds. Extend the dirty rect by 1px in all directions in this case.
|
|
|
|
if (ShouldExtendDirtyRect && RenderOptions.EdgeMode != EdgeMode.Aliased) |
|
|
|
rc = rc.Inflate(new Thickness(1)); |
|
|
|
|
|
|
|
Root?.AddDirtyRect(rc); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -34,6 +34,7 @@ |
|
|
|
<Property Name="OpacityMaskBrush" ClientName="OpacityMaskBrushTransportField" Type="Avalonia.Media.IBrush?" Private="true" /> |
|
|
|
<Property Name="Effect" Type="Avalonia.Media.IImmutableEffect?" Internal="true" /> |
|
|
|
<Property Name="RenderOptions" Type="Avalonia.Media.RenderOptions" /> |
|
|
|
<Property Name="ShouldExtendDirtyRect" Type="bool" Internal="true" /> |
|
|
|
</Object> |
|
|
|
<Object Name="CompositionContainerVisual" Inherits="CompositionVisual"/> |
|
|
|
<Object Name="CompositionSolidColorVisual" Inherits="CompositionContainerVisual"> |
|
|
|
|