summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-30 14:05:09 -0700
committerDianne Hackborn <hackbod@google.com>2012-04-30 14:51:48 -0700
commit76344241719384f160ee623554f66987d0fcae41 (patch)
tree97ba015c58ae17bff2eb3b16fb9f51fa89962c39 /core/jni/android/graphics
parent3ea8761974a530218a246dc73583c8820b12bf0b (diff)
downloadframeworks_base-76344241719384f160ee623554f66987d0fcae41.zip
frameworks_base-76344241719384f160ee623554f66987d0fcae41.tar.gz
frameworks_base-76344241719384f160ee623554f66987d0fcae41.tar.bz2
Fix scaling of layout bounds.
Change-Id: I9d8c8924900fed69030ee3e8d6decee89ca67820
Diffstat (limited to 'core/jni/android/graphics')
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 5507047..47ed2c1 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -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);
}