drawable 转 bitmap 并设置 bm 尺寸

private Bitmap drawableToBitmap(Drawable drawable) {
    int w = drawable.getIntrinsicWidth();
    int h = drawable.getIntrinsicHeight();
    Log.i("Wooo", "-drawableToBitmap--" + h + "--w--" + w);
    Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
    Bitmap bitmap = Bitmap.createBitmap(w, h, config);
    Canvas canvas = new Canvas(bitmap);
    drawable.setBounds(0, 0, w, h);
    drawable.draw(canvas);
    int width = bitmap.getWidth();          // 更改 APP 展示图标尺寸
    int height = bitmap.getHeight();
    int newWidth = 180;
    int newHeight = 180;
    float scaleWidth = ((float) newWidth) / width;
    float scaleHeight = ((float) newHeight) / height;