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

Commit d2aa99a7 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Reformat files in weatherlibs using new ktfmt

Flag: EXEMPT only style change
Bug: N/A
Test: N/A

Change-Id: Ia27369aa41fd665d98fa00e6366306247c3d6b77
parent 4886b822
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ class FogEffect(
    private var background: Bitmap,
    private var intensity: Float = DEFAULT_INTENSITY,
    /** The initial size of the surface where the effect will be shown. */
    private var surfaceSize: SizeF
    private var surfaceSize: SizeF,
) : WeatherEffect {

    private val fogPaint = Paint().also { it.shader = fogConfig.colorGradingShader }
@@ -99,7 +99,7 @@ class FogEffect(
        fogConfig.shader.setFloatUniform("intensity", intensity)
        fogConfig.colorGradingShader.setFloatUniform(
            "intensity",
            fogConfig.colorGradingIntensity * intensity
            fogConfig.colorGradingIntensity * intensity,
        )
    }

@@ -108,11 +108,11 @@ class FogEffect(
        this.background = background
        fogConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        fogConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        adjustCropping(surfaceSize)
    }
@@ -123,61 +123,61 @@ class FogEffect(
                surfaceSize.width,
                surfaceSize.height,
                foreground.width.toFloat(),
                foreground.height.toFloat()
                foreground.height.toFloat(),
            )
        fogConfig.shader.setFloatUniform(
            "uvOffsetFgd",
            imageCropFgd.leftOffset,
            imageCropFgd.topOffset
            imageCropFgd.topOffset,
        )
        fogConfig.shader.setFloatUniform(
            "uvScaleFgd",
            imageCropFgd.horizontalScale,
            imageCropFgd.verticalScale
            imageCropFgd.verticalScale,
        )
        val imageCropBgd =
            ImageCrop.centerCoverCrop(
                surfaceSize.width,
                surfaceSize.height,
                background.width.toFloat(),
                background.height.toFloat()
                background.height.toFloat(),
            )
        fogConfig.shader.setFloatUniform(
            "uvOffsetBgd",
            imageCropBgd.leftOffset,
            imageCropBgd.topOffset
            imageCropBgd.topOffset,
        )
        fogConfig.shader.setFloatUniform(
            "uvScaleBgd",
            imageCropBgd.horizontalScale,
            imageCropBgd.verticalScale
            imageCropBgd.verticalScale,
        )
        fogConfig.shader.setFloatUniform("screenSize", surfaceSize.width, surfaceSize.height)
        fogConfig.shader.setFloatUniform(
            "screenAspectRatio",
            GraphicsUtils.getAspectRatio(surfaceSize)
            GraphicsUtils.getAspectRatio(surfaceSize),
        )
    }

    private fun updateTextureUniforms() {
        fogConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )

        fogConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )

        fogConfig.shader.setInputBuffer(
            "clouds",
            BitmapShader(fogConfig.cloudsTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)
            BitmapShader(fogConfig.cloudsTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT),
        )

        fogConfig.shader.setInputBuffer(
            "fog",
            BitmapShader(fogConfig.fogTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)
            BitmapShader(fogConfig.fogTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT),
        )

        fogConfig.shader.setFloatUniform("pixelDensity", fogConfig.pixelDensity)
@@ -188,7 +188,7 @@ class FogEffect(
        fogConfig.lut?.let {
            fogConfig.colorGradingShader.setInputShader(
                "lut",
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
            )
        }
        fogConfig.colorGradingShader.setFloatUniform("intensity", fogConfig.colorGradingIntensity)
@@ -200,13 +200,13 @@ class FogEffect(
        fogConfig.shader.setFloatUniform(
            "cloudsSize",
            widthScreenScale * fogConfig.cloudsTexture.width.toFloat(),
            widthScreenScale * fogConfig.cloudsTexture.height.toFloat()
            widthScreenScale * fogConfig.cloudsTexture.height.toFloat(),
        )

        fogConfig.shader.setFloatUniform(
            "fogSize",
            widthScreenScale * fogConfig.fogTexture.width.toFloat(),
            widthScreenScale * fogConfig.fogTexture.height.toFloat()
            widthScreenScale * fogConfig.fogTexture.height.toFloat(),
        )
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -36,17 +36,17 @@ class NoEffect(var foreground: Bitmap, var background: Bitmap, private var surfa
            background,
            MatrixUtils.centerCropMatrix(
                surfaceSize,
                SizeF(background.width.toFloat(), background.height.toFloat())
                SizeF(background.width.toFloat(), background.height.toFloat()),
            ),
            null
            null,
        )
        canvas.drawBitmap(
            foreground,
            MatrixUtils.centerCropMatrix(
                surfaceSize,
                SizeF(foreground.width.toFloat(), foreground.height.toFloat())
                SizeF(foreground.width.toFloat(), foreground.height.toFloat()),
            ),
            null
            null,
        )
    }

+14 −14
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class RainEffect(
    private var intensity: Float = DEFAULT_INTENSITY,
    /** The initial size of the surface where the effect will be shown. */
    private var surfaceSize: SizeF,
    private val mainExecutor: Executor
    private val mainExecutor: Executor,
) : WeatherEffect {

    private val rainPaint = Paint().also { it.shader = rainConfig.colorGradingShader }
@@ -100,7 +100,7 @@ class RainEffect(
        rainConfig.glassRainShader.setFloatUniform("intensity", intensity)
        rainConfig.colorGradingShader.setFloatUniform(
            "intensity",
            rainConfig.colorGradingIntensity * intensity
            rainConfig.colorGradingIntensity * intensity,
        )
        val thickness = 1f + intensity * 10f
        rainConfig.outlineShader.setFloatUniform("thickness", thickness)
@@ -129,17 +129,17 @@ class RainEffect(
                surfaceSize.width,
                surfaceSize.height,
                foreground.width.toFloat(),
                foreground.height.toFloat()
                foreground.height.toFloat(),
            )
        rainConfig.rainShowerShader.setFloatUniform(
            "uvOffsetFgd",
            imageCropFgd.leftOffset,
            imageCropFgd.topOffset
            imageCropFgd.topOffset,
        )
        rainConfig.rainShowerShader.setFloatUniform(
            "uvScaleFgd",
            imageCropFgd.horizontalScale,
            imageCropFgd.verticalScale
            imageCropFgd.verticalScale,
        )

        val imageCropBgd =
@@ -147,28 +147,28 @@ class RainEffect(
                surfaceSize.width,
                surfaceSize.height,
                background.width.toFloat(),
                background.height.toFloat()
                background.height.toFloat(),
            )
        rainConfig.rainShowerShader.setFloatUniform(
            "uvOffsetBgd",
            imageCropBgd.leftOffset,
            imageCropBgd.topOffset
            imageCropBgd.topOffset,
        )
        rainConfig.rainShowerShader.setFloatUniform(
            "uvScaleBgd",
            imageCropBgd.horizontalScale,
            imageCropBgd.verticalScale
            imageCropBgd.verticalScale,
        )

        rainConfig.rainShowerShader.setFloatUniform(
            "screenSize",
            surfaceSize.width,
            surfaceSize.height
            surfaceSize.height,
        )
        rainConfig.glassRainShader.setFloatUniform(
            "screenSize",
            surfaceSize.width,
            surfaceSize.height
            surfaceSize.height,
        )

        val screenAspectRatio = GraphicsUtils.getAspectRatio(surfaceSize)
@@ -184,7 +184,7 @@ class RainEffect(

        rainConfig.rainShowerShader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
    }

@@ -197,10 +197,10 @@ class RainEffect(
            { buffer ->
                rainConfig.rainShowerShader.setInputBuffer(
                    "outlineBuffer",
                    BitmapShader(buffer, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                    BitmapShader(buffer, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
                )
            },
            mainExecutor
            mainExecutor,
        )
    }

@@ -211,7 +211,7 @@ class RainEffect(
        rainConfig.lut?.let {
            rainConfig.colorGradingShader.setInputShader(
                "lut",
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
            )
        }
    }
+20 −20
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class SnowEffect(
    /** The initial size of the surface where the effect will be shown. */
    private var surfaceSize: SizeF,
    /** App main executor. */
    private val mainExecutor: Executor
    private val mainExecutor: Executor,
) : WeatherEffect {

    private var snowSpeed: Float = 0.8f
@@ -101,11 +101,11 @@ class SnowEffect(
        snowConfig.shader.setFloatUniform("intensity", intensity)
        snowConfig.colorGradingShader.setFloatUniform(
            "intensity",
            snowConfig.colorGradingIntensity * intensity
            snowConfig.colorGradingIntensity * intensity,
        )
        snowConfig.accumulatedSnowShader.setFloatUniform(
            "snowThickness",
            snowConfig.maxAccumulatedSnowThickness * intensity
            snowConfig.maxAccumulatedSnowThickness * intensity,
        )
        // Regenerate accumulated snow since the uniform changed.
        generateAccumulatedSnow()
@@ -117,11 +117,11 @@ class SnowEffect(
        frameBuffer = FrameBuffer(background.width, background.height)
        snowConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        snowConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        adjustCropping(surfaceSize)
        // generateAccumulatedSnow needs foreground for accumulatedSnowShader, and needs frameBuffer
@@ -135,56 +135,56 @@ class SnowEffect(
                surfaceSize.width,
                surfaceSize.height,
                foreground.width.toFloat(),
                foreground.height.toFloat()
                foreground.height.toFloat(),
            )
        snowConfig.shader.setFloatUniform(
            "uvOffsetFgd",
            imageCropFgd.leftOffset,
            imageCropFgd.topOffset
            imageCropFgd.topOffset,
        )
        snowConfig.shader.setFloatUniform(
            "uvScaleFgd",
            imageCropFgd.horizontalScale,
            imageCropFgd.verticalScale
            imageCropFgd.verticalScale,
        )
        val imageCropBgd =
            ImageCrop.centerCoverCrop(
                surfaceSize.width,
                surfaceSize.height,
                background.width.toFloat(),
                background.height.toFloat()
                background.height.toFloat(),
            )
        snowConfig.shader.setFloatUniform(
            "uvOffsetBgd",
            imageCropBgd.leftOffset,
            imageCropBgd.topOffset
            imageCropBgd.topOffset,
        )
        snowConfig.shader.setFloatUniform(
            "uvScaleBgd",
            imageCropBgd.horizontalScale,
            imageCropBgd.verticalScale
            imageCropBgd.verticalScale,
        )
        snowConfig.shader.setFloatUniform("screenSize", surfaceSize.width, surfaceSize.height)
        snowConfig.shader.setFloatUniform(
            "screenAspectRatio",
            GraphicsUtils.getAspectRatio(surfaceSize)
            GraphicsUtils.getAspectRatio(surfaceSize),
        )
    }

    private fun updateTextureUniforms() {
        snowConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )

        snowConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )

        snowConfig.shader.setInputBuffer(
            "noise",
            BitmapShader(snowConfig.noiseTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)
            BitmapShader(snowConfig.noiseTexture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT),
        )
    }

@@ -193,7 +193,7 @@ class SnowEffect(
        snowConfig.lut?.let {
            snowConfig.colorGradingShader.setInputShader(
                "lut",
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
            )
        }
    }
@@ -202,11 +202,11 @@ class SnowEffect(
        val renderingCanvas = frameBuffer.beginDrawing()
        snowConfig.accumulatedSnowShader.setFloatUniform(
            "imageWidth",
            renderingCanvas.width.toFloat()
            renderingCanvas.width.toFloat(),
        )
        snowConfig.accumulatedSnowShader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        renderingCanvas.drawPaint(frameBufferPaint)
        frameBuffer.endDrawing()
@@ -215,10 +215,10 @@ class SnowEffect(
            { image ->
                snowConfig.shader.setInputBuffer(
                    "accumulatedSnow",
                    BitmapShader(image, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                    BitmapShader(image, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
                )
            },
            mainExecutor
            mainExecutor,
        )
    }

+14 −14
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class SunEffect(
    private var background: Bitmap,
    private var intensity: Float = WeatherEffect.DEFAULT_INTENSITY,
    /** The initial size of the surface where the effect will be shown. */
    var surfaceSize: SizeF
    var surfaceSize: SizeF,
) : WeatherEffect {

    private val sunnyPaint = Paint().also { it.shader = sunConfig.colorGradingShader }
@@ -76,7 +76,7 @@ class SunEffect(
        sunConfig.shader.setFloatUniform("intensity", intensity)
        sunConfig.colorGradingShader.setFloatUniform(
            "intensity",
            sunConfig.colorGradingIntensity * intensity
            sunConfig.colorGradingIntensity * intensity,
        )
    }

@@ -85,11 +85,11 @@ class SunEffect(
        this.background = background
        sunConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        sunConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
        adjustCropping(surfaceSize)
    }
@@ -100,51 +100,51 @@ class SunEffect(
                surfaceSize.width,
                surfaceSize.height,
                foreground.width.toFloat(),
                foreground.height.toFloat()
                foreground.height.toFloat(),
            )
        sunConfig.shader.setFloatUniform(
            "uvOffsetFgd",
            imageCropFgd.leftOffset,
            imageCropFgd.topOffset
            imageCropFgd.topOffset,
        )
        sunConfig.shader.setFloatUniform(
            "uvScaleFgd",
            imageCropFgd.horizontalScale,
            imageCropFgd.verticalScale
            imageCropFgd.verticalScale,
        )
        val imageCropBgd =
            ImageCrop.centerCoverCrop(
                surfaceSize.width,
                surfaceSize.height,
                background.width.toFloat(),
                background.height.toFloat()
                background.height.toFloat(),
            )
        sunConfig.shader.setFloatUniform(
            "uvOffsetBgd",
            imageCropBgd.leftOffset,
            imageCropBgd.topOffset
            imageCropBgd.topOffset,
        )
        sunConfig.shader.setFloatUniform(
            "uvScaleBgd",
            imageCropBgd.horizontalScale,
            imageCropBgd.verticalScale
            imageCropBgd.verticalScale,
        )
        sunConfig.shader.setFloatUniform("screenSize", surfaceSize.width, surfaceSize.height)
        sunConfig.shader.setFloatUniform(
            "screenAspectRatio",
            GraphicsUtils.getAspectRatio(surfaceSize)
            GraphicsUtils.getAspectRatio(surfaceSize),
        )
    }

    private fun updateTextureUniforms() {
        sunConfig.shader.setInputBuffer(
            "foreground",
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(foreground, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )

        sunConfig.shader.setInputBuffer(
            "background",
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
            BitmapShader(background, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
        )
    }

@@ -153,7 +153,7 @@ class SunEffect(
        sunConfig.lut?.let {
            sunConfig.colorGradingShader.setInputShader(
                "lut",
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR)
                BitmapShader(it, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR),
            )
        }
        sunConfig.colorGradingShader.setFloatUniform("intensity", sunConfig.colorGradingIntensity)
Loading