summaryrefslogtreecommitdiff
path: root/libs/androidfw/StringPool.cpp
diff options
context:
space:
mode:
author Aurélien Pomini <pomini@google.com> 2024-07-29 14:24:44 +0000
committer Aurélien Pomini <pomini@google.com> 2024-07-29 14:47:34 +0000
commit3f9b20ad4ffd9269649344ee632843e699c0d591 (patch)
tree0583470a0160dc0fdabb250cf4563fd3171c6d80 /libs/androidfw/StringPool.cpp
parent158f837e06038488f48bc8d2b0b5e2cd36ff8cb8 (diff)
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
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions