simplify eyedropper valid coordinate check

This commit is contained in:
Paul Akhamiogu 2021-12-28 13:32:55 +00:00
parent 1dd61c9ab0
commit eee85ec337
1 changed files with 3 additions and 1 deletions

View File

@ -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