am 0c01222f: Merge "Don\'t crash when scaling Bitmaps with private Bitmap.Configs" into jb-dev

* commit '0c01222ff6507c6e3eaeec7070a510201165d6f3':
  Don't crash when scaling Bitmaps with private Bitmap.Configs
This commit is contained in:
Jack Palevich
2012-06-04 17:59:14 -07:00
committed by Android Git Automerger

View File

@@ -854,7 +854,11 @@ public class RemoteControlClient
float scale = Math.min((float) maxWidth / width, (float) maxHeight / height);
int newWidth = Math.round(scale * width);
int newHeight = Math.round(scale * height);
Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, bitmap.getConfig());
Bitmap.Config newConfig = bitmap.getConfig();
if (newConfig == null) {
newConfig = Bitmap.Config.ARGB_8888;
}
Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, newConfig);
Canvas canvas = new Canvas(outBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);