Skip to content
Snippets Groups Projects
Commit 94557acd authored by Aurélien Pomini's avatar Aurélien Pomini Committed by Android (Google) Code Review
Browse files

Merge "Load and draw bitmap only once with ImageWallpaper" into main

parents 7bf3599f 2bbc9912
No related branches found
No related tags found
No related merge requests found
......@@ -109,6 +109,7 @@ public class ImageWallpaper extends WallpaperService {
private WallpaperManager mWallpaperManager;
private final WallpaperLocalColorExtractor mWallpaperLocalColorExtractor;
private SurfaceHolder mSurfaceHolder;
private boolean mDrawn = false;
@VisibleForTesting
static final int MIN_SURFACE_WIDTH = 128;
@VisibleForTesting
......@@ -239,6 +240,7 @@ public class ImageWallpaper extends WallpaperService {
private void drawFrameSynchronized() {
synchronized (mLock) {
if (mDrawn) return;
drawFrameInternal();
}
}
......@@ -276,6 +278,7 @@ public class ImageWallpaper extends WallpaperService {
Rect dest = mSurfaceHolder.getSurfaceFrame();
try {
canvas.drawBitmap(bitmap, null, dest, null);
mDrawn = true;
} finally {
surface.unlockCanvasAndPost(canvas);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment