Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment