diff --git a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt index cc107bc..eac6735 100644 --- a/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt +++ b/colorpicker-compose/src/main/kotlin/com/github/skydoves/colorpicker/compose/BitmapCalculator.kt @@ -30,12 +30,17 @@ internal object BitmapCalculator { * corresponding dimension of the target size. */ internal fun scaleBitmap(bitmap: Bitmap, targetSize: IntSize): Bitmap { - return Bitmap.createScaledBitmap( - bitmap, - targetSize.width, - targetSize.height, - false, - ) + val sameSize = (targetSize.height == bitmap.height && targetSize.width == bitmap.width) + return if (sameSize) { + bitmap.copy(bitmap.config, bitmap.isMutable) + } else { + Bitmap.createScaledBitmap( + bitmap, + targetSize.width, + targetSize.height, + false, + ) + } } /**