summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alexandra Gherghina <alexgherghina@google.com> 2014-12-15 12:15:39 +0000
committer Alexandra Gherghina <alexgherghina@google.com> 2014-12-15 15:51:47 +0000
commit80d119bf6536293c3e6e4699a287a7bedfcf5586 (patch)
tree4dc231b2184e23f1b97758a653ae407a4fe386d4
parent84644f107dcf4753f7d14632b63270fed31edcf8 (diff)
Fix image conversion
For some images, especially those in the bug linked, the conversion would yield empty images otherwise. Bug: 18311493 Change-Id: I90150a8837655df3c9c35b36eb02594807eb0a06
-rw-r--r--core/java/com/android/internal/util/UserIcons.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/java/com/android/internal/util/UserIcons.java b/core/java/com/android/internal/util/UserIcons.java
index e1e9d5e18c05..c69d14f92f91 100644
--- a/core/java/com/android/internal/util/UserIcons.java
+++ b/core/java/com/android/internal/util/UserIcons.java
@@ -48,9 +48,12 @@ public class UserIcons {
if (icon == null) {
return null;
}
- Bitmap bitmap = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(),
- Bitmap.Config.ARGB_8888);
- icon.draw(new Canvas(bitmap));
+ final int width = icon.getIntrinsicWidth();
+ final int height = icon.getIntrinsicHeight();
+ Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ icon.setBounds(0, 0, width, height);
+ icon.draw(canvas);
return bitmap;
}