Repository navigation
fix(composition): Repaint RedirectVisual and stop Lottie clearing the frame - #24194
Conversation
|
Claude finished @MartinZikmund's task in 5m 20s —— View job Review completeVerdict: ship — 1 minor finding (non-blocking).
SummaryBoth fixes are correct root-cause resolutions. The coordinate-space math in
Tests — Both new tests follow the existing patterns in their respective files; the damage-bounds assertions are tight enough to catch fallback-to-whole-surface regressions. One minor gap (see inline): Edge-case note (not blocking): In |
There was a problem hiding this comment.
Pull request overview
This PR fixes two Skia compositor regressions affecting the SamplesApp Microsoft.UI.Composition / RedirectVisual sample: (1) RedirectVisual not reporting paint/damage correctly (leading to blank/frozen redirected content), and (2) Skia Lottie rendering clearing the recorded frame (punching a “hole” through background content).
Changes:
- Adjust
RedirectVisualSkia damage/bounds reporting by treating a non-nullSourceas paintable and computing subtree content bounds in the correct coordinate space. - Introduce
Visual.TryGetSubtreeContentBoundsInRootto compute painted subtree bounds in root coordinates for tighter damage regions. - Remove
SKCanvas.Clearfrom Skia Lottie rendering path and add runtime tests covering both regressions.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Composition/Given_Visual_Damage.cs | Adds a runtime test ensuring RedirectVisual reports damage every frame in its own region. |
| src/Uno.UI.RuntimeTests/Tests/Microsoft_UI_Xaml_Controls/Given_AnimatedVisualPlayer.cs | Adds a runtime test ensuring production Lottie rendering doesn’t introduce transparent “holes” through an opaque background. |
| src/Uno.UI.Composition/Composition/Visual.Damage.skia.cs | Adds TryGetSubtreeContentBoundsInRoot to compute subtree-painted bounds in root coordinates. |
| src/Uno.UI.Composition/Composition/RedirectVisual.skia.cs | Fixes RedirectVisual paintability and local content bounds calculation based on the redirected subtree. |
| src/AddIns/Uno.UI.Lottie/LottieVisualSource.skia.cs | Removes frame-clearing during Lottie rendering to preserve already-painted pixels behind the player. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24194/wasm-skia-net9/index.html |
|
The build 230066 found UI Test snapshots differences: Details
|
ae893ae to
7868deb
Compare
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24194/wasm-skia-net9/index.html |
|
The build 231043 found UI Test snapshots differences: Details
|
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
RedirectVisual.CanPaint() delegated to its Source, but an element's visual is usually a plain ContainerVisual that leaves the painting to its children, so the redirect reported that it painted nothing. TryGetLocalContentBounds then sized its content to an empty rect and no damage was ever reported for the region it mirrors into: the redirected content appeared only on a full repaint (a window resize) and never followed the source afterwards. This was latent until the ported AnimatedVisualPlayer started clipping its animated visual, which had been over-damaging the whole frame and hiding it. Report the redirect as painting whenever it has a Source, and bound its damage to the source subtree measured in the source parent's space, which is what RenderRootVisual maps into the redirect's local coordinates. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SMoHqSCNVaS4na2bEk1DCJ
The Skia Lottie visual renders through an SKCanvasElement, so its canvas is the frame being recorded rather than a private surface. Clearing it to transparent therefore blended with Src over everything already painted underneath, punching the animation's box through the app background: black on Win32, and the white page behind the canvas in a browser. The renderer already clears the frame before the visual tree is drawn, and master's Skia path never cleared here either. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SMoHqSCNVaS4na2bEk1DCJ
Left >= 90 bounded the damage instead of proving it reached x=100..150, so it belongs with the over-damage check, not the coverage one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Fix9QXTPgXQKcsfzxBvfsf
An #if around [Ignore] is the one form our own runtime-test conventions tell us not to use; RuntimeTestPlatforms.Skia says the same thing without a compile-time branch. The bodies keep their #if, as the damage helpers only exist on Skia. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Fix9QXTPgXQKcsfzxBvfsf
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Fix9QXTPgXQKcsfzxBvfsf
7791dfb to
8a85f4f
Compare
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24194/wasm-skia-net9/index.html |
|
The build 231142 found UI Test snapshots differences: Details
|
|
|
The ms-appdata load intermittently never completes on the Android Skia runtime-test host: the test starts, then 30 seconds of total silence follow with no ImageOpened, no ImageFailed and no exception, until the inner WaitAsync trips. That is the same signature already tracked for the Linux hosts in #23967, which the existing exclusion covers. #24215 already excluded SkiaAndroid for this test, but gated behind RUNTIME_NATIVE_AOT while investigating #24271. The hang is not specific to NativeAOT -- it reproduces on the plain Android Skia leg -- so the exclusion is un-gated here rather than duplicated, and #24271 is kept in the comment. The test only began running on Android at all once #24003 aligned shard 0's UITEST_RUNTIME_TEST_GROUP_COUNT (4 -> 5, 005db43): selection is a stable hash modulo that count, so before the fix When_MsAppData was one of the 14.7% of methods no shard selected. It is not a new failure, just a newly executed one. Since that merge it has failed on three unrelated PR builds within hours of each other -- 231145 (#24186), 231142 (#24194) and 231152 (#19083) -- where the isolated retry only sometimes recovers, so it reddens whichever PR happens to be unlucky. master still carries the old count of 4 and therefore never runs it. Scoped to this test alone: When_MsAppData_StreamDisposed_FileNotLocked and When_Exif_Rotated_MsAppData use the same ms-appdata path and run green on Android in every post-fix build checked, so they keep running. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015Lk1RUZfAj6A7xGWzYaoBw
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24194/wasm-skia-net9/index.html |
|
The build 231377 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: closes #24193
PR Type:
🐞 Bugfix
What changed? 🚀
The
Microsoft.UI.Composition / RedirectVisualsample regressed on this branch: the redirected column stayed blank (and, once a window resize forced it to appear, froze on a single frame), and the Lottie animation next to it painted on an opaque rectangle instead of the app background. Two independent defects, both on the Skia compositor.1. A
RedirectVisualnever damaged the region it paintsRedirectVisual.CanPaint()delegated to itsSource. An element's visual is normally a plainContainerVisualthat leaves the painting to its children, so the redirect answered "I paint nothing".Visual.TryGetLocalContentBoundsthen sized its content to an empty rect,TryGetPaintDamageRegionbailed out, and the region the redirect actually draws into was never reported as damaged — it only ever showed up on a full repaint, and never followed its source afterwards.This is latent on
masteras well. There, the Lottie render surface was an unclipped child element whose own damage covered the whole frame, which incidentally repainted the redirect every frame. The portedAnimatedVisualPlayernow clips its animated visual (m_rootVisual.Clip = compositor.CreateInsetClip()), so the frame is no longer over-damaged and the defect surfaced.RedirectVisual.CanPaint()now reports painting whenever there is aSource.RedirectVisual.TryGetLocalContentBoundsreports the source subtree's bounds measured in the source parent's coordinate space — exactly whatVisual.RenderRootVisualmaps into the redirect's local space — so the damage stays tight instead of falling back to the whole clip.Visual.TryGetSubtreeContentBoundsInRoothelper, factored from the existing own-plus-descendants bounds logic used by the drop-shadow silhouette walk.2. The Skia Lottie visual cleared the frame behind the player
LottieVisualSource's Skia path calledcanvas.Clear(SKColors.Transparent)insideSKCanvasElement.RenderOverride. That canvas is the frame being recorded, not a private surface, so the clear blended withSrcover everything already painted underneath and punched the animation's box through the app background — black on Win32, and the white page behind the canvas in a browser. The renderer already clears the frame before the visual tree is drawn, andmaster's Skia Lottie path never cleared here either.Validation
Given_Visual_Damage,Given_RedirectVisualandGiven_AnimatedVisualPlayerare green (32/32).masterbuild of the same sample side by side.Windows_UI_Composition,Microsoft_UI_Xaml_Controls,Windows_UI_Xaml_Controls,Windows_UI_Xaml_MediaandWindows_UI_Xaml_Shapes— 2754 passed, 67 failed, 73 skipped. The same test classes on a baseline build of55f41a366e(this branch's tip before the change) fail 68. The two failure sets differ only in clipboard- and context-menu-dependentGiven_TextBoxcases, whose membership shuffles on every local run; the remaining failures are identical on both sides and are DPI-scaling layout assertions specific to this machine (Expected:<193>. Actual:<192.8>). No Composition, rendering or Lottie failures on either side.wasm-toolsworkload is not installed on this machine); both root causes are in shared Skia code and the browser symptoms are the same defects with a white page behind the canvas instead of a black window.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
https://claude.ai/code/session_01SMoHqSCNVaS4na2bEk1DCJ