diff options
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/content/res/AssetManager.java | 1 | ||||
| -rw-r--r-- | core/java/android/content/res/Resources.java | 10 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 16 |
3 files changed, 13 insertions, 14 deletions
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java index 0bc8a9d2e482..0d43b2a83c72 100644 --- a/core/java/android/content/res/AssetManager.java +++ b/core/java/android/content/res/AssetManager.java @@ -24,7 +24,6 @@ import android.util.TypedValue; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.util.Locale; /** * Provides access to an application's raw asset files; see {@link Resources} diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 7d412a7b5554..ba5c9ed18a43 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -66,8 +66,6 @@ public class Resources { = new SparseArray<ColorStateList>(); private static boolean mPreloaded; - private final LongSparseArray<Drawable.ConstantState> mPreloadedDrawables; - /*package*/ final TypedValue mTmpValue = new TypedValue(); // These are protected by the mTmpValue lock. @@ -158,11 +156,6 @@ public class Resources { } updateConfiguration(config, metrics); assets.ensureStringBlocks(); - if (mCompatibilityInfo.isScalingRequired()) { - mPreloadedDrawables = emptySparseArray(); - } else { - mPreloadedDrawables = sPreloadedDrawables; - } } /** @@ -1669,7 +1662,7 @@ public class Resources { return dr; } - Drawable.ConstantState cs = mPreloadedDrawables.get(key); + Drawable.ConstantState cs = sPreloadedDrawables.get(key); if (cs != null) { dr = cs.newDrawable(); } else { @@ -1976,7 +1969,6 @@ public class Resources { mMetrics.setToDefaults(); updateConfiguration(null, null); mAssets.ensureStringBlocks(); - mPreloadedDrawables = sPreloadedDrawables; mCompatibilityInfo = CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO; } } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 2f17bbc71ced..f63c2f1162e1 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6038,16 +6038,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * some form of this public, but should think about the API. */ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor) { - final int width = mRight - mLeft; - final int height = mBottom - mTop; + int width = mRight - mLeft; + int height = mBottom - mTop; - Bitmap bitmap = Bitmap.createBitmap(width, height, quality); + final AttachInfo attachInfo = mAttachInfo; + final float scale = attachInfo.mApplicationScale; + width = (int) ((width * scale) + 0.5f); + height = (int) ((height * scale) + 0.5f); + + Bitmap bitmap = Bitmap.createBitmap(width > 0 ? width : 1, + height > 0 ? height : 1, quality); if (bitmap == null) { throw new OutOfMemoryError(); } + bitmap.setDensity(getResources().getDisplayMetrics().densityDpi); + Canvas canvas; - final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { canvas = attachInfo.mCanvas; if (canvas == null) { @@ -6070,6 +6077,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility computeScroll(); final int restoreCount = canvas.save(); + canvas.scale(scale, scale); canvas.translate(-mScrollX, -mScrollY); // Temporarily remove the dirty mask |
