Last ditch for drawables with no width or height...
(cherry picked from commit c92507be9d8c89ea500bf1ecebae3ec853dae616)
This commit is contained in:
parent
6fb1f83740
commit
92c7a35c9b
1 changed files with 9 additions and 0 deletions
|
@ -1161,6 +1161,15 @@ public class FileBackend {
|
|||
int height = drawable.getIntrinsicHeight();
|
||||
if (height < 1) height = bounds == null || bounds.bottom < 1 ? 256 : bounds.bottom;
|
||||
|
||||
if (width < 1) {
|
||||
Log.w(Config.LOGTAG, "Drawable with no width: " + drawable);
|
||||
width = 48;
|
||||
}
|
||||
if (height < 1) {
|
||||
Log.w(Config.LOGTAG, "Drawable with no height: " + drawable);
|
||||
height = 48;
|
||||
}
|
||||
|
||||
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
|
||||
|
|
Loading…
Add table
Reference in a new issue