Skip to content

Commit

Permalink
Fix API file consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Nov 30, 2024
1 parent ddb35a6 commit d41b8c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion haze/api/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package dev.chrisbanes.haze {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier hazeChild(androidx.compose.ui.Modifier, dev.chrisbanes.haze.HazeState state, optional dev.chrisbanes.haze.HazeStyle style, optional kotlin.jvm.functions.Function1<? super dev.chrisbanes.haze.HazeChildScope,kotlin.Unit>? block);
}

public final class HazeChildNode extends androidx.compose.ui.Modifier.Node implements androidx.compose.ui.node.CompositionLocalConsumerModifierNode androidx.compose.ui.node.DrawModifierNode androidx.compose.ui.node.GlobalPositionAwareModifierNode dev.chrisbanes.haze.HazeChildScope androidx.compose.ui.node.ObserverModifierNode {
@dev.chrisbanes.haze.ExperimentalHazeApi public final class HazeChildNode extends androidx.compose.ui.Modifier.Node implements androidx.compose.ui.node.CompositionLocalConsumerModifierNode androidx.compose.ui.node.DrawModifierNode androidx.compose.ui.node.GlobalPositionAwareModifierNode dev.chrisbanes.haze.HazeChildScope androidx.compose.ui.node.ObserverModifierNode {
ctor public HazeChildNode(dev.chrisbanes.haze.HazeState state, optional dev.chrisbanes.haze.HazeStyle style, optional kotlin.jvm.functions.Function1<? super dev.chrisbanes.haze.HazeChildScope,kotlin.Unit>? block);
method public void draw(androidx.compose.ui.graphics.drawscope.ContentDrawScope);
method public float getAlpha();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.ui.node.currentValueOf
import androidx.compose.ui.platform.LocalGraphicsContext
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.takeOrElse
import androidx.compose.ui.unit.times
import dev.chrisbanes.haze.HazeChildNode.Companion.TAG
import kotlin.math.ceil
import kotlin.math.max
Expand Down Expand Up @@ -78,7 +77,7 @@ private fun HazeChildNode.drawLinearGradientProgressiveEffectUsingLayers(

val tints = resolveTints()
val noiseFactor = resolveNoiseFactor()
val blurRadius = resolveBlurRadius().takeOrElse { 0.dp } * getInputScaleFactor()
val blurRadius = resolveBlurRadius().takeOrElse { 0.dp } * calculateInputScaleFactor()

for (i in seq) {
val fraction = i / steps.toFloat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import io.github.reactivecircus.cache4k.Cache
* This is public API in order to aid custom extensible modifiers, _but_ we reserve the right
* to be able to change the API in the future, hence why it is marked as experimental forever.
*/
@ExperimentalHazeApi
class HazeChildNode(
var state: HazeState,
style: HazeStyle = HazeStyle.Unspecified,
Expand Down Expand Up @@ -79,7 +80,6 @@ class HazeChildNode(
}
}

@ExperimentalHazeApi
override var inputScale: HazeInputScale = HazeInputScale.Default
set(value) {
if (value != field) {
Expand Down Expand Up @@ -308,7 +308,7 @@ class HazeChildNode(
// The layer size is usually than the bounds. This is so that we include enough
// content around the edges to keep the blurring uniform. Without the extra border,
// the blur will naturally fade out at the edges.
val scaleFactor = getInputScaleFactor()
val scaleFactor = calculateInputScaleFactor()
val inflatedSize = layerSize * scaleFactor
// This is the topLeft in the inflated bounds where the real are should be at [0,0]
val inflatedOffset = contentOffset
Expand Down Expand Up @@ -535,14 +535,14 @@ internal data class RenderEffectParams(
)

@ExperimentalHazeApi
internal fun HazeChildNode.getInputScaleFactor(): Float = when (val s = inputScale) {
internal fun HazeChildNode.calculateInputScaleFactor(): Float = when (val s = inputScale) {
HazeInputScale.None -> 1f
is HazeInputScale.Fixed -> s.scale
}

@OptIn(ExperimentalHazeApi::class)
internal fun HazeChildNode.getOrCreateRenderEffect(
inputScale: Float = getInputScaleFactor(),
inputScale: Float = calculateInputScaleFactor(),
blurRadius: Dp = resolveBlurRadius().takeOrElse { 0.dp } * inputScale,
noiseFactor: Float = resolveNoiseFactor(),
tints: List<HazeTint> = resolveTints(),
Expand Down

0 comments on commit d41b8c7

Please sign in to comment.