Skip to content

Commit

Permalink
[Android] Fix tints not being shown when blurRadius is 0.dp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Oct 17, 2024
1 parent 339fde6 commit 717d4bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ internal actual fun HazeChildNode.createRenderEffect(
"layerSize=$layerSize"
}

if (Build.VERSION.SDK_INT >= 31 && blurRadiusPx >= 0.005f) {
require(blurRadiusPx >= 0f) { "blurRadius needs to be equal or greater than 0f" }

if (Build.VERSION.SDK_INT >= 31) {
return AndroidRenderEffect.createBlurEffect(blurRadiusPx, blurRadiusPx, Shader.TileMode.CLAMP)
.withNoise(noiseFactor)
.withTints(tints, tintAlphaModulate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ internal actual fun HazeChildNode.createRenderEffect(
"layerSize=$layerSize"
}

require(blurRadiusPx >= 0f) { "blurRadius needs to be equal or greater than 0f" }

val compositeShaderBuilder = RuntimeShaderBuilder(RUNTIME_SHADER).apply {
uniform("noiseFactor", noiseFactor.coerceIn(0f, 1f))
child("noise", NOISE_SHADER)
Expand Down

0 comments on commit 717d4bc

Please sign in to comment.