Skip to content

Use exact trig values for rotation transform in OnRotate#169

Merged
JSUYA merged 1 commit into
flutter-tizen:masterfrom
JSUYA:fix/onrotate-identity-matrix
May 12, 2026
Merged

Use exact trig values for rotation transform in OnRotate#169
JSUYA merged 1 commit into
flutter-tizen:masterfrom
JSUYA:fix/onrotate-identity-matrix

Conversation

@JSUYA
Copy link
Copy Markdown
Member

@JSUYA JSUYA commented May 12, 2026

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

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread flutter/shell/platform/tizen/flutter_tizen_view.cc Outdated
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.
@JSUYA JSUYA force-pushed the fix/onrotate-identity-matrix branch from c8de983 to a1cac9a Compare May 12, 2026 05:29
Copy link
Copy Markdown
Contributor

@xiaowei-guan xiaowei-guan left a comment

Choose a reason for hiding this comment

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

Verified on TV device

@JSUYA JSUYA merged commit 611e934 into flutter-tizen:master May 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants