Repository navigation
Description
Current behavior
When an element has both RenderTransformOrigin set on it and a CompositeTransform as its RenderTransform, the origin is silently dropped for the Rotation and Skew components. Only Scale is properly anchored on the origin. As a result, any rotation or skew driven by CompositeTransform pivots around the wrong point.
This is most visible on Skia targets (Desktop, WASM-Skia, mobile-Skia) and native Android, because both backends bake the resulting matrix into the rendering pipeline. The native iOS, native macOS, and native WASM backends are unaffected because they apply the origin separately (via CALayer.AnchorPoint and CSS transform-origin respectively).
Repro
<Rectangle Width="14" Height="200" RenderTransformOrigin="0.5,1">
<Rectangle.RenderTransform>
<CompositeTransform /> <!-- Rotation is set in code-behind -->
</Rectangle.RenderTransform>
</Rectangle>In WinUI the rectangle rotates around its bottom-center (the bottom of the hand of an analog clock). On Uno Skia / native Android the rectangle rotates around (0, 0) and lands in the wrong place — clock hands no longer line up with the dial.
A real-world reproduction app: the user's nightstand-clock where the same XAML works on WinUI but visibly misaligns the clock hands on every Uno backend that uses the matrix path.
Expected behavior
Match WinUI: the entire CompositeTransform should be anchored on the element's RenderTransformOrigin, additively with the transform's own CenterX/CenterY. The same XAML should produce identical visuals on WinUI and Uno.
How it can be fixed
CompositeTransform.ToMatrix(absoluteOrigin) (src/Uno.UI/UI/Xaml/Media/CompositeTransform.cs) computes a combined center but only passes it to the Scale sub-transform; Skew and Rotate use the raw CenterX/CenterY. Routing the combined center into all three matches WinUI's CompositeTransform.cpp order (Translate(-C) * Scale * Skew * Rotate * Translate(C+t)), which is mathematically equivalent to the per-sub Translate_centered form Uno uses when all three sub-transforms share the same effective center.
The local variable name (centerX) was case-only different from the property (CenterX), which is partly why the bug was not noticed during code review.
Affected backends
| Backend | Affected | Why |
|---|---|---|
| Skia (all OSes) | Yes | Visual.TransformMatrix is set from Transform.ToMatrix(origin, size) |
| Native Android | Yes | View matrix is set from Transform.ToMatrix(origin, size) |
| Native iOS / macOS | No | CALayer.AnchorPoint applies origin separately |
| Native WASM | No | CSS transform-origin applies origin separately |
Environment
- Uno Platform 6.4 (dev)
- Skia Desktop, native Android
Activity