diff options
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 5b4f15062..c27e3759d 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -508,15 +508,17 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h, float scaleX, float scaleY) { - Canvas c = new Canvas(); - if (bitmap != null) c.setBitmap(bitmap); - c.save(); - c.scale(scaleX, scaleY); - Rect oldBounds = d.copyBounds(); - d.setBounds(x, y, x + w, y + h); - d.draw(c); - d.setBounds(oldBounds); // Restore the bounds - c.restore(); + if (bitmap != null) { + Canvas c = new Canvas(); + c.setBitmap(bitmap); + c.save(); + c.scale(scaleX, scaleY); + Rect oldBounds = d.copyBounds(); + d.setBounds(x, y, x + w, y + h); + d.draw(c); + d.setBounds(oldBounds); // Restore the bounds + c.restore(); + } } private FastBitmapDrawable getShortcutPreview(ResolveInfo info, int cellWidth, int cellHeight) { // Return the cached version if necessary |