-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced Clipping and Rendered Visuals Tracking in ServerCompositionVisual #12568
Enhanced Clipping and Rendered Visuals Tracking in ServerCompositionVisual #12568
Conversation
In addition, the ServerCompositionVisual now tracks changes to the clip property, allowing for re-calculation when the clip is altered.
…d added relevant unit tests in CompositorInvalidationClippingTests. The new tests ensure that visuals that are not in dirty rect are rendered correctly with different ClipToBounds and Clip geometry parameters.
You can test this PR using the following package version. |
@@ -2,5 +2,7 @@ namespace Avalonia.Rendering.Composition; | |||
|
|||
internal interface ICompositionTargetDebugEvents | |||
{ | |||
public int RenderedVisuals { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove public
Please address that "remove public" comment. Otherwize LGTM |
…als property in the ICompositionTargetDebugEvents interface.
@dotnet-policy-service agree company="JetBrains GmbH" |
You can test this PR using the following package version. |
…to fixes/clip-bounds-invalidate
You can test this PR using the following package version. |
What does the pull request do?
This PR enhances the clipping calculation within the
ServerCompositionVisual
by takingClip.Bounds
into account. The primary goal is to ensure that visuals, which are not within a dirty rect, are not re-rendered when differentClipToBounds
andClip
geometry parameters are set.What is the current behavior?
Currently,
ServerCompositionVisual.Render
method do nothing if boundaries of the visual do not intersect withDirtyRect
. This approach effectively minimizes the areas of the scene redrawn, especially when a single element is invalidated. However, this optimization is only effective whenClipToBounds=true
. While havingClipToBounds=false
but setting an explicitClip
is valid, it's not considered in the current implementation.What is the updated/expected behavior with this PR?
After this PR, the
ServerCompositionVisual
will also consider changes to theClip
property, allowing it to recalculate when the clip is altered. This ensures accurate rendering even whenClipToBounds=false
but an explicitClip
is set.How was the solution implemented (if it's not obvious)?
Clip.Bounds
was considered in the clipping calculation withinServerCompositionVisual
.CompositorInvalidationClippingTests
to verify the correct rendering of visuals not in the dirty rect with differentClipToBounds
andClip
geometry parameters.ServerCompositionVisual
was introduced.Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues