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/
local.properties
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)
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni
# $(LOCAL_PATH)/../../../skia/trunk/include/core \
# $(LOCAL_PATH)/../../../skia/trunk/include/utils \
# $(LOCAL_PATH)/../../../skia/trunk/include/config
# $(LOCAL_PATH)/../libvorbis-1.3.2/include
LOCAL_MODULE := osmand
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni \
$(LOCAL_PATH)/../../../skia/trunk/include/core \
$(LOCAL_PATH)/../../../skia/trunk/include/utils \
$(LOCAL_PATH)/../../../skia/trunk/include/config
#LOCAL_SHARED_LIBRARIES := \
# libskia
LOCAL_SHARED_LIBRARIES := skiaosm
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 \
# libutils \
# libandroid_runtime \
# 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 $(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 <stdlib.h>
///#define SK_BUILD_FOR_ANDROID_NDK
//#include <SkBitmap.h>
#define SK_BUILD_FOR_ANDROID_NDK
#include <SkBitmap.h>
#include <SkCanvas.h>
#include <SkPaint.h>
#include <SkPath.h>
JNIEnv* env;
jclass MultiPolygonClass;
@ -20,6 +21,7 @@ jmethodID Path_lineTo;
jclass CanvasClass;
jmethodID Canvas_drawPath;
jfieldID Canvas_nativeCanvas;
jclass PaintClass;
jmethodID PaintClass_setStrokeWidth;
@ -229,7 +231,7 @@ jobject getDashEffect(jstring dashes){
return dashEffect;
}
int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
RenderingContext* rc) {
const char* rColor;
const char* rStrokeW;
@ -259,26 +261,28 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
}
int color = getIntPropertyValue(renderingRuleSearch, rColor);
env->CallVoidMethod( paint, PaintClass_setStyle,PaintStyle_STROKE);
env->CallVoidMethod( paint, PaintClass_setColor, color);
env->CallVoidMethod( paint, PaintClass_setStrokeWidth, stroke);
paint->setStyle(SkPaint::kStroke_Style);
paint->setColor(color);
paint->setStrokeWidth(stroke);
jstring cap = getStringPropertyValue(renderingRuleSearch, rCap);
jstring pathEff = getStringPropertyValue(renderingRuleSearch, rPathEff);
if (cap != NULL && env->GetStringLength( cap) > 0) {
jobject capObj = env->CallStaticObjectMethod( CapClass, CapClass_valueOf, cap);
env->CallVoidMethod( paint, PaintClass_setStrokeCap, capObj);
// TODO
paint->setStrokeCap(SkPaint::kButt_Cap);
env->DeleteLocalRef( capObj);
} else {
env->CallVoidMethod( paint, PaintClass_setStrokeCap, CapClass_BUTT);
paint->setStrokeCap(SkPaint::kButt_Cap);
}
if (pathEff != NULL && env->GetStringLength(pathEff) > 0) {
// TODO
//jobject pathObj = getDashEffect(pathEff);
//env->CallVoidMethod( paint, PaintClass_setPathEffect, pathObj);
// env->DeleteLocalRef( pathObj );
} else {
env->CallObjectMethod(paint, PaintClass_setPathEffect, NULL);
paint-> setPathEffect(NULL);
}
env->DeleteLocalRef( cap);
@ -290,7 +294,7 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
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)
{
@ -327,28 +331,28 @@ int updatePaint(jobject renderingRuleSearch, jobject paint, int ind, int area,
rc->visible++;
// __android_log_print(ANDROID_LOG_WARN, "net.osmand", "About to draw");
jobject path = NULL;
SkPath path ;
int i = 0;
float px = 0;
float py = 0;
for (; i < length; i++) {
calcPoint(binaryMapDataObject, i, rc);
if (path == NULL) {
path = env->NewObject( PathClass, Path_init);
env->CallVoidMethod( path, Path_moveTo, rc->calcX,
rc->calcY);
if (i == 0) {
path.moveTo(rc->calcX, rc->calcY);
} else {
env->CallVoidMethod( path, Path_lineTo, rc->calcX,
rc->calcY);
// cv->drawLine(px, py, rc->calcX, rc->calcY, *paint);
path.lineTo(rc->calcX, rc->calcY);
}
px = rc->calcX;
py = rc->calcY;
}
if (path) {
if (i > 0) {
if (drawOnlyShadow) {
//int shadowColor = render.getIntPropertyValue(render.ALL.R_SHADOW_COLOR);
//int shadowRadius = render.getIntPropertyValue(render.ALL.R_SHADOW_RADIUS);
//drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius);
} else {
env->CallVoidMethod( cv, Canvas_drawPath, path, paint);
cv->drawPath(path, *paint);
//if (updatePaint(render, paint, 1, false, rc)) {
// canvas.drawPath(path, paint);
// 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,
jobject renderingRuleSearch, jobject paint, int l, int renderText, int drawOnlyShadow) {
void drawObject(RenderingContext* rc, jobject binaryMapDataObject, SkCanvas* cv,
jobject renderingRuleSearch, SkPaint* paint, int l, int renderText, int drawOnlyShadow) {
rc -> allObjects++;
if (env->IsInstanceOf( binaryMapDataObject, MultiPolygonClass)) {
//if(!drawOnlyShadow){
@ -387,6 +390,7 @@ void drawObject(RenderingContext* rc, jobject binaryMapDataObject, jobject cv,
int layer = env->CallStaticIntMethod( MapRenderingTypesClass,
MapRenderingTypes_getNegativeWayLayer, mainType);
// __android_log_print(ANDROID_LOG_WARN, "net.osmand", "Draw polyline");
drawPolyline(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair, layer, drawOnlyShadow);
} else if(t == 3 && !drawOnlyShadow) {
// polygon
@ -460,6 +464,7 @@ void initLibrary(jobject rc)
CanvasClass = globalRef(env->FindClass( "android/graphics/Canvas"));
Canvas_drawPath = env->GetMethodID( CanvasClass, "drawPath",
"(Landroid/graphics/Path;Landroid/graphics/Paint;)V" );
Canvas_nativeCanvas = env->GetFieldID( CanvasClass, "mNativeCanvas","I" );
PaintClass = globalRef(env->FindClass( "android/graphics/Paint"));
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,
jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject cv,
jboolean useEnglishNames, jobject renderingRuleSearchRequest, jobject paint) {
jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject bmpObj,
jboolean useEnglishNames, jobject renderingRuleSearchRequest, jint defaultColor) {
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering");
size_t i = 0;
if(!env) {
env = ienv;
initLibrary(renderingContext);
}
// 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);
char szResult[1024];
RenderingContext rc;
copyRenderingContext(renderingContext, &rc);
@ -586,19 +601,22 @@ extern "C" JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLib
env->DeleteLocalRef( types);
int j = 0;
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);
}
}
delete paint;
delete canvas;
__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
jstring result = env->NewStringUTF( szResult);
jstring result = env->NewStringUTF( debugMessage);
// cleanup
// free(szResult);

View file

@ -1,2 +1,2 @@
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,7 +53,8 @@ public class MainMenuActivity extends Activity {
private ProgressDialog startProgressDialog;
static {
System.loadLibrary("osmand");
System.loadLibrary("skia");
System.loadLibrary("osmand");
}

View file

@ -4,12 +4,11 @@ package net.osmand.plus.render;
import net.osmand.binary.BinaryMapDataObject;
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
import net.osmand.render.RenderingRuleSearchRequest;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Bitmap;
public class NativeOsmandLibrary {
public static native String generateRendering(RenderingContext rc, BinaryMapDataObject[] objects, Canvas cv,
boolean useEnglishNames, RenderingRuleSearchRequest render, Paint paint);
public static native String generateRendering(RenderingContext rc, BinaryMapDataObject[] objects, Bitmap bmp,
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.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.Arrays;
import java.util.Collections;
@ -218,11 +221,7 @@ public class OsmandRenderer {
// 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
@ -233,6 +232,11 @@ public class OsmandRenderer {
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
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);
@ -300,11 +304,15 @@ public class OsmandRenderer {
} else {
BinaryMapDataObject[] array = objects.toArray(new BinaryMapDataObject[objects.size()]);
String res = NativeOsmandLibrary.generateRendering(rc, array, cv, useEnglishNames, render, paint);
long time = System.currentTimeMillis() - now;
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$
time, 0, rc.pointCount, rc.pointInsideCount, rc.visible, rc.allObjects);
try {
String res = NativeOsmandLibrary.generateRendering(rc, array, bmp, useEnglishNames, render, defaultColor);
long time = System.currentTimeMillis() - now;
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$
time, 0, rc.pointCount, rc.pointInsideCount, rc.visible, rc.allObjects);
} catch (Exception e) {
e.printStackTrace();
}
}
}