Fix default wallpaper transition issue

The dimension of default wallpaper is only 1243x1024, this causes the
transition looks not smooth.

Bug: 139297053
Test: Manually kill current wallpaper serveral times.
Test: After fallback wallpaper appears, look the transition.
Change-Id: Ie3eb1a61753cf30210414139c9af492b60c7334b
This commit is contained in:
Ahan Wu
2019-09-06 19:19:05 +08:00
parent b1af47bec8
commit c6e84a1340

View File

@@ -111,7 +111,12 @@ public class ImageWallpaperRenderer implements GLWallpaperRenderer,
mBitmap = mWallpaperManager.getBitmap();
mWallpaperManager.forgetLoadedWallpaper();
if (mBitmap != null) {
mSurfaceSize.set(0, 0, mBitmap.getWidth(), mBitmap.getHeight());
float scale = (float) mScissor.height() / mBitmap.getHeight();
int surfaceHeight = Math.max(mScissor.height(), mBitmap.getHeight());
int surfaceWidth = scale > 1f
? Math.round(mBitmap.getWidth() * scale)
: mBitmap.getWidth();
mSurfaceSize.set(0, 0, surfaceWidth, surfaceHeight);
}
}
return mBitmap != null;