Repository navigation
fix: 竖屏实例的缩略图转正 - #201
Merged
Merged
fix: 竖屏实例的缩略图转正#201
Conversation
竖屏实例的共享内存帧是没转的横画布,缩略图侧着;按配置的方向顺时针转 90°(对应客体 ROTATION_270)。adb screencap 本来就是正的,不动。转失败退回 adb。
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.
竖屏实例的缩略图是侧着的:共享内存拿到的是没转的横画布(1280x720 / 1920x1080),adb screencap 则是按显示方向出的正图。
做法:实例配置为竖屏(
hw.initialOrientation=portrait,客体 user_rotation=3 即 ROTATION_270)时,共享内存帧在 PNG 编码后顺时针转 90°(ROTATION_270 时界面顶边落在画布左边,顺时针转回正)。只转宽大于高的帧;转失败按共享内存失败处理、退回 adb。横屏实例不受影响。已知限制:方向取自配置。运行中用标题栏旋转按钮临时转到横屏时,缩略图会侧一下,直到转回或重开机。
测试:
TestTurnPortrait用不对称的 3x2 图断言顺时针(左上到右上、右上到右下)、尺寸、已是竖图不动、坏数据报错。gofmt、go vet ./...、go test ./... 通过。没有实机测。Refs ModAVD/ModAVD#247