[chromecast] Update Display Rotation Transform
The primary display rotation transforms for 90, 180, and 270 degree rotations have been updated so that located events are properly transformed to the new correct location after being subjected to the inverse root transform. The inverse root transform is used to take the (x, y) reported for a given located event and transform it to a new (x', y') to align properly with the transformation applied to the display graphics. Take the case of a display with the following characteristics: Height = 720 Width = 1280 Under the current case, the inverse root transforms are as follows: 90deg = [0, 1, 0, 0; -1, 0, 0, 720; 0, 0, 1, 0; 0, 0, 0, 1] 180deg = [-1, 0, 0, 720; 0, -1, 0, 1280; 0, 0, 1, 0; 0, 0, 0, 1] 270deg = [0, -1, 0, 1280; 1, 0, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1] With the applied change, the inverse root transforms become: 90deg = [0, 1, 0, 0; -1, 0, 0, 719; 0, 0, 1, 0; 0, 0, 0, 1] 180deg = [-1, 0, 0, 719; 0, -1, 0, 1279; 0, 0, 1, 0; 0, 0, 0, 1] 270deg = [0, -1, 0, 1279; 1, 0, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1] To see that these new transformations are correct, take the 270 degree rotation case and consider the corner points of the display. The corner point transformations under the old and updated transforms are: Old (0,0)-->(1280,0) (719,0)-->(1280,719) (0,1279)-->(1,0) (719,1279)-->(1,719) New (0,0)-->(1279,0) (719,0)-->(1279,719) (0,1279)-->(0,0) (719,1279)-->(0,719) The old transformations take the corner points and incorrectly update them, even outside of bounds for events at (0,0) and (719,0). The new transformations properly map all corner points. The same behavior can be observed for 90 and 180 degree rotations as well. BUG=None TEST=Check on devices with 90, 180, and 270 degree rotations Change-Id: I2d56cf1a4e871d3a08a886bc218fff7262157b73 Reviewed-on: https://chromium-review.googlesource.com/982373Reviewed-by:Sergey Volk <servolk@chromium.org> Reviewed-by:
Michael Spang <spang@chromium.org> Commit-Queue: Cody Peterson <crpeterson@chromium.org> Cr-Commit-Position: refs/heads/master@{#551372}
Showing
Please register or sign in to comment