Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e6d0692 authored by Yein Jo's avatar Yein Jo
Browse files

Remove a seam from media TTT ripple.

1. Match the sizes of center fill and base ring
2. Match fadeout timing

Please find the recordings and adb commands in the bug linked. https://b.corp.google.com/issues/265326983#comment8

Bug: 265326983
Test: adb commands in the bug
Change-Id: I10669cd8373b6ebbaec5bde995a20c87f03a2cf9
parent 71592cf7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) :
                vec2 p_distorted = distort(p, in_time, in_distort_radial, in_distort_xy);
                vec2 p_distorted = distort(p, in_time, in_distort_radial, in_distort_xy);
                float radius = in_size.x * 0.5;
                float radius = in_size.x * 0.5;
                float sparkleRing = soften(circleRing(p_distorted-in_center, radius), in_blur);
                float sparkleRing = soften(circleRing(p_distorted-in_center, radius), in_blur);
                float inside = soften(sdCircle(p_distorted-in_center, radius * 1.2), in_blur);
                float inside = soften(sdCircle(p_distorted-in_center, radius * 1.25), in_blur);
                float sparkle = sparkles(p - mod(p, in_pixelDensity * 0.8), in_time * 0.00175)
                float sparkle = sparkles(p - mod(p, in_pixelDensity * 0.8), in_time * 0.00175)
                    * (1.-sparkleRing) * in_fadeSparkle;
                    * (1.-sparkleRing) * in_fadeSparkle;


+8 −2
Original line number Original line Diff line number Diff line
@@ -119,13 +119,19 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi


    private fun removeRippleFill() {
    private fun removeRippleFill() {
        with(rippleShader) {
        with(rippleShader) {
            // Set back to default because we modified them in [setupRippleFadeParams].
            baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START
            baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START
            baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END
            baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END


            centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START
            centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START
            centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END
            centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END
            centerFillFadeParams.fadeOutStart = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_START

            centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_END
            // To avoid a seam showing up, we should match either:
            // 1. baseRingFadeParams#fadeInEnd and centerFillFadeParams#fadeOutStart
            // 2. baseRingFadeParams#fadeOutStart and centerFillFadeOutStart
            // Here we go with 1 to fade in the centerFill faster.
            centerFillFadeParams.fadeOutStart = baseRingFadeParams.fadeInEnd
            centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END
        }
        }
    }
    }