diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-23 14:09:34 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-23 14:26:02 -0700 |
commit | de0dfb7b65a02d4dd74c271b558adee0973fc267 (patch) | |
tree | c2e701a78f831978378ff3a9c219209aae3e4fc2 /core | |
parent | 5dd7c726f45fd7b7ab473471dc504c00012a6856 (diff) | |
download | frameworks_base-de0dfb7b65a02d4dd74c271b558adee0973fc267.zip frameworks_base-de0dfb7b65a02d4dd74c271b558adee0973fc267.tar.gz frameworks_base-de0dfb7b65a02d4dd74c271b558adee0973fc267.tar.bz2 |
Fix issue #2125720 Weather Forecast Widget - graphics do not scale
I forgot to add the new density field to the Bitmaps' parcelable data.
Change-Id: I77cf3e93e356297e0caed6fc71b62b5cd8f79124
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android/graphics/Bitmap.cpp | 9 | ||||
-rw-r--r-- | core/jni/android/graphics/Graphics.cpp | 6 | ||||
-rw-r--r-- | core/jni/android/graphics/GraphicsJNI.h | 2 | ||||
-rw-r--r-- | core/jni/android_emoji_EmojiFactory.cpp | 4 |
4 files changed, 12 insertions, 9 deletions
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index 002d3db..8d52917 100644 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -332,6 +332,7 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) { const int width = p->readInt32();
const int height = p->readInt32();
const int rowBytes = p->readInt32();
+ const int density = p->readInt32();
if (SkBitmap::kARGB_8888_Config != config &&
SkBitmap::kRGB_565_Config != config &&
@@ -369,12 +370,13 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) { memcpy(bitmap->getPixels(), p->readInplace(size), size);
bitmap->unlockPixels();
- return GraphicsJNI::createBitmap(env, bitmap, isMutable, NULL);
+ return GraphicsJNI::createBitmap(env, bitmap, isMutable, NULL, density);
}
static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
const SkBitmap* bitmap,
- jboolean isMutable, jobject parcel) {
+ jboolean isMutable, jint density,
+ jobject parcel) {
if (parcel == NULL) {
SkDebugf("------- writeToParcel null parcel\n");
return false;
@@ -387,6 +389,7 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject, p->writeInt32(bitmap->width());
p->writeInt32(bitmap->height());
p->writeInt32(bitmap->rowBytes());
+ p->writeInt32(density);
if (bitmap->getConfig() == SkBitmap::kIndex8_Config) {
SkColorTable* ctable = bitmap->getColorTable();
@@ -546,7 +549,7 @@ static JNINativeMethod gBitmapMethods[] = { { "nativeCreateFromParcel",
"(Landroid/os/Parcel;)Landroid/graphics/Bitmap;",
(void*)Bitmap_createFromParcel },
- { "nativeWriteToParcel", "(IZLandroid/os/Parcel;)Z",
+ { "nativeWriteToParcel", "(IZILandroid/os/Parcel;)Z",
(void*)Bitmap_writeToParcel },
{ "nativeExtractAlpha", "(II[I)Landroid/graphics/Bitmap;",
(void*)Bitmap_extractAlpha },
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp index ca1cb7d..2e0caed 100644 --- a/core/jni/android/graphics/Graphics.cpp +++ b/core/jni/android/graphics/Graphics.cpp @@ -351,7 +351,7 @@ SkRegion* GraphicsJNI::getNativeRegion(JNIEnv* env, jobject region) /////////////////////////////////////////////////////////////////////////////////////////// jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, bool isMutable, - jbyteArray ninepatch) + jbyteArray ninepatch, int density) { SkASSERT(bitmap != NULL); SkASSERT(NULL != bitmap->pixelRef()); @@ -359,7 +359,7 @@ jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, bool isMutable, jobject obj = env->AllocObject(gBitmap_class); if (obj) { env->CallVoidMethod(obj, gBitmap_constructorMethodID, - (jint)bitmap, isMutable, ninepatch); + (jint)bitmap, isMutable, ninepatch, density); if (hasException(env)) { obj = NULL; } @@ -541,7 +541,7 @@ int register_android_graphics_Graphics(JNIEnv* env) gBitmap_class = make_globalref(env, "android/graphics/Bitmap"); gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "I"); gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", - "(IZ[B)V"); + "(IZ[BI)V"); gBitmapConfig_class = make_globalref(env, "android/graphics/Bitmap$Config"); gBitmapConfig_nativeInstanceID = getFieldIDCheck(env, gBitmapConfig_class, diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h index f8b60a8..7adadbc 100644 --- a/core/jni/android/graphics/GraphicsJNI.h +++ b/core/jni/android/graphics/GraphicsJNI.h @@ -50,7 +50,7 @@ public: then the bitmap must be an owner of its natively allocated pixels (via allocPixels). */ static jobject createBitmap(JNIEnv* env, SkBitmap* bitmap, bool isMutable, - jbyteArray ninePatch); + jbyteArray ninePatch, int density = -1); static jobject createRegion(JNIEnv* env, SkRegion* region); diff --git a/core/jni/android_emoji_EmojiFactory.cpp b/core/jni/android_emoji_EmojiFactory.cpp index 4c213a3..63550fb 100644 --- a/core/jni/android_emoji_EmojiFactory.cpp +++ b/core/jni/android_emoji_EmojiFactory.cpp @@ -184,7 +184,7 @@ static jobject android_emoji_EmojiFactory_getBitmapFromAndroidPua( jobject obj = env->AllocObject(gBitmap_class); if (obj) { env->CallVoidMethod(obj, gBitmap_constructorMethodID, - reinterpret_cast<jint>(bitmap), false, NULL); + reinterpret_cast<jint>(bitmap), false, NULL, -1); if (env->ExceptionCheck() != 0) { LOGE("*** Uncaught exception returned from Java call!\n"); env->ExceptionDescribe(); @@ -297,7 +297,7 @@ static jfieldID getFieldIDCheck(JNIEnv* env, jclass clazz, int register_android_emoji_EmojiFactory(JNIEnv* env) { gBitmap_class = make_globalref(env, "android/graphics/Bitmap"); gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", - "(IZ[B)V"); + "(IZ[BI)V"); gEmojiFactory_class = make_globalref(env, "android/emoji/EmojiFactory"); gEmojiFactory_constructorMethodID = env->GetMethodID( gEmojiFactory_class, "<init>", "(ILjava/lang/String;)V"); |