Small changes to rendering

This commit is contained in:
Victor Shcherb 2011-10-22 20:47:30 +02:00
parent 02558f6b90
commit ada5634f6d
23 changed files with 105 additions and 333 deletions

1
OsmAnd/.gitignore vendored
View file

@ -2,3 +2,4 @@ bin/
gen/ gen/
local.properties local.properties
raw/ raw/
obj/

View file

@ -1,29 +1,40 @@
LOCAL_CFLAGS := -Wall -g #LOCAL_PATH := $(call my-dir)
#include $(CLEAR_VARS)
#
#LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../skia/trunk/include/core/
#
#LOCAL_MODULE := skia
#LOCAL_CFLAGS := -Wall -g
#include $(BUILD_SHARED_LIBRARY)
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni LOCAL_MODULE := osmand
# $(LOCAL_PATH)/../../../skia/trunk/include/core \ LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni \
# $(LOCAL_PATH)/../../../skia/trunk/include/utils \ $(LOCAL_PATH)/../../../skia/trunk/include/core \
# $(LOCAL_PATH)/../../../skia/trunk/include/config $(LOCAL_PATH)/../../../skia/trunk/include/utils \
# $(LOCAL_PATH)/../libvorbis-1.3.2/include $(LOCAL_PATH)/../../../skia/trunk/include/config
#LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := skiaosm
# libskia LOCAL_SRC_FILES := osmand/rendering.cpp
LOCAL_CFLAGS := -Wall -g
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog
#LOCAL_LDLIBS := -lskia -lGLESv1_CM -ldl -llog
#LOCAL_STATIC_LIBRARIES := libskia
# libcutils \ # libcutils \
# libutils \ # libutils \
# libandroid_runtime \ # libandroid_runtime \
# libGLESv2 # libGLESv2
LOCAL_MODULE := osmand
LOCAL_SRC_FILES := osmand/rendering.cpp
# LOCAL_SHARED_LIBRARIES := libvorbis libogg libFLAC
LOCAL_CFLAGS := -Wall -g
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := skiaosm
NDK_MODULE_PATH := $(LOCAL_PATH)
LOCAL_SRC_FILES := libskiaosm.so
include $(PREBUILT_SHARED_LIBRARY)

BIN
OsmAnd/jni/libskiaosm.so Normal file

Binary file not shown.

View file

@ -5,10 +5,11 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
///#define SK_BUILD_FOR_ANDROID_NDK #define SK_BUILD_FOR_ANDROID_NDK
//#include <SkBitmap.h> #include <SkBitmap.h>
#include <SkCanvas.h>
#include <SkPaint.h>
#include <SkPath.h>
JNIEnv* env; JNIEnv* env;
jclass MultiPolygonClass; jclass MultiPolygonClass;
@ -20,6 +21,7 @@ jmethodID Path_lineTo;
jclass CanvasClass; jclass CanvasClass;
jmethodID Canvas_drawPath; jmethodID Canvas_drawPath;
jfieldID Canvas_nativeCanvas;
jclass PaintClass; jclass PaintClass;
jmethodID PaintClass_setStrokeWidth; jmethodID PaintClass_setStrokeWidth;
@ -229,7 +231,7 @@ jobject getDashEffect(jstring dashes){
return dashEffect; return dashEffect;
} }
int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area, int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
RenderingContext* rc) { RenderingContext* rc) {
const char* rColor; const char* rColor;
const char* rStrokeW; const char* rStrokeW;
@ -259,26 +261,28 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
} }
int color = getIntPropertyValue(renderingRuleSearch, rColor); int color = getIntPropertyValue(renderingRuleSearch, rColor);
env->CallVoidMethod( paint, PaintClass_setStyle,PaintStyle_STROKE); paint->setStyle(SkPaint::kStroke_Style);
env->CallVoidMethod( paint, PaintClass_setColor, color); paint->setColor(color);
env->CallVoidMethod( paint, PaintClass_setStrokeWidth, stroke); paint->setStrokeWidth(stroke);
jstring cap = getStringPropertyValue(renderingRuleSearch, rCap); jstring cap = getStringPropertyValue(renderingRuleSearch, rCap);
jstring pathEff = getStringPropertyValue(renderingRuleSearch, rPathEff); jstring pathEff = getStringPropertyValue(renderingRuleSearch, rPathEff);
if (cap != NULL && env->GetStringLength( cap) > 0) { if (cap != NULL && env->GetStringLength( cap) > 0) {
jobject capObj = env->CallStaticObjectMethod( CapClass, CapClass_valueOf, cap); jobject capObj = env->CallStaticObjectMethod( CapClass, CapClass_valueOf, cap);
env->CallVoidMethod( paint, PaintClass_setStrokeCap, capObj); // TODO
paint->setStrokeCap(SkPaint::kButt_Cap);
env->DeleteLocalRef( capObj); env->DeleteLocalRef( capObj);
} else { } else {
env->CallVoidMethod( paint, PaintClass_setStrokeCap, CapClass_BUTT); paint->setStrokeCap(SkPaint::kButt_Cap);
} }
if (pathEff != NULL && env->GetStringLength(pathEff) > 0) { if (pathEff != NULL && env->GetStringLength(pathEff) > 0) {
// TODO
//jobject pathObj = getDashEffect(pathEff); //jobject pathObj = getDashEffect(pathEff);
//env->CallVoidMethod( paint, PaintClass_setPathEffect, pathObj); //env->CallVoidMethod( paint, PaintClass_setPathEffect, pathObj);
// env->DeleteLocalRef( pathObj ); // env->DeleteLocalRef( pathObj );
} else { } else {
env->CallObjectMethod(paint, PaintClass_setPathEffect, NULL); paint-> setPathEffect(NULL);
} }
env->DeleteLocalRef( cap); env->DeleteLocalRef( cap);
@ -290,7 +294,7 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
return 0; return 0;
} }
void drawPolyline(jobject binaryMapDataObject, jobject renderingRuleSearch, jobject cv, jobject paint, void drawPolyline(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCanvas* cv, SkPaint* paint,
RenderingContext* rc, jobject pair, int layer, int drawOnlyShadow) RenderingContext* rc, jobject pair, int layer, int drawOnlyShadow)
{ {
@ -327,28 +331,28 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
rc->visible++; rc->visible++;
// __android_log_print(ANDROID_LOG_WARN, "net.osmand", "About to draw"); // __android_log_print(ANDROID_LOG_WARN, "net.osmand", "About to draw");
SkPath path ;
jobject path = NULL;
int i = 0; int i = 0;
float px = 0;
float py = 0;
for (; i < length; i++) { for (; i < length; i++) {
calcPoint(binaryMapDataObject, i, rc); calcPoint(binaryMapDataObject, i, rc);
if (path == NULL) { if (i == 0) {
path = env->NewObject( PathClass, Path_init); path.moveTo(rc->calcX, rc->calcY);
env->CallVoidMethod( path, Path_moveTo, rc->calcX,
rc->calcY);
} else { } else {
env->CallVoidMethod( path, Path_lineTo, rc->calcX, // cv->drawLine(px, py, rc->calcX, rc->calcY, *paint);
rc->calcY); path.lineTo(rc->calcX, rc->calcY);
} }
px = rc->calcX;
py = rc->calcY;
} }
if (i > 0) {
if (path) {
if (drawOnlyShadow) { if (drawOnlyShadow) {
//int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR); //int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
//int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS); //int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS);
//drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius); //drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius);
} else { } else {
env->CallVoidMethod( cv, Canvas_drawPath, path, paint); cv->drawPath(path, *paint);
//if (updatePaint(render, paint, 1, false, rc)) { //if (updatePaint(render, paint, 1, false, rc)) {
// canvas.drawPath(path, paint); // canvas.drawPath(path, paint);
// if (updatePaint(render, paint, 2, false, rc)) { // if (updatePaint(render, paint, 2, false, rc)) {
@ -356,13 +360,12 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
// } // }
//} //}
} }
env->DeleteLocalRef( path);
} }
} }
void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv, void drawObject(RenderingContext* rc, jobject binaryMapDataObject, SkCanvas* cv,
jobject renderingRuleSearch, jobject paint, int l, int renderText, int drawOnlyShadow) { jobject renderingRuleSearch, SkPaint* paint, int l, int renderText, int drawOnlyShadow) {
rc -> allObjects++; rc -> allObjects++;
if (env->IsInstanceOf( binaryMapDataObject, MultiPolygonClass)) { if (env->IsInstanceOf( binaryMapDataObject, MultiPolygonClass)) {
//if(!drawOnlyShadow){ //if(!drawOnlyShadow){
@ -387,6 +390,7 @@ void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv,
int layer = env->CallStaticIntMethod( MapRenderingTypesClass, int layer = env->CallStaticIntMethod( MapRenderingTypesClass,
MapRenderingTypes_getNegativeWayLayer, mainType); MapRenderingTypes_getNegativeWayLayer, mainType);
// __android_log_print(ANDROID_LOG_WARN, "net.osmand", "Draw polyline"); // __android_log_print(ANDROID_LOG_WARN, "net.osmand", "Draw polyline");
drawPolyline(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair, layer, drawOnlyShadow); drawPolyline(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair, layer, drawOnlyShadow);
} else if(t == 3 && !drawOnlyShadow) { } else if(t == 3 && !drawOnlyShadow) {
// polygon // polygon
@ -460,6 +464,7 @@ void initLibrary(jobject rc)
CanvasClass = globalRef(env->FindClass( "android/graphics/Canvas")); CanvasClass = globalRef(env->FindClass( "android/graphics/Canvas"));
Canvas_drawPath = env->GetMethodID( CanvasClass, "drawPath", Canvas_drawPath = env->GetMethodID( CanvasClass, "drawPath",
"(Landroid/graphics/Path;Landroid/graphics/Paint;)V" ); "(Landroid/graphics/Path;Landroid/graphics/Paint;)V" );
Canvas_nativeCanvas = env->GetFieldID( CanvasClass, "mNativeCanvas","I" );
PaintClass = globalRef(env->FindClass( "android/graphics/Paint")); PaintClass = globalRef(env->FindClass( "android/graphics/Paint"));
PaintClass_setColor = env->GetMethodID( PaintClass, "setColor", "(I)V" ); PaintClass_setColor = env->GetMethodID( PaintClass, "setColor", "(I)V" );
@ -557,18 +562,28 @@ void unloadLibrary()
extern "C" JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRendering( JNIEnv* ienv, extern "C" JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRendering( JNIEnv* ienv,
jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject cv, jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject bmpObj,
jboolean useEnglishNames, jobject renderingRuleSearchRequest, jobject paint) { jboolean useEnglishNames, jobject renderingRuleSearchRequest, jint defaultColor) {
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering"); __android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering");
size_t i = 0; size_t i = 0;
if(!env) { if(!env) {
env = ienv; env = ienv;
initLibrary(renderingContext); initLibrary(renderingContext);
} }
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Classes and methods are loaded");
// SkBitmap* bmp = GraphicsJNI::getNativeBitmap(env, bmpObj);
jclass bmpClass = env->GetObjectClass(bmpObj);
SkBitmap* bmp = (SkBitmap*)env->CallIntMethod(bmpObj, env->GetMethodID(bmpClass, "ni", "()I"));
// SkBitmap* bmp = new SkBitmap;
SkPaint* paint = new SkPaint;
paint->setAntiAlias(true);
SkCanvas* canvas = new SkCanvas(*bmp);
sprintf(debugMessage, "Image %d %d %d!", bmp->width(), bmp->height(), bmp->rowBytes());
__android_log_print(ANDROID_LOG_WARN, "net.osmand", debugMessage);
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Classes and methods are loaded");
canvas->drawColor(defaultColor);
const size_t size = env->GetArrayLength( binaryMapDataObjects); const size_t size = env->GetArrayLength( binaryMapDataObjects);
char szResult[1024];
RenderingContext rc; RenderingContext rc;
copyRenderingContext(renderingContext, &rc); copyRenderingContext(renderingContext, &rc);
@ -586,19 +601,22 @@ extern "C" JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLib
env->DeleteLocalRef( types); env->DeleteLocalRef( types);
int j = 0; int j = 0;
for (; j < sizeTypes; j++) { for (; j < sizeTypes; j++) {
drawObject(&rc, binaryMapDataObject, cv, renderingRuleSearchRequest, paint, j, 1, 0); drawObject(&rc, binaryMapDataObject, canvas, renderingRuleSearchRequest, paint, j, 1, 0);
} }
} }
env->DeleteLocalRef( binaryMapDataObject); env->DeleteLocalRef( binaryMapDataObject);
} }
delete paint;
delete canvas;
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image"); __android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image");
sprintf(szResult, "Hello android %d", size); sprintf(debugMessage, "Hello android %d", size);
// get an object string // get an object string
jstring result = env->NewStringUTF( szResult); jstring result = env->NewStringUTF( debugMessage);
// cleanup // cleanup
// free(szResult); // free(szResult);

View file

@ -1,2 +1,2 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/jni /home/victor/projects/android-ndk-r6b/sources/cxx-stl/system/include directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/jni /home/victor/projects/OsmAnd/git/OsmAnd/jni/../../../skia/trunk/include/core /home/victor/projects/OsmAnd/git/OsmAnd/jni/../../../skia/trunk/include/utils /home/victor/projects/OsmAnd/git/OsmAnd/jni/../../../skia/trunk/include/config /home/victor/projects/android-ndk-r6b/sources/cxx-stl/system/include

Binary file not shown.

BIN
OsmAnd/libs/armeabi/libskiaosm.so Executable file

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +0,0 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/jni /home/victor/projects/android-ndk-r6b/sources/cxx-stl/system/include
file /home/victor/projects/OsmAnd/git/OsmAnd//obj/local/armeabi/app_process
target remote :5039

View file

@ -1,3 +0,0 @@
set solib-search-path /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/
directory /home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include /home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand
file /home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/app_process

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
!<arch>

View file

@ -1,86 +0,0 @@
/home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/objs-debug/osmand/osmand/rendering.o: \
/home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand/rendering.cpp \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h:

View file

@ -1,86 +0,0 @@
/home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/objs-debug/osmand/rendering.o: \
/home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand/rendering.c \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h:

View file

@ -1,86 +0,0 @@
/home/victor/projects/OsmAnd/git/OsmAnd/obj/local/armeabi/objs-debug/osmand/rendering.o: \
/home/victor/projects/OsmAnd/git/OsmAnd/jni/osmand/rendering.c \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h \
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/jni.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/android/log.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/cdefs_elf.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdint.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/stddef.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/compiler.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/posix_types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/types.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/machine/kernel.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/sys/sysmacros.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/linux/time.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/asm-generic/siginfo.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdio.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/stdlib.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/string.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/malloc.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/alloca.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/strings.h:
/home/victor/projects/android-ndk-r6b/platforms/android-8/arch-arm/usr/include/memory.h:

View file

@ -53,6 +53,7 @@ public class MainMenuActivity extends Activity {
private ProgressDialog startProgressDialog; private ProgressDialog startProgressDialog;
static { static {
System.loadLibrary("skia");
System.loadLibrary("osmand"); System.loadLibrary("osmand");
} }

View file

@ -4,12 +4,11 @@ package net.osmand.plus.render;
import net.osmand.binary.BinaryMapDataObject; import net.osmand.binary.BinaryMapDataObject;
import net.osmand.plus.render.OsmandRenderer.RenderingContext; import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRuleSearchRequest;
import android.graphics.Canvas; import android.graphics.Bitmap;
import android.graphics.Paint;
public class NativeOsmandLibrary { public class NativeOsmandLibrary {
public static native String generateRendering(RenderingContext rc, BinaryMapDataObject[] objects, Canvas cv, public static native String generateRendering(RenderingContext rc, BinaryMapDataObject[] objects, Bitmap bmp,
boolean useEnglishNames, RenderingRuleSearchRequest render, Paint paint); boolean useEnglishNames, RenderingRuleSearchRequest render, int defaultColor);
} }

View file

@ -3,6 +3,9 @@ package net.osmand.plus.render;
import gnu.trove.list.array.TIntArrayList; import gnu.trove.list.array.TIntArrayList;
import gnu.trove.map.hash.TIntObjectHashMap; import gnu.trove.map.hash.TIntObjectHashMap;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -218,11 +221,7 @@ public class OsmandRenderer {
// fill area // fill area
Canvas cv = new Canvas(bmp);
if(defaultColor != 0){
paintFillEmpty.setColor(defaultColor);
}
cv.drawRect(0, 0, bmp.getWidth(), bmp.getHeight(), paintFillEmpty);
// put in order map // put in order map
@ -233,6 +232,11 @@ public class OsmandRenderer {
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE; rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
if (!nativeRendering) { if (!nativeRendering) {
Canvas cv = new Canvas(bmp);
if(defaultColor != 0){
paintFillEmpty.setColor(defaultColor);
}
cv.drawRect(0, 0, bmp.getWidth(), bmp.getHeight(), paintFillEmpty);
TIntObjectHashMap<TIntArrayList> orderMap = sortObjectsByProperOrder(rc, objects, render); TIntObjectHashMap<TIntArrayList> orderMap = sortObjectsByProperOrder(rc, objects, render);
@ -300,11 +304,15 @@ public class OsmandRenderer {
} else { } else {
BinaryMapDataObject[] array = objects.toArray(new BinaryMapDataObject[objects.size()]); BinaryMapDataObject[] array = objects.toArray(new BinaryMapDataObject[objects.size()]);
String res = NativeOsmandLibrary.generateRendering(rc, array, cv, useEnglishNames, render, paint); try {
String res = NativeOsmandLibrary.generateRendering(rc, array, bmp, useEnglishNames, render, defaultColor);
long time = System.currentTimeMillis() - now; long time = System.currentTimeMillis() - now;
rc.renderingDebugInfo = String.format("Rendering done in %s (%s text) ms\n" rc.renderingDebugInfo = String.format("Rendering done in %s (%s text) ms\n"
+ "(%s points, %s points inside, %s objects visile from %s)\n" + res,//$NON-NLS-1$ + "(%s points, %s points inside, %s objects visile from %s)\n" + res,//$NON-NLS-1$
time, 0, rc.pointCount, rc.pointInsideCount, rc.visible, rc.allObjects); time, 0, rc.pointCount, rc.pointInsideCount, rc.visible, rc.allObjects);
} catch (Exception e) {
e.printStackTrace();
}
} }
} }