Loading core/jni/android/graphics/BitmapFactory.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,15 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, return nullObjectReturn("layoutBounds == null"); } env->SetIntArrayRegion(layoutBounds, 0, 4, (jint*) peeker.fLayoutBounds); jint scaledBounds[4]; if (willScale) { for (int i=0; i<4; i++) { scaledBounds[i] = (jint)((((jint*)peeker.fLayoutBounds)[i]*scale) + .5f); } } else { memcpy(scaledBounds, (jint*)peeker.fLayoutBounds, sizeof(scaledBounds)); } env->SetIntArrayRegion(layoutBounds, 0, 4, scaledBounds); if (javaBitmap != NULL) { env->SetObjectField(javaBitmap, gBitmap_layoutBoundsFieldID, layoutBounds); } Loading graphics/java/android/graphics/BitmapFactory.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading Loading
core/jni/android/graphics/BitmapFactory.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,15 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding, return nullObjectReturn("layoutBounds == null"); } env->SetIntArrayRegion(layoutBounds, 0, 4, (jint*) peeker.fLayoutBounds); jint scaledBounds[4]; if (willScale) { for (int i=0; i<4; i++) { scaledBounds[i] = (jint)((((jint*)peeker.fLayoutBounds)[i]*scale) + .5f); } } else { memcpy(scaledBounds, (jint*)peeker.fLayoutBounds, sizeof(scaledBounds)); } env->SetIntArrayRegion(layoutBounds, 0, 4, scaledBounds); if (javaBitmap != NULL) { env->SetObjectField(javaBitmap, gBitmap_layoutBoundsFieldID, layoutBounds); } Loading
graphics/java/android/graphics/BitmapFactory.java +8 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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); Loading