diff --git a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs index b39f1f3f21..93fed990fa 100644 --- a/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs +++ b/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs @@ -326,11 +326,8 @@ namespace Avalonia.Rendering using (var fullCtx = new DrawingContext(context, false)) using (fullCtx.PushPostTransform(node.Transform)) using (fullCtx.PushTransformContainer()) - critical.ThreadSafeRender(fullCtx, node.Bounds.Size, scaling); + critical.ThreadSafeRender(fullCtx, node.VisualSize, scaling); context.Transform = savedTransform; - - //critical.ThreadSafeRender() - } private void Render(IDrawingContextImpl context, VisualNode node, IVisual layer, Rect clipBounds) diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs index 10c8d36dc8..6c2315a0b1 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/IVisualNode.cs @@ -43,6 +43,11 @@ namespace Avalonia.Rendering.SceneGraph /// Gets the layout bounds for the node in global coordinates. /// Rect LayoutBounds { get; } + + /// + /// Gets the original visual size before transformations + /// + Size VisualSize { get; } /// /// Whether the node is clipped to . diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs index 4c475fcc97..2b241729fc 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs @@ -181,6 +181,7 @@ namespace Avalonia.Rendering.SceneGraph node.ClipBounds = clipBounds; node.ClipToBounds = clipToBounds; node.LayoutBounds = globalBounds; + node.VisualSize = visual.Bounds.Size; node.GeometryClip = visual.Clip?.PlatformImpl; node.Opacity = opacity; diff --git a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs index 159c3cd0fa..4c449dd649 100644 --- a/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs +++ b/src/Avalonia.Visuals/Rendering/SceneGraph/VisualNode.cs @@ -60,6 +60,9 @@ namespace Avalonia.Rendering.SceneGraph /// public Rect LayoutBounds { get; set; } + + /// + public Size VisualSize { get; set; } /// public bool ClipToBounds { get; set; } @@ -221,6 +224,7 @@ namespace Avalonia.Rendering.SceneGraph ClipBounds = ClipBounds, ClipToBounds = ClipToBounds, LayoutBounds = LayoutBounds, + VisualSize = VisualSize, GeometryClip = GeometryClip, _opacity = Opacity, OpacityMask = OpacityMask,