Skip to content

Commit

Permalink
Fix transparent tints causing crash on Android (#74)
Browse files Browse the repository at this point in the history
Seems to be a framework bug which has been fixed in a very
recent version of Android. Easy to workaround.

Fixes #69
  • Loading branch information
chrisbanes authored Jan 3, 2024
1 parent 0263d92 commit 72614bc
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,15 @@ internal class HazeNode31(
BlendMode.HARD_LIGHT,
)
}.let {
RenderEffect.createColorFilterEffect(
BlendModeColorFilter(tint.toArgb(), BlendMode.SRC_OVER),
it,
)
if (tint.alpha >= 0.005f) {
// If we have an tint with a non-zero alpha value, wrap the effect with a color filter
RenderEffect.createColorFilterEffect(
BlendModeColorFilter(tint.toArgb(), BlendMode.SRC_OVER),
it,
)
} else {
it
}
}

// We create a RenderNode for each of the areas we need to apply our effect to
Expand Down

0 comments on commit 72614bc

Please sign in to comment.