Skip to content

fix(composition): Match WinUI dash and trim semantics - #25202

Merged
MartinZikmund merged 12 commits into
masterfrom
dev/mazi/composition-dash-trim
Oct 15, 2026
Merged

MartinZikmund merged 12 commits into
masterfrom
dev/mazi/composition-dash-trim

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #25199, closes #25200

PR Type:

🐞 Bugfix

What changed? 🚀

This PR makes Composition (and XAML Shape) dashes and trims match real WinUI. Every behaviour was checked against a WinAppSDK 2.4 app: the same scenes rendered on WinUI and on Uno at identical sizes, then pixel-diffed (see the ground-truth table below). The work started from LottieGen output, which renders differently on Uno than on WinUI.

Dashes (#25199)

  1. StrokeDashArray/StrokeDashOffset are absolute in Composition.
    • Uno's strokers multiplied them by StrokeThickness, which is the XAML Shape convention.
    • The strokers are now absolute. Shape and the text decoration dashes scale by thickness themselves, and ManagedSvg no longer divides to compensate. Skia also repeats an odd-length list.
  2. XAML dashes scale by the declared StrokeThickness.
    • Uno used the layout-rounded thickness, so at 250% scale a StrokeThickness="1" dash came out 1.2× too long.
    • WinUI: PopulateCompositionSpriteShape and CDasher::CDashSequence::Set both use the raw thickness.
  3. Dashes with trims.
    • Skia summed the dash and trim path effects, drawing the full dashed path plus a solid trimmed one.
    • WinUI trims first and dashes what is left, with the pattern starting at the trim start. It also runs on across a window that wraps through the origin.
  4. Dash origin.
    • WinUI trims a CompositionEllipseGeometry from 12 o'clock, but starts its dash pattern at 9 o'clock.
    • On a CompositionRoundedRectangleGeometry, trims start where the top-left arc ends; dashes start where it begins.
    • XAML EllipseGeometry starts at 3 o'clock (CEllipseGeometry::VisitSinkInternal), and a rounded XAML Rectangle at its top-left arc.
    • Untrimmed dashed strokes now use a path starting at the WinUI origin. Trims keep theirs.
  5. Arc-length accuracy.
    • Skia lays dashes out on a flattened curve at resolution 1, which measures small arcs short: the pattern drifted about 1px per corner on a rounded rect.
    • Dashed strokes now go through GetFillPath(..., resScale) at 16× the device scale.

Trims (#25200)

  1. TrimEnd defaults to 1.
    • WinUI's runtime reports TrimStart=0, TrimEnd=1, TrimOffset=0 for every geometry type. The Microsoft Learn page says TrimEnd defaults to 0, which is wrong.
    • "Untrimmed" now means the window covers the whole path, so an explicit TrimEnd = 0 (a LottieGen draw-on at frame 0) draws nothing instead of everything.
  2. Reversed windows wrap. With TrimStart > TrimEnd, WinUI draws through the origin even without TrimOffset. Uno drew nothing.
  3. Range. WinUI throws ArgumentException ("Value must be in the range of 0.0f to 1.0f") for TrimStart/TrimEnd outside [0, 1]. Uno now does the same in the setters and clamps animated values.

WinUI ground truth

Scenes were rendered on WinAppSDK 2.4 and on Uno (Skia desktop, 250% scale) in 120×120 cells.

  • before: stock 7.0 dev bits, identical to master for these files.
  • after: this branch.

Values are the % of pixels with no match within 1px (max channel diff ≤ 40) in the other image. This tolerates antialiasing; an untrimmed ring measures 0.11% against WinUI.

Composition ellipse r=44 with dashes {4, 14}, plus other shapes. XAML cells use dashes "4 14" unless noted.

scene before after
comp-dash-t1-o0-Flat 0.82% 0.03%
comp-dash-t1-o0-Round 0.86% 0.02%
comp-dash-t1-o0-Square 0.90% 0.02%
comp-dash-t1-o5-Flat 0.77% 0.02%
comp-dash-t1-o5-Round 0.83% 0.02%
comp-dash-t1-o5-Square 0.87% 0.03%
comp-dash-t6-o0-Flat 4.45% 0.05%
comp-dash-t6-o0-Round 5.90% 0.07%
comp-dash-t6-o0-Square 6.26% 0.07%
comp-dash-t6-o5-Flat 4.13% 0.04%
comp-dash-t6-o5-Round 6.43% 0.08%
comp-dash-t6-o5-Square 6.99% 0.09%
comp-dash-t12-o0-Flat 10.01% 0.08%
comp-dash-t12-o0-Round 13.04% 0.12%
comp-dash-t12-o0-Square 13.43% 0.11%
comp-dash-t12-o5-Flat 7.41% 0.07%
comp-dash-t12-o5-Round 15.19% 0.12%
comp-dash-t12-o5-Square 17.29% 0.16%
comp-dash-rect-t6 4.95% 0.00%
comp-dash-rrect-t6 4.99% 0.03%
comp-dash-line-t6 1.42% 0.00%
comp-dash-trim-0.1-0.6 6.80% 0.02%
comp-dash-trim-0-0.5-o0.3 6.55% 0.03%
comp-dash-oval-t6 4.79% 0.04%
comp-dash-rrect-t6-o9 5.49% 0.02%
comp-trim-rrect-0-0.25 0.03% 0.03%
comp-trim-0.9-0.1-0 3.18% 0.04%
comp-trim-0.2-1.2-0 12.78% 0.00%
comp-trim-neg0.2-0.3-0 4.80% 0.00%
comp-trim-default 0.11% 0.11%
comp-trim-0-0-0 15.96% 0.00%
comp-trim-0-1-0 0.11% 0.11%
comp-trim-0.25-0.25-0 0.00% 0.00%
comp-trim-0.8-0.2-0 6.35% 0.07%
comp-trim-0-0.25-0.5 0.05% 0.05%
comp-trim-0.6-0.9-0.5 0.03% 0.03%
comp-trim-0-0-0.5 0.00% 0.00%
comp-trim-start0.5-only 7.93% 0.08%
comp-trim-0.25-0.75-0 0.08% 0.08%
comp-trim-rect-0-0.25 0.00% 0.00%
comp-trim-anim-end-to-0 15.96% 0.00%
comp-trim-anim-end-to-0.5 0.12% 0.12%
xaml-ellipse-t1-o0 0.89% 0.06%
xaml-ellipse-t1-o0.5 0.90% 0.06%
xaml-ellipse-t6-o0 0.04% 0.03%
xaml-ellipse-t6-o0.5 0.06% 0.03%
xaml-ellipse-t12-o0 0.03% 0.03%
xaml-ellipse-t12-o0.5 0.02% 0.02%
xaml-ellipse-t6-Round 0.05% 0.03%
xaml-ellipse-t6-Square 0.04% 0.02%
xaml-path-t6 4.98% 0.03%
xaml-rect-radius-t3 3.26% 0.50%
xaml-path-oval-t3 2.86% 0.14%
xaml-line-t6-solid 0.28% 0.28%
xaml-rect-radius-t3-solid 1.29% 1.29%
xaml-line-t6-o0.5 0.19% 0.19%

Remaining XAML residuals:

  • xaml-rect-radius-t3 (0.50%): its solid control xaml-rect-radius-t3-solid differs more (1.29%) and equally before and after. The cause is not dashes: Uno insets and strokes by the layout-rounded thickness (3 → 3.2 at 250%), whereas WinUI's CShape::GetOutlineRect uses the raw thickness. Out of scope here.
  • xaml-line-t6-o0.5 (0.19%): matches its solid control xaml-line-t6-solid (0.28%). It's a one-pixel row of stroke placement.

Runtime-probed WinUI defaults:

  • every geometry: TrimStart=0 TrimEnd=1 TrimOffset=0
  • CompositionSpriteShape: StrokeDashCap=Flat, StrokeMiterLimit=1. Uno reports 0 for the miter limit, which is a separate gap.

WinUI source vs runtime: CShape::PopulateCompositionSpriteShape (shape.cpp) passes StrokeDashOffset unscaled. At runtime, though, XAML dash offsets are scaled by thickness (the xaml-ellipse-*-o0.5 cells only match that way), so that WUC shapes path isn't what renders today.

LottieGen: same generated class on Uno vs WinUI

Same metric. The sunrise animation is the original dashed one.

frame before after
sunrise p=0 (halo trim end = 0) 1.28% 0.00%
sunrise p=0.25 / 0.5 / 0.75 (dashed rays) 1.39% / 1.79% / 1.34% 0.00% / 0.00% / 0.00%
sun p=0 1.98% 0.00%
dash r=52, t=6, {4,14} 1.94% 0.00%
dash + offset 9 1.55% 0.00%
dash, thickness 1 0.42% 0.00%

Tests

Runtime tests, run on Skia desktop. Each fails on the commit before its fix and passes after:

  • Given_CompositionSpriteShape:
    • When_StrokeDashArray_Then_Absolute_Units (2 rows)
    • When_Dashed_And_Trimmed_Then_Dashes_Start_At_Trim
    • When_Ellipse_Dashed_Then_Pattern_Starts_At_Nine_OClock
    • When_RoundedRectangle_Dashed_Then_Pattern_Starts_At_Top_Left_Arc
  • Given_CompositionGeometry:
    • When_Default_Trim_Values
    • When_Only_TrimStart_Set_Then_Draws_To_End
    • When_Trim_Window_Is_Empty_Then_Nothing_Drawn
    • When_TrimStart_Greater_Than_TrimEnd_Then_Wraps
    • When_Trim_Out_Of_Range_Then_Throws
  • When_Shape:
    • When_StrokeThickness_Fractional_Then_Dashes_Use_Declared_Thickness
    • When_EllipseGeometry_Dashed_Then_Pattern_Starts_At_Three_OClock
    • When_Rectangle_Rounded_Dashed_Then_Pattern_Starts_At_Top_Left_Arc
    • When_StrokeDashArray_Then_Relative_To_StrokeThickness (a guard that also passes before)

Regression runs, all green except 4 pre-existing failures:

  • the composition and shape suites: 113 passed. Given_Rectangle.When_StrokeThickness_Is_GreaterThan_Or_Equals_Width has 4 rows that fail identically on master at 250% scale.
  • ProgressRing, AnimatedVisuals, AnimatedVisualPlayer, Given_SvgImageSource_ManagedEngine, Given_TextBlock_TextDecorations, the RichEditBox underline styles, Given_Border, Given_Geometry: 146 passed, 0 failed.

PR Checklist ✅

Code that relied on Uno-only behaviour will render differently: thickness-relative Composition dashes, TrimEnd defaulting to 0, or out-of-range trims being accepted. All of these now match WinUI.

🤖 Generated with Claude Code

https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7

@github-actions github-actions Bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Oct 10, 2026
@MartinZikmund
MartinZikmund marked this pull request as ready for review October 10, 2026 21:41
Copilot AI balanced review requested due to automatic review settings October 10, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 20s —— View job


Review of #25202

Verdict: ship. I found no blocking issues and posted no inline comments.

I reviewed this by reading the diff, and I did not build or run any tests. The PR describes runtime results on Skia desktop that I have not reproduced.

Findings by severity: 0 blocking, 0 major, 2 minor (below).

What I checked:

  • Dash units: The strokers now take absolute units. The only other StrokeStyle producers are CompositionSpriteShape.skia.cs:312, ManagedSvg, Shape and UnicodeText. Each now supplies absolute values, and ManagedSvg no longer divides and re-multiplies by the stroke width.
  • XAML Shape: UpdateStrokeThickness, UpdateStrokeDashArray and UpdateStrokeDashOffset all run from UpdateRender. XAML dashes therefore still follow thickness changes, which the new When_Shape guard test covers.
  • Trim logic: The new TryResolveTrim check is consistent with the native-stroking guard. The full-window-under-offset case is handled before wrapping. An explicit TrimEnd = 0 now resolves to an empty window.
  • TrimEnd default: The WinUI evidence is documented in the PR and in the code comment. The behavior change is called out.

Minor, non-blocking:

  • The odd-length repeat logic now exists in three places: ManagedGeometry.NormalizeDashes, the Skia stroker, and CompositionStrokeDashArray.ToEvenArray. CompositionSpriteShape already passes ToEvenArray(), so the Skia and managed copies only matter for other callers such as SVG. A shared helper on StrokeStyle would remove the duplication, but this is not needed to merge.
  • UnicodeText.DrawDashedLine allocates a new float[] per call. This is probably not hot, but caching or stackalloc could be considered if text decorations get drawn heavily.

Process notes: commit messages follow Conventional Commits, and no new warnings or #pragmas were added. The two unchecked checklist items (docs and screenshot compare) are the author's to confirm.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 238853 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • DropDownButtonPage.png-dark
    • Examples.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DynamicFont.png-dark
    • DynamicFont.png
  • skia-windows-screenshots: 2458 changed over 2486

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedBackVisualSourceSamplePage.png
    • AnimatedIconPage.png
    • AppBarToggleButtonTest.png
    • AppBarButtonTest.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppBarButtonTest.png
    • AppWindowPositionAndSize.png-dark
    • AppBarButtonWithIconTest.png-dark
    • ArcSegment.png-dark
    • AppBar_KeyBoard.png
    • Attributed_text_Simple.png-dark
    • AppWindowClosing.png-dark
    • AutoBorderStretchwithbottommargin.png-dark
    • AppWindowPresenters.png
    • AutoBorderStretchwithtopmargin.png
    • Attributed_text_FontSize_Changing.png-dark
    • AutomationProperties_Name.png-dark
    • AuthenticationBroker_Demo.png-dark
    • AutomationProperties_Name.png
    • AuthenticationBroker_Demo.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 238853 has failed on Uno.UI - CI.

Copilot AI balanced review requested due to automatic review settings October 11, 2026 06:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 19s —— View job


Review of #25202

Verdict: ship. I found no blocking issues and posted no inline comments.

I read the current CompositionSpriteShape.skia.cs on the branch. The local checkout has no merge base with origin/master, so I couldn't produce a full diff. I did not build or run any tests.

Findings: 0 blocking, 0 major, 2 minor.

  • Trim resolution. TryResolveTrim now treats any window with TrimEnd - TrimStart >= 1 as untrimmed. This replaces the earlier TrimStart/TrimEnd/TrimOffset == 0 check. I walked through these cases and each resolves correctly:
    • [0,1] draws untrimmed.
    • [0.5,1] resolves to [0.5,1].
    • [0.5,1] with offset 0.5 resolves to [0,0.5].
    • TrimEnd = 0 and TrimStart = TrimEnd resolve to an empty window, so nothing is drawn.
  • Copilot float-equality comments. The exact == 0f comparisons they flagged on TrimOffset are gone from the current code. TryResolveTrim now does no exact float comparison beyond >= 1f, so I'd resolve those threads. Adding an epsilon would be wrong here: a tiny non-zero window is a legitimate trim.
  • Minor: The odd-length dash repeat logic exists in three places: the Skia stroker, ManagedGeometry.NormalizeDashes and CompositionStrokeDashArray.ToEvenArray. A shared helper on StrokeStyle would remove the duplication.
  • Minor: UnicodeText.DrawDashedLine allocates a float[] per call. This is fine unless text decorations are drawn heavily.

CI. The Uno.UI CI build failed, and the screenshot diffs are large: 118 on Linux and 2458 of 2486 on Windows. A change this narrow shouldn't alter nearly every sample, so the Windows number looks like a baseline or infrastructure problem. Please check the build failure and the screenshot comparison before merging. I didn't investigate the failed build log.

The unchecked docs and screenshot-compare checklist items are yours to confirm.

@MartinZikmund MartinZikmund changed the title fix(composition): Absolute StrokeDashArray units and TrimEnd default of 1 fix(composition): Match WinUI dash and trim semantics Oct 11, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@MartinZikmund MartinZikmund added the 7.0 PRs only. For issues, use the Release field. label Oct 11, 2026
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 238892 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DynamicFont.png-dark
    • DynamicFont.png
    • DropDownButtonPage.png-dark
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
  • skia-windows-screenshots: 2458 changed over 2486

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png
    • AnimatedVisualsTestbedPage.png-dark
    • AppBarToggleButtonTest.png
    • Application_DispatcherShutdownMode.png-dark
    • AppWindowPresenters.png-dark
    • AppXamlDefinedResources.png
    • Attributed_text_Simple.png
    • AutoBorderStretchwithbottommargin.png-dark
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoBorderStretchwithtopmargin.png
    • AutoSizedPathCentered.png-dark
    • AutoSizedPathCentered.png
    • AutoSuggestBox_Description.png-dark
    • AutoSuggestBox_Description.png
    • BackGesture.png-dark
    • BackGesture.png
    • Basics.png-dark
    • Basics.png
    • BindableDrawerLayout_ChangePane.png-dark
    • BindableDrawerLayout_ChangePane.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 238892 has failed on Uno.UI - CI.

@morning4coffe-dev morning4coffe-dev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the XAML side against the WinUI source (microsoft-ui-xaml @188f602b2). The rest is not verifiable from this repo.

Matches WinUI source:

  • XAML EllipseGeometry starts at 3 o'clock and winds clockwise: CEllipseGeometry::VisitSinkInternal (dxaml/xcp/core/core/elements/ellipse.cpp, lines 401-448). The new EllipseFigureStart.Right matches. Ellipse already gets 3 o'clock from its Skia oval path.
  • XAML rounded Rectangle starts at the top-left arc: CRectangleGeometry::VisitSinkInternal begins at (X, Y + radiusY) (rectangle.cpp, around lines 850-860). startAtTopLeftArc: true matches. Plain rectangles still start at (X, Y), as in WinUI.
  • XAML dashes scale by the declared thickness: CDasher::CDashSequence::Set multiplies dashes and offset by the pen width (strokefigure.cpp, lines 2291-2300). The pen width is the raw StrokeThickness (shape.cpp, line 29). The Shape.cs change (array and offset times StrokeThickness) matches. The UnicodeText change keeps decoration output the same.
  • Composition dash units are absolute: CShape::PopulateCompositionSpriteShape (shape.cpp, around lines 1667-1676) multiplies the XAML array by thickness before handing it to composition, which only makes sense if composition takes absolute lengths. The ground-truth table's comp-dash-t6-o5 row shows the same thing for the offset.
  • The WUC shapes path is not what ships. Feature_WUCShapes::IsEnabled() returns false in this snapshot (dxaml/xcp/inc/FeatureFlags.h, lines 75-82), and UseWUCShapes is true only for test modes. So shipping XAML shapes go through the software CDasher path. That resolves the discrepancy the PR notes: PopulateCompositionSpriteShape passes the raw offset, which does not affect shipping builds. Caveat: this snapshot may be older than the WinAppSDK 2.4 used for the ground truth.

Not verifiable from this repo (the composition engine ships in the OS; microsoft-ui-xaml has only forward declarations): TrimEnd default 1, trim wrapping, trim-first-then-dash, the dash origin of CompositionEllipseGeometry (9 o'clock) and of CompositionRoundedRectangleGeometry (top-left arc), and the out-of-range ArgumentException. These rest on the PR's runtime probes. I could not reproduce them.

Validation: code review only. I did not build, and I did not run the new runtime tests or the pixel comparisons.

Findings, most severe first:

  1. A test's expected coordinates are probably wrong (medium). When_Rectangle_Rounded_Dashed_Then_Pattern_Starts_At_Top_Left_Arc (When_Shape.cs) assumes the 84px Rectangle is centred in the 100px Grid, which puts the arc start at (10, 30). A Rectangle with explicit Width and Height and default Stretch alignment sits at the origin, which puts the arc start near (2, 22). With that placement, the sample points (10, 27) and (33, 10) fall outside the dash. Please set HorizontalAlignment and VerticalAlignment to Center, or correct the coordinates, and confirm the test fails on master and passes after.

  2. The composition-level semantics rest on probes alone (medium, validation gap). The PR table gives only percentages. Please attach the probe output, or the WinAppSDK and Uno images, for the composition scenes: the 9 o'clock ellipse origin, the rounded-rect origin, trim wrapping, and the TrimEnd default. Without them, reviewers cannot check these against WinUI.

  3. Full-window trim with an offset (low, question). TryResolveTrim treats any window with TrimEnd - TrimStart >= 1 as untrimmed, ignoring TrimOffset. If WinUI's trim-first semantics start the dash pattern at the offset point for a full window, this differs. Did the probes cover a full window with a non-zero offset? If not, add a row.

  4. Per-paint cost (low, question). Dashed strokes now measure at 16x device scale (SkiaGeometrySource2D.Stroke.cs, DashMeasureResolution). Trimmed dashed strokes also compute PathLength and a union for wrapped windows. Neither is cached: GetTrimmedStrokeGeometry runs on every paint. The untrimmed branch also calls dashSource.Transform(_geometryTransform) on every paint, which allocates. Caching it next to _geometryWithTransformations would avoid that. Please measure a dashed, Lottie-heavy scene, or say why the cost is acceptable.

  5. Contract change (note). StrokeStyle.DashArray and DashOffset are now absolute. I found no caller in the composition or Uno.UI source trees that still passes multiples of thickness; ManagedSvg, UnicodeText and Shape were all updated. The breaking-change note is accurate.

MartinZikmund and others added 7 commits October 14, 2026 18:03
WinUI Composition dash intervals and offset are in geometry units; only
XAML Shape.StrokeDashArray/StrokeDashOffset are multiples of
StrokeThickness. The strokers now take absolute values, Shape and the
text decoration dashes scale by thickness themselves, and ManagedSvg no
longer divides to compensate.

Fixes #25199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Composition dashes are absolute; XAML Shape dashes stay relative to
StrokeThickness and follow thickness changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
WinUI reports TrimEnd = 1 at runtime (the docs say 0). Untrimmed now
means the window covers the whole path, so an explicit TrimEnd = 0 (or
any empty window) draws nothing instead of the full path.

Fixes #25200

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
WinUI wraps a trim window whose start is past its end through the path
origin even when TrimOffset is 0, and throws ArgumentException for a
TrimStart/TrimEnd outside [0, 1]. Animated values are clamped instead.

Refs #25200

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
Skia summed the dash and trim effects, drawing the full dashed path plus
a solid trimmed one. WinUI trims first and dashes what is left, the
pattern starting at the trim start and running on across a wrap.

Refs #25199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
MartinZikmund and others added 5 commits October 14, 2026 18:03
WinUI trims a CompositionEllipseGeometry from 12 o'clock but starts its
dash pattern at 9 o'clock, and starts a rounded rectangle's pattern where
the top-left arc begins. Untrimmed dashed strokes now use a path that
starts there. Skia also measures dashed curves at a finer resolution, as
the default one comes out short on small arcs and shifts the pattern.

Refs #25199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
XAML dashes scale by the declared StrokeThickness, not the layout-rounded
one. EllipseGeometry starts at 3 o'clock and a rounded Rectangle where
its top-left arc begins, as on WinUI, which is where dashes start. The
managed backend still recognises that rounded rectangle analytically.

Refs #25199

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013yZfe9CjkLZqGRwjwfXyQ7
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/composition-dash-trim branch from 422c312 to d1d5380 Compare October 14, 2026 16:05
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 21s —— View job


Review of #25202 (update after new commits)

Verdict: ship, with one open question for the author. I found no blocking issues. I read the diff only. I did not build or run tests, so the runtime and pixel-diff results in the PR description are unverified by me.

Findings: 0 blocking, 0 major, 2 minor.

Trim resolution. TryResolveTrim now returns "untrimmed" only when TrimEnd - TrimStart >= 1. The native-stroking guard reuses it, and an explicit TrimEnd = 0 resolves to an empty window. This is consistent with the stated WinUI defaults of TrimStart=0, TrimEnd=1. It also removes the exact float == 0f comparisons that the code-quality bot flagged. Adding an epsilon there would be wrong, because a tiny non-zero window is a valid trim.

Dashed and trimmed strokes. GetTrimmedDashedStrokeGeometry trims first and dashes the result. For a wrapped window it offsets the head segment's dash by the tail's PathLength, so the pattern continues across the origin. That matches the described WinUI behavior.

Earlier review comment on the rounded-rectangle test. An earlier review said When_Rectangle_Rounded_Dashed_Then_Pattern_Starts_At_Top_Left_Arc assumes a centred Rectangle, and that it would sit at the origin instead. I don't think that holds. In WinUI and Uno, a FrameworkElement with explicit Width/Height and Stretch alignment is centred in its slot. So the 84px Rectangle in a 100px Grid sits at offset 8, and the arc start is at (10, 30) as the test assumes. Setting Center explicitly would still make the intent clearer, but it isn't needed for correctness.

Minor, non-blocking

  • Per-paint allocation: On the untrimmed dashed path, GetTrimmedStrokeGeometry calls dashSource.Transform(_geometryTransform) on every paint. Dashed trimmed strokes also recompute PathLength and a union on every paint. Caching next to _geometryWithTransformations would avoid this. It is worth a quick measurement on a dashed Lottie scene, but it shouldn't block the merge.
  • Duplicated odd-length dash repeat: The logic now lives in the Skia stroker, ManagedGeometry.NormalizeDashes and CompositionStrokeDashArray.ToEvenArray. A single helper on StrokeStyle would remove the copies.

Open question for the author: Do the WinUI probes cover a full trim window (TrimEnd - TrimStart >= 1) with a non-zero TrimOffset? The code treats it as untrimmed and starts the dash pattern at the path origin. If WinUI starts the pattern at the offset point instead, this differs. If it isn't covered, a probe row would settle it.

Not verified

  • CI and screenshots: The Uno.UI CI build failed. The screenshot diffs are large: 118 on Linux and 2458 of 2486 on Windows. A change this narrow shouldn't touch nearly every sample, so I suspect a baseline or infrastructure issue, but I did not investigate the build log. Please check both before merging.
  • WinUI parity: The composition-level semantics (the TrimEnd default, wrapping, the 9 o'clock and top-left-arc dash origins, and the range exception) can only be confirmed from the author's WinAppSDK probes. Attaching the probe output or images would help reviewers.
  • Checklist: The docs and screenshot-compare checklist items are still unchecked.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 239524 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • Examples.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • DropDownButtonPage.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_Enumeration.png-dark
    • DisplayInformation.png-dark
  • skia-windows-screenshots: 2458 changed over 2488

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Accessibility_ScreenReader.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png
    • AppWindowTitleBar Properties.png
    • Attributed_text_Simple.png
    • AuthenticationBroker_Demo.png
    • AutoBorderStretchwithtopmargin.png-dark
    • AutomationProperties_Relations.png
    • AutoSizedPathCentered.png
    • AutoSizedTopLeft.png-dark
    • BadgeNotificationTests.png-dark
    • BadgeNotificationTests.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BitmapIcon_Foreground.png-dark
    • BitmapIcon_Foreground.png
    • BorderVersusPanelClipping.png-dark
    • BorderVersusPanelClipping.png
    • Border_Clipped_Change_Property.png-dark
    • Border_Clipped_Change_Property.png

@MartinZikmund
MartinZikmund merged commit c3f2fa1 into master Oct 15, 2026
51 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/composition-dash-trim branch October 15, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7.0 PRs only. For issues, use the Release field. area/skia ✏️ Categorizes an issue or PR as relevant to Skia

Projects

None yet

5 participants