Skip to content
Merged
Show file tree
Hide file tree
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 @@ -94,7 +94,8 @@ private bool HandlePreGraphTransformClipOpacity(ServerCompositionVisual visual)

if (visual.Opacity != 1)
{
_opacityStack.Push(effectiveOpacity);
_opacityStack.Push(_opacity);
_opacity = effectiveOpacity;
_canvas.PushOpacity(visual.Opacity, visual._transformedSubTreeBounds.Value.ToRect());
}

Expand Down
55 changes: 55 additions & 0 deletions tests/Avalonia.RenderTests/BugRepros.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Avalonia.Controls;
using Avalonia.Controls.Shapes;
using Avalonia.Layout;
using Avalonia.Media;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

namespace Avalonia.Skia.RenderTests;

public class BugRepros() : TestBase(nameof(BugRepros))
{
[Fact]
public async Task Sibling_Visuals_With_Opacity_Should_Not_Affect_Each_Other()
{
var brushes = new IBrush[]
{
Brushes.Red,
Brushes.Green,
Brushes.Blue,
Brushes.Yellow,
Brushes.Magenta,
Brushes.Cyan,
Brushes.Orange,
Brushes.Purple,
Brushes.Pink,
Brushes.Brown
};

var stackPanel = new StackPanel
{
Orientation = Orientation.Vertical,
Width = 300,
Height = 500,
Background = Brushes.White,
};

for (int i = 0; i < brushes.Length; i++)
{
var border = new Border
{
Width = 280,
Height = 40,
BorderThickness = new Thickness(2),
Margin = new Thickness(5),
Background = brushes[i],
Opacity = 0.3
};
stackPanel.Children.Add(border);
}

await RenderToFile(stackPanel);
CompareImages();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.