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

Commit 5736105d authored by Kshitij's avatar Kshitij Committed by Mohammed Althaf T
Browse files

fix: De-jank blurring on DPI change



- Calling createBitmap with just width and height completely disregards the
  density of input bitmap.
- We can just copy input bitmap and overwrite that to save us the trouble

Signed-off-by: default avatarSaalim Quadri <danascape@gmail.com>
parent b379299f
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -182,21 +182,17 @@ class BlurWallpaperProvider(val context: Context) : SafeCloseable {
    }

    private fun applyVibrancy(wallpaper: Bitmap): Bitmap {
        val width = wallpaper.width
        val height = wallpaper.height

        val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
        val canvas = Canvas()
        canvas.setBitmap(bitmap)
        mVibrancyPaint.colorFilter =
            ColorMatrixColorFilter(ColorMatrix().apply { setSaturation(1.25f) })

        val colorMatrix = ColorMatrix()
        colorMatrix.setSaturation(1.25f)
        val filter = ColorMatrixColorFilter(colorMatrix)
        mVibrancyPaint.colorFilter = filter
        canvas.drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint)
        val bitmap = Bitmap.createBitmap(wallpaper)
        Canvas().apply {
            setBitmap(bitmap)
            drawBitmap(wallpaper, 0f, 0f, mVibrancyPaint)
        }

        wallpaper.recycle()

        return bitmap
    }