Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83b58594 authored by Pat Manning's avatar Pat Manning
Browse files

Manually set vector density when converting to bitmap.

Fix: 324934385
Bug: 305193969
Change-Id: I859f5b88adf26a34b6f499dc2c24ded543a5b682
Test: v2/pixel-health-guard/device-boot-test
Flag: ACONFIG com.android.systemui.enable_vector_cursors DEVELOPMENT
parent 3092a907
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -430,6 +430,11 @@ public final class PointerIcon implements Parcelable {
            VectorDrawable vectorDrawable) {
        Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(),
                vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
        // BitmapDrawables and Bitmap have a default density of DisplayMetrics.DENSITY_DEVICE,
        // (which is deprecated in favor of DENSITY_DEVICE_STABLE/resources.densityDpi). In
        // rare cases when device density differs from the resource density, the bitmap will
        // scale as the BitmapDrawable is created. Avoid by explicitly setting density here.
        bitmap.setDensity(resources.getDisplayMetrics().densityDpi);
        Canvas canvas = new Canvas(bitmap);
        vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
        vectorDrawable.draw(canvas);