mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-04-11 02:48:00 -04:00
Optimize resizeBitmap(): Skip resizing for already-small images (#2565)
Co-authored-by: Sylvia van Os <sylvia@hackerchick.me>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user