Skip to content

Commit

Permalink
Remove forced non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
toluo-stripe committed Dec 9, 2024
1 parent f4519ca commit 990dd27
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ allprojects {
}

ext {
compileSdkVersion = 35
compileSdkVersion = 34

group_name = GROUP
version_name = VERSION_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fun Bitmap.scaleAndCrop(size: Size, filter: Boolean = false): Bitmap =
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
fun Bitmap.cropWithFill(cropRegion: Rect): Bitmap {
val intersectionRegion = this.size().toRect().intersectionWith(cropRegion)
val result = Bitmap.createBitmap(cropRegion.width(), cropRegion.height(), this.config!!)
val result = Bitmap.createBitmap(cropRegion.width(), cropRegion.height(), this.config)
val canvas = Canvas(result)

canvas.drawColor(Color.GRAY)
Expand All @@ -147,7 +147,7 @@ fun Bitmap.rearrangeBySegments(
segmentMap: Map<Rect, Rect>
): Bitmap {
if (segmentMap.isEmpty()) {
return Bitmap.createBitmap(0, 0, this.config!!)
return Bitmap.createBitmap(0, 0, this.config)
}
val newImageDimensions = segmentMap.values.reduce { a, b ->
Rect(
Expand All @@ -158,7 +158,7 @@ fun Bitmap.rearrangeBySegments(
)
}
val newImageSize = newImageDimensions.size()
val result = Bitmap.createBitmap(newImageSize.width, newImageSize.height, this.config!!)
val result = Bitmap.createBitmap(newImageSize.width, newImageSize.height, this.config)
val canvas = Canvas(result)

// This should be using segmentMap.forEach, but doing so seems to require API 24. It's unclear
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal class LaplacianBlurDetector @Inject constructor(context: Context) {
val smootherBitmap = Bitmap.createBitmap(
sourceBitmap.width,
sourceBitmap.height,
sourceBitmap.config!!
sourceBitmap.config
)
val blurIntrinsic =
ScriptIntrinsicBlur.create(renderScript, Element.RGBA_8888(renderScript))
Expand Down Expand Up @@ -65,7 +65,7 @@ internal class LaplacianBlurDetector @Inject constructor(context: Context) {
val greyscaleBitmap = Bitmap.createBitmap(
sourceBitmap.width,
sourceBitmap.height,
sourceBitmap.config!!
sourceBitmap.config
)
val smootherInput = Allocation.createFromBitmap(
renderScript,
Expand All @@ -91,7 +91,7 @@ internal class LaplacianBlurDetector @Inject constructor(context: Context) {
val edgesBitmap = Bitmap.createBitmap(
sourceBitmap.width,
sourceBitmap.height,
sourceBitmap.config!!
sourceBitmap.config
)
val greyscaleInput = Allocation.createFromBitmap(
renderScript,
Expand Down

0 comments on commit 990dd27

Please sign in to comment.