From 5d79f8d0dc6818eb76a9b43f055b8571270d9c28 Mon Sep 17 00:00:00 2001 From: Reynaldo San Juan Date: Sun, 14 Sep 2025 00:21:58 +0200 Subject: [PATCH] feat: remove resolution factor from NewDisplay and Options for simplification --- .../java/com/genymobile/scrcpy/Options.java | 22 ++++--------------- .../genymobile/scrcpy/device/NewDisplay.java | 16 +------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Options.java b/server/src/main/java/com/genymobile/scrcpy/Options.java index 18b8859f..f30f520d 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Options.java +++ b/server/src/main/java/com/genymobile/scrcpy/Options.java @@ -1,5 +1,8 @@ package com.genymobile.scrcpy; +import android.graphics.Rect; +import android.util.Pair; + import com.genymobile.scrcpy.audio.AudioCodec; import com.genymobile.scrcpy.audio.AudioSource; import com.genymobile.scrcpy.device.Device; @@ -14,9 +17,6 @@ import com.genymobile.scrcpy.video.VideoCodec; import com.genymobile.scrcpy.video.VideoSource; import com.genymobile.scrcpy.wrappers.WindowManager; -import android.graphics.Rect; -import android.util.Pair; - import java.util.List; import java.util.Locale; @@ -603,23 +603,9 @@ public class Options { // Check for resizable flag and resolution factor boolean resizable = false; - float resolutionFactor = 1.0f; int rIndex = newDisplay.indexOf(":r"); if (rIndex >= 0) { resizable = true; - String factorStr = newDisplay.substring(rIndex + 2); - if (!factorStr.isEmpty()) { - try { - resolutionFactor = Float.parseFloat(factorStr); - if (resolutionFactor <= 0.1f) { - resolutionFactor = 0.1f; - } else if (resolutionFactor > 10.0f) { - resolutionFactor = 10.0f; - } - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Invalid resolution factor: " + factorStr); - } - } newDisplay = newDisplay.substring(0, rIndex); } @@ -642,7 +628,7 @@ public class Options { dpi = 0; } - return new NewDisplay(size, dpi, resizable, resolutionFactor); + return new NewDisplay(size, dpi, resizable); } private static Pair parseCaptureOrientation(String value) { diff --git a/server/src/main/java/com/genymobile/scrcpy/device/NewDisplay.java b/server/src/main/java/com/genymobile/scrcpy/device/NewDisplay.java index 7bdfab58..c5270a05 100644 --- a/server/src/main/java/com/genymobile/scrcpy/device/NewDisplay.java +++ b/server/src/main/java/com/genymobile/scrcpy/device/NewDisplay.java @@ -4,23 +4,16 @@ public final class NewDisplay { private Size size; private int dpi; private final boolean resizable; - private float resolutionFactor; public NewDisplay() { // Auto size and dpi, not resizable this.resizable = false; - this.resolutionFactor = 1.0f; } public NewDisplay(Size size, int dpi, boolean resizable) { - this(size, dpi, resizable, 1.0f); - } - - public NewDisplay(Size size, int dpi, boolean resizable, float resolutionFactor) { this.size = size; this.dpi = dpi; this.resizable = resizable; - this.resolutionFactor = resolutionFactor; } public Size getSize() { @@ -42,12 +35,5 @@ public final class NewDisplay { public boolean hasExplicitDpi() { return dpi != 0; } - - public float getResolutionFactor() { - return resolutionFactor; - } - - public boolean hasResolutionFactor() { - return resolutionFactor != 1.0f; - } + }