Repository navigation
perf(composition): Backport scroll-frame damage cost to 6.7 - #24582
Conversation
Backport of the preferBounds guard from master. ContributeDamageOnPaint only early-outs when nothing changed, and during a scroll every visual in the scrolled subtree has moved, so the early-out never fires. Each visual then paid the expensive branch of TryGetPaintDamageRegion on the UI thread - a stroke-to-fill outset plus two path booleans - and the cost scaled with the number of realized visuals, which is exactly the long content-rich list users notice. A visual that only moved is damaged at its old location too, and that one is only ever a rect, so computing exact geometry for the new location buys nothing. Take the bounds branch instead, but only when bounds can actually answer for the visual: falling through to the clip would report a far larger region than the exact path it replaced. TryGetLocalContentBounds is asked directly rather than hand-rolling the condition, since its overrides disagree with the obvious guess (ShapeVisual bounds itself by its shapes without setting PaintsWithinOwnSize). Deliberately excludes the SkiaSharp 4 idioms and the DamageRegion type that landed alongside this on master: 6.7 is on SkiaSharp 3, and neither is needed for the fix. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The per-visual damage union ran SKPath.Op(Union) for every contribution, which is a full path boolean. At ~111 realized visuals a scroll frame paid ~222 of them. DamageRegion keeps the region as a bounded list of rects and only materialises an SKPath once per frame, when the renderer needs one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24582/wasm-skia-net9/index.html |
|
The build 234823 did not find any UI Test snapshots differences. |
|
|
|
/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-24582/wasm-skia-net9/index.html |
|
The build 235288 did not find any UI Test snapshots differences. |
|
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
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-24582/wasm-skia-net9/index.html |
|
The build 235336 did not find any UI Test snapshots differences. |
GitHub Issue: closes #23984
PR Type:
🐞 Bugfix
What changed? 🚀
Backport of the scroll-frame damage work to
release/stable/6.7.6.7regressed against earlier releases on scroll-heavy content: a frame's damage region was accumulated as anSKPathand every contribution went throughSKPath.Op(SKPathOp.Union), a full path boolean. With ~111 realized visuals anItemsRepeaterscroll frame paid ~222 of them.Two commits:
perf(composition): Make scroll-frame damage cheaper for moved visuals— a visual that only moved, with unchanged content, now reports its bounds instead of building and transforming a content path.TryGetPaintDamageRegiontakes apreferBoundshint and skips the analytic path when local bounds are available.perf(composition): Accumulate frame damage as rectangles— introducesDamageRegion, which keeps the frame's damage as a bounded list of rectangles and only materialises anSKPathonce per frame, inSnapshotAndReset, when the renderer needs one. Unioning is now rect arithmetic: a contribution either grows the open rect when that costs no extra area, or closes it and opens a new one, collapsing to overall bounds past a rect cap.SKPath? damagebecomesDamageRegion? damagethroughCompositor,Visual,PaintingSession,Visual.Damage,SkiaRenderHelperandCompositionTarget.Rendering;DamageRegionExtensions.skia.csis superseded and removed.This mirrors what is already on
master. No SkiaSharp bump is needed —SkiaSharpVersionstays at3.119.0. The only 4.x-only idiom in master's version wasSKPathBuilder, replaced here by anSKPathwithWindingfill plus a scratch path for the frame clamp;SKPath.Transform(SKMatrix, SKPath)andSKPaint.GetFillPath(SKPath, SKPath)both exist in 3.119.Measurements
ItemsRepeater+UniformGridLayoutin aScrollViewer, 2800 items, 60 scroll steps of 40px at 16 ms,realized=111. Same machine, same harness, two runs per configuration:masteras-is, for referenceThe first commit alone recovers roughly a third of the gap;
DamageRegionaccounts for the rest and brings6.7to parity withmaster.Validation
Uno.UI.Composition.Skia,Uno.UI.SkiaandSamplesApp.Skia.Generic(net10.0) build clean.Given_Visual_Damagepasses (2/2) on Skia Desktop:When_Ancestor_Clip_Grows_Then_Revealed_Region_Is_DamagedandWhen_Clip_Shape_Changes_Within_Same_Bounds_Then_It_Is_Damaged. The fixture was adapted to the new type, using the sameSnapshotDamagehelpermasteruses.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code