0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-20 03:52:16 +02:00

Move origin subtraction out of min()

Simplifies the calculation of the width and height of the crop
section.
This commit is contained in:
Markus Fisch 2024-01-10 22:38:31 +01:00
parent 11ae65ec3e
commit 96626e6b00

View File

@ -64,8 +64,8 @@ fun Bitmap.crop(
b,
x,
y,
min(w - x, (rect.right * w).roundToInt() - x),
min(h - y, (rect.bottom * h).roundToInt() - y)
min(w, (rect.right * w).roundToInt()) - x,
min(h, (rect.bottom * h).roundToInt()) - y
)
} catch (e: OutOfMemoryError) {
null