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

Skip to content
Commit 3f9b20ad authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Round up the cropped bitmap

If there is a sample size > 1, make sure we round up the cropped bitmap.
Otherwise, there may be edge cases where the relative crops end up being
larger than the bitmap. This happens in the very specific case where:
 - sampleSize = 2.0 (or multiple of 2)
 - the total cropHint.left is odd
 - the bitmap width is even
 - there is a crop that goes until the very right of the bitmap

In that case, to calculate the crop relative to the totalCrop, we apply
a -totalCrop.left offset then downsample. By doing this, the right
coordinate of the crop will be rounded up; whereas in the calculation of
the cropped bitmap size will we don't round up since we don't apply a
shift of an odd number of pixels.

Flag: com.android.window.flags.multi_crop
Bug: 352818167
Test: manually verify the bug with example bitmap
Test: atest WallpaperCropperTest
Change-Id: Iee3f63555810fe76033778fa95cbfb01a5171d7b
parent 158f837e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment