mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Add --render-fit=stretched
Add an option to fit the window without preserving the aspect ratio.
This commit is contained in:
parent
95d6658b4e
commit
05f2ee4fbd
6 changed files with 24 additions and 4 deletions
|
|
@ -179,7 +179,7 @@ _scrcpy() {
|
|||
return
|
||||
;;
|
||||
--render-fit)
|
||||
COMPREPLY=($(compgen -W 'letterbox disabled' -- "$cur"))
|
||||
COMPREPLY=($(compgen -W 'letterbox stretched disabled' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--shortcut-mod)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ arguments=(
|
|||
'--record-format=[Force recording format]:format:(mp4 mkv m4a mka opus aac flac wav)'
|
||||
'--record-orientation=[Set the record orientation]:orientation values:(0 90 180 270)'
|
||||
'--render-driver=[Request SDL to use the given render driver]:driver name:(direct3d opengl opengles2 opengles metal software)'
|
||||
'--render-fit=[Set the render-fit mode]:mode:(letterbox disabled)'
|
||||
'--render-fit=[Set the render-fit mode]:mode:(letterbox stretched disabled)'
|
||||
'--require-audio=[Make scrcpy fail if audio is enabled but does not work]'
|
||||
{-s,--serial=}'[The device serial number \(mandatory for multiple devices only\)]:serial:($("${ADB-adb}" devices | awk '\''$2 == "device" {print $1}'\''))'
|
||||
{-S,--turn-screen-off}'[Turn the device screen off immediately]'
|
||||
|
|
|
|||
|
|
@ -518,9 +518,10 @@ Supported names are currently "direct3d", "opengl", "opengles2", "opengles", "me
|
|||
.BI "\-\-render\-fit " mode
|
||||
Set the render-fit mode to configure how the rendering fits the window.
|
||||
|
||||
Possible values are "letterbox" and "disabled":
|
||||
Possible values are "letterbox", "stretched" and "disabled":
|
||||
|
||||
- "letterbox": preserve the aspect ratio and fit the window as best as possible (black bars are added either at the top and bottom or at the sides if needed).
|
||||
- "stretched": fit the window without preserving the aspect ratio.
|
||||
- "disabled": render the display at the top-left corner, without scaling.
|
||||
|
||||
Default is "letterbox", unless --flex-display is set, in which case it is "disabled".
|
||||
|
|
|
|||
|
|
@ -784,10 +784,13 @@ static const struct sc_option options[] = {
|
|||
.argdesc = "mode",
|
||||
.text = "Set the render-fit mode to configure how the rendering fits "
|
||||
"the window.\n"
|
||||
"Possible values are \"letterbox\" and \"disabled\".\n"
|
||||
"Possible values are \"letterbox\", \"stretched\" and "
|
||||
"\"disabled\".\n"
|
||||
"\"letterbox\": preserve the aspect ratio and fit the window "
|
||||
"as best as possible (black bars are added either at the top "
|
||||
"and bottom or at the sides if needed).\n"
|
||||
"\"stretched\": fit the window without preserving the aspect "
|
||||
"ratio.\n"
|
||||
"\"disabled\": render the display at the top-left corner, "
|
||||
"without scaling.\n"
|
||||
"Default is \"letterbox\", unless --flex-display is set, in "
|
||||
|
|
@ -2350,6 +2353,11 @@ parse_render_fit(const char *optarg, enum sc_render_fit *mode) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(optarg, "stretched")) {
|
||||
*mode = SC_RENDER_FIT_STRETCHED;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(optarg, "disabled")) {
|
||||
*mode = SC_RENDER_FIT_DISABLED;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@ enum sc_shortcut_mod {
|
|||
enum sc_render_fit {
|
||||
SC_RENDER_FIT_AUTO,
|
||||
SC_RENDER_FIT_LETTERBOX,
|
||||
SC_RENDER_FIT_STRETCHED,
|
||||
SC_RENDER_FIT_DISABLED,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,16 @@ compute_content_rect(struct sc_size render_size, struct sc_size content_size,
|
|||
return;
|
||||
}
|
||||
|
||||
if (render_fit == SC_RENDER_FIT_STRETCHED) {
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
rect->w = render_size.width;
|
||||
rect->h = render_size.height;
|
||||
return;
|
||||
}
|
||||
|
||||
assert(render_fit == SC_RENDER_FIT_LETTERBOX);
|
||||
|
||||
if (is_optimal_size(render_size, content_size)) {
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue