-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[android_camera_camerax] Fix incorrect camera mirroring for front cameras on devices using ImageReader
Impeller backend
#9233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ImageReader
Impeller backendImageReader
Impeller backend
ImageReader
Impeller backendImageReader
Impeller backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look great, thank you! Just added some suggestions for clarity in case someone has to revisit this later :)
|
||
// Since the front camera is in portrait mode, we expect the camera | ||
// preview to be mirrored across the y-axis. | ||
expect(transformedPreviewMatrix.storage[5], closeTo(-1.0, 0.0001)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about creating a helper method for these sorts of checks? Something like checkYAxisIsMirrored(double matrixArg5)
and checkXAxisIsMirrored(double matrixArg0)
with docs for both explaining why this checks what we think? I think this may help for clarity in the future.
|
||
// Since the front camera is in landscape mode, we expect the camera | ||
// preview to be mirrored across the x-axis. | ||
expect(transformedPreviewMatrix.storage[0], closeTo(-1.0, 0.0001)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the closeTo
is because a precision error? If there's no workaround for that, can you add a comment here (or to the helper methods if you're open to adding them) about that?
Fixes the incorrect camera mirroring when the front camera is used on devices that use the
ImageReader
Impeller backend. TLDR: for relevant rotated preview implementation, when the front camera is used, mirror the camera preview across the y-axis when the device is in a portrait orientation or across the x-axis when the device is in a landscape orientation.Fixes flutter/flutter#156974.
cc @jesswrd, co-author of this PR
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3