|
|
|
@ -22,6 +22,7 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
private List<IVisualNode> _children; |
|
|
|
private List<IDrawOperation> _drawOperations; |
|
|
|
private bool _drawOperationsCloned; |
|
|
|
private Matrix transformRestore; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="VisualNode"/> class.
|
|
|
|
@ -220,41 +221,43 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
/// <inheritdoc/>
|
|
|
|
public void BeginRender(IDrawingContextImpl context, bool skipOpacity) |
|
|
|
{ |
|
|
|
transformRestore = context.Transform; |
|
|
|
|
|
|
|
if (ClipToBounds) |
|
|
|
{ |
|
|
|
context.Transform = Matrix.Identity; |
|
|
|
context.PushClip(ClipBounds); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
context.Transform = Transform; |
|
|
|
|
|
|
|
if (Opacity != 1 && !skipOpacity) |
|
|
|
{ |
|
|
|
context.PushOpacity(Opacity); |
|
|
|
} |
|
|
|
|
|
|
|
if (OpacityMask != null) |
|
|
|
if (GeometryClip != null) |
|
|
|
{ |
|
|
|
context.PushOpacityMask(OpacityMask, ClipBounds); |
|
|
|
context.PushGeometryClip(GeometryClip); |
|
|
|
} |
|
|
|
|
|
|
|
context.Transform = Transform; |
|
|
|
|
|
|
|
if (GeometryClip != null) |
|
|
|
if (OpacityMask != null) |
|
|
|
{ |
|
|
|
context.PushGeometryClip(GeometryClip); |
|
|
|
context.PushOpacityMask(OpacityMask, ClipBounds); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
public void EndRender(IDrawingContextImpl context, bool skipOpacity) |
|
|
|
{ |
|
|
|
if (GeometryClip != null) |
|
|
|
if (OpacityMask != null) |
|
|
|
{ |
|
|
|
context.PopGeometryClip(); |
|
|
|
context.PopOpacityMask(); |
|
|
|
} |
|
|
|
|
|
|
|
if (OpacityMask != null) |
|
|
|
if (GeometryClip != null) |
|
|
|
{ |
|
|
|
context.PopOpacityMask(); |
|
|
|
context.PopGeometryClip(); |
|
|
|
} |
|
|
|
|
|
|
|
if (Opacity != 1 && !skipOpacity) |
|
|
|
@ -264,8 +267,11 @@ namespace Avalonia.Rendering.SceneGraph |
|
|
|
|
|
|
|
if (ClipToBounds) |
|
|
|
{ |
|
|
|
context.Transform = Matrix.Identity; |
|
|
|
context.PopClip(); |
|
|
|
} |
|
|
|
|
|
|
|
context.Transform = transformRestore; |
|
|
|
} |
|
|
|
|
|
|
|
private Rect CalculateBounds() |
|
|
|
|