From bcb7df24ec83b7a7e3a439c7357ccfbc3ea019c5 Mon Sep 17 00:00:00 2001 From: "Yash R. Dhake" <144844519+YD09@users.noreply.github.com> Date: Mon, 30 Jun 2025 00:54:12 +0530 Subject: [PATCH] Optimize resizeBitmap(): Skip resizing for already-small images (#2565) Co-authored-by: Sylvia van Os --- app/src/main/java/protect/card_locker/Utils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/protect/card_locker/Utils.java b/app/src/main/java/protect/card_locker/Utils.java index 787e73806..3ac53f674 100644 --- a/app/src/main/java/protect/card_locker/Utils.java +++ b/app/src/main/java/protect/card_locker/Utils.java @@ -594,6 +594,11 @@ public class Utils { double width = bitmap.getWidth(); double height = bitmap.getHeight(); + // Early exit + if (Math.max(width, height) <= maxSize) { + return bitmap; + } + if (height > width) { double scale = height / maxSize; height = maxSize;