From 908aecc3a63c5520d5b11da14a9383f885b7d126 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 31 Jul 2012 16:37:34 -0700 Subject: Start moving away from DisplayMetrics.DENSITY_DEVICE. This puts in most of the infrastructure needed to allow us to switch between different densities at run time. The main remaining uses of the global are to initialize the Bitmap object (not sure what to do about that since it doesn't have anything passed in the constructor to get this information from), and being able to load drawables if we need a different density than what was preloaded by zygote. Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848 --- graphics/java/android/graphics/drawable/Drawable.java | 2 +- graphics/java/android/graphics/drawable/NinePatchDrawable.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java index 07bcbdcdeaac..540acfa6a2e0 100644 --- a/graphics/java/android/graphics/drawable/Drawable.java +++ b/graphics/java/android/graphics/drawable/Drawable.java @@ -778,7 +778,7 @@ public abstract class Drawable { // to the compatibility density only to have them scaled back up when // drawn to the screen. if (opts == null) opts = new BitmapFactory.Options(); - opts.inScreenDensity = DisplayMetrics.DENSITY_DEVICE; + opts.inScreenDensity = res.getDisplayMetrics().noncompatDensityDpi; Bitmap bm = BitmapFactory.decodeResourceStream(res, value, is, pad, opts); if (bm != null) { byte[] np = bm.getNinePatchChunk(); diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java index b68b267976ac..62aea7102d9a 100644 --- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java +++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java @@ -296,7 +296,7 @@ public class NinePatchDrawable extends Drawable { if (dither) { options.inDither = false; } - options.inScreenDensity = DisplayMetrics.DENSITY_DEVICE; + options.inScreenDensity = r.getDisplayMetrics().noncompatDensityDpi; final Rect padding = new Rect(); final Rect layoutInsets = new Rect(); -- cgit v1.2.3-59-g8ed1b