Fix scaling of layout bounds.

Change-Id: I9d8c8924900fed69030ee3e8d6decee89ca67820
This commit is contained in:
Dianne Hackborn
2012-04-30 14:05:09 -07:00
parent 3ea8761974
commit 7634424171
2 changed files with 17 additions and 1 deletions

View File

@@ -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);