Skip to content

Fix rotate effect merging for OpenSwiftUI renderer#879

Merged
Kyle-Ye merged 2 commits into
mainfrom
optimize/osui_rotate
May 27, 2026
Merged

Fix rotate effect merging for OpenSwiftUI renderer#879
Kyle-Ye merged 2 commits into
mainfrom
optimize/osui_rotate

Conversation

@Kyle-Ye
Copy link
Copy Markdown
Member

@Kyle-Ye Kyle-Ye commented May 27, 2026

Close #878

Agent Summary

This updates display-list transform merging so 2D rotation effects are folded into the accumulated affine transform path, while projection and 3D rotation effects only require item-level rendering when they are non-identity.

It also restores the rotate-related UI snapshot suites for the OpenSwiftUI renderer:

  • RotationEffectUITests
  • Rotation3DEffectUITests
  • ZStackIndexUITests.rotateOverlap

The previous merge behavior could leave rotate effects on the renderer-backed path with an incorrect view hierarchy. This keeps the affine transform state updated for 2D rotation and re-enables the matching UI coverage.

Validation

  • xcrun swift build --target OpenSwiftUICore

@Kyle-Ye
Copy link
Copy Markdown
Member Author

Kyle-Ye commented May 27, 2026

/uitest

@github-actions github-actions Bot added area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. area: tests Test suites, UI tests, fixtures, snapshots, and test support code. impact: visual-diff Visual mismatch, screenshot diff, or rendering fidelity issue. type: bug Something is not working correctly. labels May 27, 2026
@Kyle-Ye Kyle-Ye marked this pull request as ready for review May 27, 2026 17:10
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 27, 2026

🤖 Augment PR Summary

Summary: Fixes display-list transform merging so 2D rotations are accumulated into the affine state for the OpenSwiftUI renderer.
Changes: Non-identity projection/3D rotations now render via item-level projection views and the rotate snapshot UITest suites are re-enabled.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

state.transform = transform.concatenating(state.transform)
if let affineTransform = transform.affineTransform {
state.transform = affineTransform.concatenating(state.transform)
state.adjust(for: affineTransform)
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 27, 2026

Choose a reason for hiding this comment

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

transform.affineTransform now includes .rotation, so state.adjust(for:) will run for arbitrary rotation matrices. adjust(for:) derives a scale factor from CGSize(width: 1, height: 1).applying(transform).width, which can be 0/negative for pure rotations (e.g. 45°/90°) and may blow up/flip inherited shadow/blur radii.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.95%. Comparing base (1cb2809) to head (4c634be).

Files with missing lines Patch % Lines
...Core/Render/DisplayList/DisplayListViewModel.swift 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #879      +/-   ##
==========================================
- Coverage   26.95%   26.95%   -0.01%     
==========================================
  Files         678      678              
  Lines       47146    47139       -7     
==========================================
- Hits        12706    12704       -2     
+ Misses      34440    34435       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye Kyle-Ye merged commit bc26339 into main May 27, 2026
11 checks passed
@Kyle-Ye Kyle-Ye deleted the optimize/osui_rotate branch May 27, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: rendering DisplayList, render backends, renderer hosts, drawing, and effects. area: tests Test suites, UI tests, fixtures, snapshots, and test support code. impact: visual-diff Visual mismatch, screenshot diff, or rendering fidelity issue. type: bug Something is not working correctly.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rotated view hierarchy is incorrect in OpenSwiftUI View Renderer

1 participant