Fix cropping still images
Can't use Rect.width()/.height() with negative left/top values because these get cropped at 0/0 of course. Before this commit, the cropped image was larger than it should be.
This commit is contained in:
@@ -59,8 +59,8 @@ fun crop(bitmap: Bitmap, rect: RectF, rotation: Float) = try {
|
||||
erected,
|
||||
x,
|
||||
y,
|
||||
min(w - x, (rect.width() * w).roundToInt()),
|
||||
min(h - y, (rect.height() * h).roundToInt())
|
||||
min(w - x, (rect.right * w).roundToInt() - x),
|
||||
min(h - y, (rect.bottom * h).roundToInt() - y)
|
||||
)
|
||||
} catch (e: OutOfMemoryError) {
|
||||
null
|
||||
|
||||
Reference in New Issue
Block a user