Nikita Tsukanov
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
34 additions and
1 deletions
-
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual/ServerCompositionVisual.Render.cs
-
tests/Avalonia.RenderTests/Controls/BorderTests.cs
-
BIN
tests/TestFiles/Skia/Controls/Border/Border_Clips_To_Round_Bounds_NonUniform.expected.png
-
BIN
tests/TestFiles/Skia/Controls/Border/Border_Clips_To_Round_Bounds_Uniform.expected.png
|
|
|
@ -110,7 +110,7 @@ partial class ServerCompositionVisual |
|
|
|
_walkContext.PushClip(effectiveClip); |
|
|
|
|
|
|
|
if (visual.ClipToBounds) |
|
|
|
_canvas.PushClip(new Rect(0, 0, visual.Size.X, visual.Size.Y)); |
|
|
|
visual.PushClipToBounds(_canvas); |
|
|
|
|
|
|
|
if (visual.Clip != null) |
|
|
|
_canvas.PushGeometryClip(visual.Clip); |
|
|
|
|
|
|
|
@ -424,5 +424,38 @@ namespace Avalonia.Skia.RenderTests |
|
|
|
await RenderToFile(target); |
|
|
|
CompareImages(); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory, |
|
|
|
InlineData(true), |
|
|
|
InlineData(false)] |
|
|
|
public async Task Border_Clips_To_Round_Bounds(bool uniform) |
|
|
|
{ |
|
|
|
var cornerRadius = uniform |
|
|
|
? new CornerRadius(20) |
|
|
|
: new CornerRadius(20, 10, 30, 5); |
|
|
|
|
|
|
|
Decorator target = new Decorator |
|
|
|
{ |
|
|
|
Padding = new Thickness(8), |
|
|
|
Width = 200, |
|
|
|
Height = 200, |
|
|
|
Child = new Border |
|
|
|
{ |
|
|
|
CornerRadius = cornerRadius, |
|
|
|
Background = Brushes.LightBlue, |
|
|
|
ClipToBounds = true, |
|
|
|
Child = new Border |
|
|
|
{ |
|
|
|
Width = 300, |
|
|
|
Height = 300, |
|
|
|
Background = Brushes.Red, |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
var testSuffix = nameof(Border_Clips_To_Round_Bounds) + "_" + (uniform ? "Uniform" : "NonUniform"); |
|
|
|
await RenderToFile(target, testSuffix); |
|
|
|
CompareImages(testSuffix); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
Width:
|
Height:
|
Size: 1.5 KiB
|
Width:
|
Height:
|
Size: 1.6 KiB
|