Use exact trig values for rotation transform in OnRotate#169
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the rotation transformation logic in FlutterTizenView::OnRotate by replacing an if-else structure with a switch statement that uses hardcoded matrices for cardinal angles (0, 90, 180, 270). This change aims to improve precision for common rotations. The reviewer suggests normalizing the input degree to the [0, 360) range to ensure that equivalent angles consistently trigger the optimized switch cases rather than falling through to the default trigonometric calculation.
cos/sin of pi multiples leaves ~1e-16 dust on entries that mathematically equal 0 or +-1. The dust scales y=1080 to 1079.99999... and shifts the bottom/right edge by 1 px in rasterizer paths that floor the transformed vertex. SendInitialGeometry calls OnRotate(degree=0) at startup, so non-rotating Skia + GLES apps were also affected and the player overlay (avplay videohole) appeared 1-2 px below adjacent Flutter widgets at the screen's bottom edge. Impeller's GLES backend short-circuits near-identity transforms and did not exhibit the shift. Use exact 0 / +-1 / width / height entries for the cardinal angles (0, 90, 180, 270), and keep the cos/sin computation in the default branch so arbitrary rotation degrees remain supported.
c8de983 to
a1cac9a
Compare
xiaowei-guan
approved these changes
May 12, 2026
xiaowei-guan
approved these changes
May 12, 2026
Contributor
xiaowei-guan
left a comment
There was a problem hiding this comment.
Verified on TV device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cos/sin of pi multiples leaves ~1e-16 dust on entries that mathematically equal 0 or +-1. The dust scales y=1080 to 1079.99999... and shifts the bottom/right edge by 1 px in rasterizer paths that floor the transformed vertex. SendInitialGeometry calls OnRotate(degree=0) at startup, so non-rotating Skia + GLES apps were also affected and the player overlay (avplay videohole) appeared 1-2 px below adjacent Flutter widgets at the screen's bottom edge. Impeller's GLES backend short-circuits near-identity transforms and did not exhibit the shift.
Use exact 0 / +-1 / width / height entries for the cardinal angles (0, 90, 180, 270), and keep the cos/sin computation in the default branch so arbitrary rotation degrees remain supported.
flutter-tizen/flutter-tizen#764