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

Commit b9161e28 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Fix getBitmapCrops when sampleSize != 1

getBitmapCrop doesn't work properly for images that needs to be rescaled
(i.e. images with sample size)

Bug: 325634700
Test: manual debug
Flag: ACONFIG com.android.window.flags.multi_crop DEVELOPMENT
Change-Id: Ib8477718c22877d0035d7c353a9dbb5af31b2839
parent f1790276
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2219,8 +2219,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
            if (wallpaper == null || !wallpaper.mSupportsMultiCrop) return null;
            SparseArray<Rect> relativeSuggestedCrops =
                    mWallpaperCropper.getRelativeCropHints(wallpaper);
            Point croppedBitmapSize =
                    new Point(wallpaper.cropHint.width(), wallpaper.cropHint.height());
            Point croppedBitmapSize = new Point(
                    (int) (0.5f + wallpaper.cropHint.width() / wallpaper.mSampleSize),
                    (int) (0.5f + wallpaper.cropHint.height() / wallpaper.mSampleSize));
            SparseArray<Rect> relativeDefaultCrops =
                    mWallpaperCropper.getDefaultCrops(relativeSuggestedCrops, croppedBitmapSize);
            SparseArray<Rect> adjustedRelativeSuggestedCrops = new SparseArray<>();