From eee85ec337c6d93b1c94366dc6f6ef7c0cacd720 Mon Sep 17 00:00:00 2001 From: Paul Akhamiogu Date: Tue, 28 Dec 2021 13:32:55 +0000 Subject: [PATCH] simplify eyedropper valid coordinate check --- .../com/simplemobiletools/draw/pro/helpers/EyeDropper.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/EyeDropper.kt b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/EyeDropper.kt index aa0a6c2..7df530d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/EyeDropper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/pro/helpers/EyeDropper.kt @@ -78,7 +78,9 @@ class EyeDropper(private val view: View, private val onColorSelected: ((Int) -> } private fun Bitmap.isValidCoordinate(x: Int, y: Int): Boolean { - return x in 1 until width && y in 1 until height + val isValidXCoordinate = x >= 1 && x < width + val isValidYCoordinate = y >= 1 && y < height + return isValidXCoordinate && isValidYCoordinate } private fun View.shouldDrawingCacheBeEnabled(): Boolean = (this !is ImageView) && !isDrawingCacheEnabled