Fix scaling of layout bounds.
Change-Id: I9d8c8924900fed69030ee3e8d6decee89ca67820
This commit is contained in:
@@ -556,6 +556,7 @@ public class BitmapFactory {
|
||||
return bm;
|
||||
}
|
||||
byte[] np = bm.getNinePatchChunk();
|
||||
int[] lb = bm.getLayoutBounds();
|
||||
final boolean isNinePatch = np != null && NinePatch.isNinePatchChunk(np);
|
||||
if (opts.inScaled || isNinePatch) {
|
||||
float scale = targetDensity / (float) density;
|
||||
@@ -569,6 +570,13 @@ public class BitmapFactory {
|
||||
np = nativeScaleNinePatch(np, scale, outPadding);
|
||||
bm.setNinePatchChunk(np);
|
||||
}
|
||||
if (lb != null) {
|
||||
int[] newLb = new int[lb.length];
|
||||
for (int i=0; i<lb.length; i++) {
|
||||
newLb[i] = (int)((lb[i]*scale)+.5f);
|
||||
}
|
||||
bm.setLayoutBounds(newLb);
|
||||
}
|
||||
}
|
||||
|
||||
bm.setDensity(targetDensity);
|
||||
|
||||
Reference in New Issue
Block a user