Loading graphics/java/android/graphics/drawable/BitmapDrawable.java +5 −1 Original line number Diff line number Diff line Loading @@ -815,6 +815,9 @@ public class BitmapDrawable extends Drawable { if (tileModeY != TILE_MODE_UNDEFINED) { setTileModeY(parseTileMode(tileModeY)); } final int densityDpi = r.getDisplayMetrics().densityDpi; state.mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } @Override Loading Loading @@ -977,7 +980,8 @@ public class BitmapDrawable extends Drawable { */ private void updateLocalState(Resources res) { if (res != null) { mTargetDensity = res.getDisplayMetrics().densityDpi; final int densityDpi = res.getDisplayMetrics().densityDpi; mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } else { mTargetDensity = mBitmapState.mTargetDensity; } Loading graphics/java/android/graphics/drawable/Drawable.java +2 −7 Original line number Diff line number Diff line Loading @@ -1147,6 +1147,7 @@ public abstract class Drawable { * document, tries to create a Drawable from that tag. Returns {@code null} * if the tag is not a valid drawable. */ @SuppressWarnings("deprecation") public static Drawable createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException { final Drawable drawable; Loading Loading @@ -1202,16 +1203,10 @@ public abstract class Drawable { drawable = new InsetDrawable(); break; case "bitmap": drawable = new BitmapDrawable(r); if (r != null) { ((BitmapDrawable) drawable).setTargetDensity(r.getDisplayMetrics()); } drawable = new BitmapDrawable(); break; case "nine-patch": drawable = new NinePatchDrawable(); if (r != null) { ((NinePatchDrawable) drawable).setTargetDensity(r.getDisplayMetrics()); } break; default: throw new XmlPullParserException(parser.getPositionDescription() + Loading graphics/java/android/graphics/drawable/NinePatchDrawable.java +5 −1 Original line number Diff line number Diff line Loading @@ -482,6 +482,9 @@ public class NinePatchDrawable extends Drawable { if (tint != null) { state.mTint = tint; } final int densityDpi = r.getDisplayMetrics().densityDpi; state.mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } @Override Loading Loading @@ -713,7 +716,8 @@ public class NinePatchDrawable extends Drawable { final NinePatchState state = mNinePatchState; if (res != null) { mTargetDensity = res.getDisplayMetrics().densityDpi; final int densityDpi = res.getDisplayMetrics().densityDpi; mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } else { mTargetDensity = state.mTargetDensity; } Loading Loading
graphics/java/android/graphics/drawable/BitmapDrawable.java +5 −1 Original line number Diff line number Diff line Loading @@ -815,6 +815,9 @@ public class BitmapDrawable extends Drawable { if (tileModeY != TILE_MODE_UNDEFINED) { setTileModeY(parseTileMode(tileModeY)); } final int densityDpi = r.getDisplayMetrics().densityDpi; state.mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } @Override Loading Loading @@ -977,7 +980,8 @@ public class BitmapDrawable extends Drawable { */ private void updateLocalState(Resources res) { if (res != null) { mTargetDensity = res.getDisplayMetrics().densityDpi; final int densityDpi = res.getDisplayMetrics().densityDpi; mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } else { mTargetDensity = mBitmapState.mTargetDensity; } Loading
graphics/java/android/graphics/drawable/Drawable.java +2 −7 Original line number Diff line number Diff line Loading @@ -1147,6 +1147,7 @@ public abstract class Drawable { * document, tries to create a Drawable from that tag. Returns {@code null} * if the tag is not a valid drawable. */ @SuppressWarnings("deprecation") public static Drawable createFromXmlInner(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException { final Drawable drawable; Loading Loading @@ -1202,16 +1203,10 @@ public abstract class Drawable { drawable = new InsetDrawable(); break; case "bitmap": drawable = new BitmapDrawable(r); if (r != null) { ((BitmapDrawable) drawable).setTargetDensity(r.getDisplayMetrics()); } drawable = new BitmapDrawable(); break; case "nine-patch": drawable = new NinePatchDrawable(); if (r != null) { ((NinePatchDrawable) drawable).setTargetDensity(r.getDisplayMetrics()); } break; default: throw new XmlPullParserException(parser.getPositionDescription() + Loading
graphics/java/android/graphics/drawable/NinePatchDrawable.java +5 −1 Original line number Diff line number Diff line Loading @@ -482,6 +482,9 @@ public class NinePatchDrawable extends Drawable { if (tint != null) { state.mTint = tint; } final int densityDpi = r.getDisplayMetrics().densityDpi; state.mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } @Override Loading Loading @@ -713,7 +716,8 @@ public class NinePatchDrawable extends Drawable { final NinePatchState state = mNinePatchState; if (res != null) { mTargetDensity = res.getDisplayMetrics().densityDpi; final int densityDpi = res.getDisplayMetrics().densityDpi; mTargetDensity = densityDpi == 0 ? DisplayMetrics.DENSITY_DEFAULT : densityDpi; } else { mTargetDensity = state.mTargetDensity; } Loading