Commit 3d1a254
Fix transformation matrix calculation and layout (#127)
The CL fixes the following issues:
- Transformation matrix calculation
When calculating transformation, we need to take sensor orientation into
consideration. The first step of the calculation tries to resize the
rectangle back to its original buffer dimensions. However it falsely
assumes that the buffer dimensions are (preview height, preview width)
(i.e., buffer is rotated by 90/270 degrees).
Another bug happens when scaling the rectangle down/up so that it just
covers the viewfinder. It falsely assumes that viewWidth is the longer
edge and viewHeight is the shorter edge. This causes the preview to be
potentially scaled up too large, leading to a "zoom-in" effect.
- Landscape layout
When texture view is able to fill most of the screen, the control layout
will be squished to a point the width becomes too small to make the
shutter button visible.
Test: Tested this on a Chromebook and Google Pixel 31 parent 6455bb6 commit 3d1a254
2 files changed
Lines changed: 15 additions & 8 deletions
File tree
- Camera2BasicJava/Application/src/main
- java/com/example/android/camera2basic
- res/layout-land
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
745 | 745 | | |
746 | 746 | | |
747 | 747 | | |
748 | | - | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
749 | 754 | | |
750 | 755 | | |
751 | 756 | | |
| 757 | + | |
752 | 758 | | |
753 | 759 | | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
754 | 763 | | |
755 | | - | |
756 | | - | |
| 764 | + | |
| 765 | + | |
757 | 766 | | |
| 767 | + | |
758 | 768 | | |
759 | 769 | | |
760 | 770 | | |
| |||
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
0 commit comments