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

Skip to content
Commit 67f87795 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Improve the wallpaper crop & rescale logic

The current crop/rescale logic is... weird. See the associated bug for
moe details.

Instead, let's do the following:
   - if all crops for all orientations have more height in px than their
     associated screen, downsample the image
   - if the "total crop" width or height is more than twice the screen
     largest dimension or the max openGL texture size, downsample
     (note: "twice" is to let room for parallax, or to let have a too
     high res image (to some extent) as long as the crops are low res.
     This is more a security check and should not be used in practice.)

Also, move from using ImageDecoder.decodeBitmap() with sampleSize then
Bitmap.createScaledBitmap, to using ImageDecoder.decodeBitmap() with
targetSize, which should reduce the amount of IO.

Test: manual
Test: atest WallpaperManagerTest, WallpaperCropperTest
Bug: 332695334
Flag: aconfig com.android.window.flags.multi_crop
Change-Id: I68f1b48d136c4942880fc55e79cbbf7a16763b66
parent 7dca5acb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment