summaryrefslogtreecommitdiff
path: root/graphics/java/android
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2012-07-31 16:37:34 -0700
committer Dianne Hackborn <hackbod@google.com> 2012-08-01 10:54:39 -0700
commit908aecc3a63c5520d5b11da14a9383f885b7d126 (patch)
tree11806df7f127ea695474ae7ab490a95c19965508 /graphics/java/android
parentb1980049855fd6c53e109b44ff012a053f9436f7 (diff)
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
Diffstat (limited to 'graphics/java/android')
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java2
-rw-r--r--graphics/java/android/graphics/drawable/NinePatchDrawable.java2
2 files changed, 2 insertions, 2 deletions
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();