mirror of
https://github.com/openharmony/miscservices_wallpaper.git
synced 2026-07-01 06:42:05 -04:00
Signed-off-by: weishaoxiong <weishaoxiong1@huawei.com>
fix:CreatePixelMap
This commit is contained in:
@@ -444,14 +444,19 @@ bool WallpaperService::MakeCropWallpaper(int wallpaperType)
|
||||
int32_t pictrueWidth = wallpaperPixelMap->GetWidth();
|
||||
int pyScrWidth = GetWallpaperMinWidth();
|
||||
int pyScrHeight = GetWallpaperMinHeight();
|
||||
if (pictrueHeight > pyScrHeight || pictrueWidth > pyScrWidth) {
|
||||
bool bHeightFlag = false, bWidthFlag = false;
|
||||
if (pictrueHeight > pyScrHeight) {
|
||||
decodeOpts.CropRect.top = (pictrueHeight - pyScrHeight)/HALF;
|
||||
decodeOpts.CropRect.width = pyScrWidth;
|
||||
decodeOpts.CropRect.left = (pictrueWidth - pyScrWidth)/HALF;
|
||||
decodeOpts.CropRect.height = pyScrHeight;
|
||||
decodeOpts.desiredSize.width = pyScrWidth;
|
||||
decodeOpts.desiredSize.height = pyScrHeight;
|
||||
bHeightFlag = true;
|
||||
}
|
||||
if (pictrueWidth > pyScrWidth) {
|
||||
decodeOpts.CropRect.left = (pictrueWidth - pyScrWidth)/HALF;
|
||||
bWidthFlag = true;
|
||||
}
|
||||
decodeOpts.CropRect.height = bHeightFlag ? pyScrHeight : pictrueHeight;
|
||||
decodeOpts.desiredSize.height = decodeOpts.CropRect.height;
|
||||
decodeOpts.CropRect.width = bWidthFlag ? pyScrWidth : pictrueHeight;
|
||||
decodeOpts.desiredSize.width = decodeOpts.CropRect.width;
|
||||
wallpaperPixelMap = imageSource->CreatePixelMap(decodeOpts, errorCode);
|
||||
if (errorCode != 0) {
|
||||
ret = false;
|
||||
|
||||
Reference in New Issue
Block a user