From 30cf4ee95376c738c4e182c22e8606cf796c40bd Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 20 Apr 2012 22:55:35 +0200 Subject: [PATCH] Temporarily use indirect --- OsmAnd/jni/osmand/common.cpp | 2 -- OsmAnd/jni/osmand/rendering.cpp | 26 +++++++++++-------- .../plus/render/NativeOsmandLibrary.java | 6 +++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/OsmAnd/jni/osmand/common.cpp b/OsmAnd/jni/osmand/common.cpp index 6668fae774..a1b85a19f9 100644 --- a/OsmAnd/jni/osmand/common.cpp +++ b/OsmAnd/jni/osmand/common.cpp @@ -341,8 +341,6 @@ SkBitmap* getCachedBitmap(RenderingContext* rc, const std::string& bitmapResourc jbyte* bitmapBuffer = getGlobalJniEnv()->GetByteArrayElements(javaIconRawData, NULL); size_t bufferLen = getGlobalJniEnv()->GetArrayLength(javaIconRawData); - __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "getCachedBitmap : bitmap buffer len %d at %p", bufferLen, bitmapBuffer); - // Decode bitmap SkBitmap* iconBitmap = new SkBitmap(); //TODO: JPEG is badly supported! At the moment it needs sdcard to be present (sic). Patch that diff --git a/OsmAnd/jni/osmand/rendering.cpp b/OsmAnd/jni/osmand/rendering.cpp index 96deeb8aa3..ef01d0ae89 100644 --- a/OsmAnd/jni/osmand/rendering.cpp +++ b/OsmAnd/jni/osmand/rendering.cpp @@ -728,19 +728,23 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib static PTR_AndroidBitmap_unlockPixels dl_AndroidBitmap_unlockPixels = 0; static void* module_libjnigraphics = 0; - if(!module_libjnigraphics) - { - module_libjnigraphics = dlopen("jnigraphics", RTLD_LAZY); - if(!module_libjnigraphics) - { - __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to load jnigraphics via dlopen, will going to crash"); - return NULL; - } - dl_AndroidBitmap_getInfo = (PTR_AndroidBitmap_getInfo)dlsym(module_libjnigraphics, "AndroidBitmap_getInfo"); - dl_AndroidBitmap_lockPixels = (PTR_AndroidBitmap_lockPixels)dlsym(module_libjnigraphics, "AndroidBitmap_lockPixels"); - dl_AndroidBitmap_unlockPixels = (PTR_AndroidBitmap_unlockPixels)dlsym(module_libjnigraphics, "AndroidBitmap_unlockPixels"); + if(!module_libjnigraphics) + { +// module_libjnigraphics = dlopen("jnigraphics", RTLD_NOW | RTLD_NOLOAD); +// if(!module_libjnigraphics) { + module_libjnigraphics = dlopen("jnigraphics", RTLD_NOW); +// } + if(!module_libjnigraphics) + { + __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Failed to load jnigraphics via dlopen, will going to crash"); + return NULL; + } + dl_AndroidBitmap_getInfo = (PTR_AndroidBitmap_getInfo)dlsym(module_libjnigraphics, "AndroidBitmap_getInfo"); + dl_AndroidBitmap_lockPixels = (PTR_AndroidBitmap_lockPixels)dlsym(module_libjnigraphics, "AndroidBitmap_lockPixels"); + dl_AndroidBitmap_unlockPixels = (PTR_AndroidBitmap_unlockPixels)dlsym(module_libjnigraphics, "AndroidBitmap_unlockPixels"); } + // Gain information about bitmap AndroidBitmapInfo bitmapInfo; if(dl_AndroidBitmap_getInfo(getGlobalJniEnv(), targetBitmap, &bitmapInfo) != ANDROID_BITMAP_RESUT_SUCCESS) diff --git a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java index e932b29f5c..f5f03e0c9c 100644 --- a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java +++ b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java @@ -77,10 +77,12 @@ public class NativeOsmandLibrary { return new RenderingGenerationResult(null); } - if(android.os.Build.VERSION.SDK_INT >= 8) // Android 2.2+ + // Android 2.2+ + if(android.os.Build.VERSION.SDK_INT >= 8 && false) { return generateRendering_Direct(rc, searchResultHandler.nativeHandler, bitmap, useEnglishNames, render, defaultColor); - else + } else { return generateRendering_Indirect(rc, searchResultHandler.nativeHandler, requestedBitmapWidth, requestedBitmapHeight, rowBytes, isTransparent, useEnglishNames, render, defaultColor); + } } /**