mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
feat: stretch 16:9 games to screens wider than 16:9 too (#1558)
* feat: stretch 16:9 games to screens wider than 16:9 too * fix: don't offer 16:9 game fit while the session follows the screen
This commit is contained in:
1 parent
411fda343a
commit
10fe5c5f77
5 files changed
+20
-7
No files matched your search
@@ -79,5 +79,5 @@ object SessionDisplay {
|
||||
}
|
||||
|
||||
fun canStretch16x9(size: Pair<Int, Int>): Boolean =
|
||||
(size.second * 16 + 4) / 9 / 2 * 2 > size.first
|
||||
(size.second * 16 + 4) / 9 / 2 * 2 > size.first || (size.first * 9 + 8) / 16 / 2 * 2 > size.second
|
||||
}
|
||||
@@ -221,7 +221,8 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
}
|
||||
if (s.stretch16x9 != null && (com.droiddeck.launcher.session.SessionDisplay.canStretch16x9(s.panelSize) ||
|
||||
com.droiddeck.launcher.session.SessionDisplay.canStretch16x9(displaySize))) {
|
||||
val canStretch = com.droiddeck.launcher.session.SessionDisplay.canStretch16x9(displaySize)
|
||||
val canStretch = s.resolution != com.droiddeck.launcher.session.SessionDisplay.FOLLOW_SCREEN &&
|
||||
com.droiddeck.launcher.session.SessionDisplay.canStretch16x9(displaySize)
|
||||
ChoiceRow(host, "game-fit", stringResource(R.string.display_game_fit),
|
||||
stringResource(if (canStretch) R.string.display_game_fit_hint else R.string.display_game_fit_unavailable),
|
||||
listOf(false to stringResource(R.string.display_preserve), true to stringResource(R.string.display_stretch)),
|
||||
|
||||
@@ -2003,7 +2003,7 @@
|
||||
<string name="display_resolution">Resolution</string>
|
||||
<string name="display_game_fit">16:9 game fit</string>
|
||||
<string name="display_game_fit_hint">How 16:9 games fit this display. Next session.</string>
|
||||
<string name="display_game_fit_unavailable">Choose Match screen or a custom size narrower than 16:9.</string>
|
||||
<string name="display_game_fit_unavailable">Choose Match screen or a custom size that isn\'t 16:9.</string>
|
||||
<string name="display_preserve">Keep proportions</string>
|
||||
<string name="display_stretch">Stretch to display</string>
|
||||
<string name="display_image_scaling">Image scaling</string>
|
||||
|
||||
@@ -96,7 +96,10 @@ class SessionDisplayTest {
|
||||
@Test fun gameStretchAvailabilityMatchesTheRuntimeIncludingRounding() {
|
||||
assertTrue(SessionDisplay.canStretch16x9(960 to 720))
|
||||
assertFalse(SessionDisplay.canStretch16x9(1280 to 720))
|
||||
assertFalse(SessionDisplay.canStretch16x9(1600 to 720))
|
||||
assertTrue(SessionDisplay.canStretch16x9(1600 to 720))
|
||||
assertTrue(SessionDisplay.canStretch16x9(2400 to 1080))
|
||||
assertFalse(SessionDisplay.canStretch16x9(1920 to 1080))
|
||||
assertFalse(SessionDisplay.canStretch16x9(1366 to 768))
|
||||
val wide = SessionDisplay.resolve(1440 to 1080, 0, SessionPrefs.SHAPE_WIDE)
|
||||
assertFalse(SessionDisplay.canStretch16x9(wide))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user