Fix RenderTargetBitmap looses effects by timunie · Pull Request #20790 · AvaloniaUI/Avalonia (original) (raw)
don't get lost at some point in time
Fix RenderDataEffectNode.Bounds to return null when no children exist, preventing empty effect nodes from incorrectly reporting non-null bounds and causing render artifacts due to incorrect dirty rects. Bounds now inflates child bounds by the effect output padding rather than unioning with BoundsRect.
Move effect output padding inflation from callers into DrawingContext implementations (PlatformDrawingContext, RenderDataDrawingContext) so callers pass content bounds to PushEffect and the API handles inflation internally. Remove pre-inflation from ImmediateRenderer.
Fix DrawingGroup.DrawCore to pass effectBounds (inflated) to PushOpacityMask when an Effect is set, so the opacity mask covers the full effect output region (e.g. shadow/blur extending beyond visual bounds).
Fix DrawingGroup.GetBounds to inflate EffectBounds (which now stores content bounds) by the effect output padding.
Fix existing compile error: Rect.IsEmpty() is a method, not property.
Add failing tests for each of the above before fixing.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
… output padding
GetBounds() should return content/geometric bounds only, matching WPF behavior. Inflating by GetEffectOutputPadding() caused DrawingImage to shift its coordinate origin by the effect's extent (e.g. a 3.5px shadow offset would displace all content by 3.5px), breaking Should_Render_DrawingGroup_With_Effect render test.
Effects render additively outside the content area and must not affect the coordinate system established by GetBounds().
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com
MrJul added a commit to MrJul/Avalonia that referenced this pull request
add failing test for RenderTargetBitmap_DropShadowEffect
Fix immidiateRenderer with Effect wasn't working as expected
yet another render test
XML comments for newly added members
Address Copilot review
Add another unit test to ensure the recent changes
don't get lost at some point in time
address review
Apply Review suggestion
Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com
inline effectPadding
implement feedback for better bounds handling
Update src/Avalonia.Base/Media/DrawingGroup.cs
Co-authored-by: Copilot 175728472+Copilot@users.noreply.github.com
anohter minor fix
Address PR AvaloniaUI#20790 review comments
Fix RenderDataEffectNode.Bounds to return null when no children exist, preventing empty effect nodes from incorrectly reporting non-null bounds and causing render artifacts due to incorrect dirty rects. Bounds now inflates child bounds by the effect output padding rather than unioning with BoundsRect.
Move effect output padding inflation from callers into DrawingContext implementations (PlatformDrawingContext, RenderDataDrawingContext) so callers pass content bounds to PushEffect and the API handles inflation internally. Remove pre-inflation from ImmediateRenderer.
Fix DrawingGroup.DrawCore to pass effectBounds (inflated) to PushOpacityMask when an Effect is set, so the opacity mask covers the full effect output region (e.g. shadow/blur extending beyond visual bounds).
Fix DrawingGroup.GetBounds to inflate EffectBounds (which now stores content bounds) by the effect output padding.
Fix existing compile error: Rect.IsEmpty() is a method, not property.
Add failing tests for each of the above before fixing.
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
- Fix DrawingGroup.GetBounds() incorrectly inflating bounds with effect output padding
GetBounds() should return content/geometric bounds only, matching WPF behavior. Inflating by GetEffectOutputPadding() caused DrawingImage to shift its coordinate origin by the effect's extent (e.g. a 3.5px shadow offset would displace all content by 3.5px), breaking Should_Render_DrawingGroup_With_Effect render test.
Effects render additively outside the content area and must not affect the coordinate system established by GetBounds().
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
- Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com
Co-authored-by: Copilot Autofix powered by AI 175728472+Copilot@users.noreply.github.com Co-authored-by: Julien Lebosquain julien@lebosquain.net Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
timunie deleted the fix/RTB_ignores_Shadow branch
Jaex mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})