Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use internal modifier's coroutine scope instead of using runblocking #48

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

skydoves
Copy link
Owner

Use internal modifier's coroutine scope instead of using runblocking.

@skydoves skydoves self-assigned this Dec 30, 2024
@skydoves skydoves merged commit 20b7d88 into main Dec 30, 2024
@skydoves skydoves deleted the improve/modifier-coroutinescope branch December 30, 2024 06:21
androidBitmap: Bitmap,
radius: Int
): Bitmap? {
): Bitmap? = coroutineScope {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsolicited review:

coroutineScope { } is redundant. You are not launching any other coroutines there. suspend is enough.

Maybe if you have launched each blur region in separate coroutine then it would have been justified. Like

coroutineScope  { 
  for (i in 0 until iterate) {
     launch { 
          bitmap = RenderScriptToolkit.blur(
            inputBitmap = bitmap,
            radius = 25
          )
       }
  }
  
  }

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out of it! I was testing on the bitmap transformation and forgetting to remove the scope before merging it. Will fix it soon later 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants