commit
13404c5494
13 changed files with 34 additions and 27 deletions
|
@ -17,8 +17,8 @@ public class NativeLibrary {
|
|||
|
||||
public static class NativeSearchResult {
|
||||
|
||||
public int nativeHandler;
|
||||
private NativeSearchResult(int nativeHandler) {
|
||||
public long nativeHandler;
|
||||
private NativeSearchResult(long nativeHandler) {
|
||||
this.nativeHandler = nativeHandler;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class NativeLibrary {
|
|||
}
|
||||
|
||||
|
||||
protected static native void deleteSearchResult(int searchResultHandle);
|
||||
protected static native void deleteSearchResult(long searchResultHandle);
|
||||
|
||||
protected static native boolean initBinaryMapFile(String filePath);
|
||||
|
||||
|
@ -66,10 +66,10 @@ public class NativeLibrary {
|
|||
protected static native void initRenderingRulesStorage(RenderingRulesStorage storage);
|
||||
|
||||
|
||||
protected static native RenderingGenerationResult generateRenderingIndirect(RenderingContext rc, int searchResultHandler,
|
||||
protected static native RenderingGenerationResult generateRenderingIndirect(RenderingContext rc, long searchResultHandler,
|
||||
boolean isTransparent, RenderingRuleSearchRequest render, boolean encodePng);
|
||||
|
||||
protected static native int searchNativeObjectsForRendering(int sleft, int sright, int stop, int sbottom, int zoom,
|
||||
protected static native long searchNativeObjectsForRendering(int sleft, int sright, int stop, int sbottom, int zoom,
|
||||
RenderingRuleSearchRequest request, boolean skipDuplicates, Object objectWithInterruptedField, String msgIfNothingFound);
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class NativeOsmandLibrary extends NativeLibrary {
|
|||
}
|
||||
|
||||
|
||||
private static native RenderingGenerationResult generateRenderingDirect(RenderingContext rc, int searchResultHandler,
|
||||
private static native RenderingGenerationResult generateRenderingDirect(RenderingContext rc, long searchResultHandler,
|
||||
Bitmap bitmap, RenderingRuleSearchRequest render);
|
||||
|
||||
public static native int getCpuCount();
|
||||
|
|
|
@ -2,10 +2,12 @@ build :
|
|||
cd protobuf; $(MAKE)
|
||||
cd png; $(MAKE)
|
||||
cd skia; $(MAKE)
|
||||
cd freetype; $(MAKE)
|
||||
cd osmand; $(MAKE)
|
||||
|
||||
clean :
|
||||
cd protobuf; $(MAKE) clean
|
||||
cd png; $(MAKE) clean
|
||||
cd skia; $(MAKE) clean
|
||||
cd freetype; $(MAKE) clean
|
||||
cd osmand; $(MAKE) clean
|
||||
|
|
|
@ -22,7 +22,7 @@ CPPFLAGS := \
|
|||
-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=0 \
|
||||
-DSK_RELEASE \
|
||||
-DGR_RELEASE=1 \
|
||||
-c -Fpic -I$(JAVA_HOME)/include \
|
||||
-c -fPIC -I$(JAVA_HOME)/include \
|
||||
-DHASH_MAP_GNU \
|
||||
$(C_INCLUDES)
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ MapDataObject* readMapDataObject(CodedInputStream* input, MapTreeBounds* tree, S
|
|||
int px = tree->left & MASK_TO_READ;
|
||||
int py = tree->top & MASK_TO_READ;
|
||||
bool contains = false;
|
||||
long long id = 0;
|
||||
int64 id = 0;
|
||||
int minX = INT_MAX;
|
||||
int maxX = 0;
|
||||
int minY = INT_MAX;
|
||||
|
@ -484,10 +484,10 @@ MapDataObject* readMapDataObject(CodedInputStream* input, MapTreeBounds* tree, S
|
|||
break;
|
||||
default: {
|
||||
if (WireFormatLite::GetTagWireType(t) == WireFormatLite::WIRETYPE_END_GROUP) {
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
if (!skipUnknownFields(input, t)) {
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ bool searchMapTreeBounds(CodedInputStream* input, MapTreeBounds* current, MapTre
|
|||
}
|
||||
|
||||
bool readMapDataBlocks(CodedInputStream* input, SearchQuery* req, MapTreeBounds* tree, MapIndex* root) {
|
||||
long long baseId = 0;
|
||||
int64 baseId = 0;
|
||||
int tag;
|
||||
std::vector< MapDataObject* > results;
|
||||
while ((tag = input->ReadTag()) != 0) {
|
||||
|
|
|
@ -181,9 +181,6 @@ struct SearchQuery {
|
|||
|
||||
SearchQuery(int l, int r, int t, int b, RenderingRuleSearchRequest* req, ResultPublisher* publisher) :
|
||||
req(req), left(l), right(r), top(t), bottom(b),publisher(publisher) {
|
||||
if(publisher == NULL) {
|
||||
publisher = new ResultPublisher();
|
||||
}
|
||||
numberOfAcceptedObjects = numberOfVisitedObjects = 0;
|
||||
numberOfAcceptedSubtrees = numberOfReadSubtrees = 0;
|
||||
ocean = land = false;
|
||||
|
|
|
@ -18,7 +18,7 @@ JavaVM* globalJVM = NULL;
|
|||
void loadJniRenderingContext(JNIEnv* env);
|
||||
void loadJniRenderingRules(JNIEnv* env);
|
||||
|
||||
static int simplePngSize = 93;
|
||||
static const int simplePngSize = 93;
|
||||
static void* simplePng = new uint8[simplePngSize]{
|
||||
0x89 ,0x50 ,0x4E ,0x47 ,0x0D ,0x0A ,0x1A ,0x0A ,
|
||||
0x00 ,0x00 ,0x00 ,0x0D ,0x49 ,0x48 ,0x44 ,0x52 ,
|
||||
|
@ -60,7 +60,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
|
|||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL Java_net_osmand_NativeLibrary_deleteSearchResult(JNIEnv* ienv,
|
||||
jobject obj, jint searchResult) {
|
||||
jobject obj, jlong searchResult) {
|
||||
ResultPublisher* result = (ResultPublisher*) searchResult;
|
||||
if(result != NULL){
|
||||
delete result;
|
||||
|
@ -119,7 +119,7 @@ RenderingRuleSearchRequest* initSearchRequest(JNIEnv* env, jobject renderingRule
|
|||
}
|
||||
|
||||
|
||||
extern "C" JNIEXPORT jint JNICALL Java_net_osmand_NativeLibrary_searchNativeObjectsForRendering(JNIEnv* ienv,
|
||||
extern "C" JNIEXPORT jlong JNICALL Java_net_osmand_NativeLibrary_searchNativeObjectsForRendering(JNIEnv* ienv,
|
||||
jobject obj, jint sleft, jint sright, jint stop, jint sbottom, jint zoom,
|
||||
jobject renderingRuleSearchRequest, bool skipDuplicates, jobject objInterrupted, jstring msgNothingFound) {
|
||||
RenderingRuleSearchRequest* req = initSearchRequest(ienv, renderingRuleSearchRequest);
|
||||
|
@ -137,7 +137,7 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_NativeLibrary_searchNativeObje
|
|||
|
||||
ResultPublisher* res = searchObjectsForRendering(&q, skipDuplicates, getString(ienv, msgNothingFound));
|
||||
delete req;
|
||||
return (jint) j;
|
||||
return (jlong) j;
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ extern "C" JNIEXPORT jint JNICALL Java_net_osmand_NativeLibrary_searchNativeObje
|
|||
#include <android/bitmap.h>
|
||||
|
||||
extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRenderingDirect( JNIEnv* ienv, jobject obj,
|
||||
jobject renderingContext, jint searchResult, jobject targetBitmap, jobject renderingRuleSearchRequest) {
|
||||
jobject renderingContext, jlong searchResult, jobject targetBitmap, jobject renderingRuleSearchRequest) {
|
||||
|
||||
// libJniGraphics interface
|
||||
typedef int (*PTR_AndroidBitmap_getInfo)(JNIEnv*, jobject, AndroidBitmapInfo*);
|
||||
|
@ -266,7 +266,7 @@ extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_plus_render_NativeOsmandLib
|
|||
void* bitmapData = NULL;
|
||||
size_t bitmapDataSize = 0;
|
||||
extern "C" JNIEXPORT jobject JNICALL Java_net_osmand_NativeLibrary_generateRenderingIndirect( JNIEnv* ienv,
|
||||
jobject obj, jobject renderingContext, jint searchResult, jboolean isTransparent,
|
||||
jobject obj, jobject renderingContext, jlong searchResult, jboolean isTransparent,
|
||||
jobject renderingRuleSearchRequest, jboolean encodePNG) {
|
||||
|
||||
JNIRenderingContext rc;
|
||||
|
|
|
@ -11,13 +11,13 @@ void osmand_log_print(int type, const char* msg, ...) {
|
|||
va_list args;
|
||||
va_start( args, msg);
|
||||
if(type == LOG_ERROR) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, msg, args);
|
||||
__android_log_vprint(ANDROID_LOG_ERROR, LOG_TAG, msg, args);
|
||||
} else if(type == LOG_INFO) {
|
||||
__android_log_print(ANDROID_LOG_INFO, LOG_TAG, msg, args);
|
||||
__android_log_vprint(ANDROID_LOG_INFO, LOG_TAG, msg, args);
|
||||
} else if(type == LOG_WARN) {
|
||||
__android_log_print(ANDROID_LOG_WARN, LOG_TAG, msg, args);
|
||||
__android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, msg, args);
|
||||
} else {
|
||||
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, msg, args);
|
||||
__android_log_vprint(ANDROID_LOG_DEBUG, LOG_TAG, msg, args);
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
@ -191,8 +191,8 @@ void runSimpleRendering( string renderingFileName, string resourceDir, Rendering
|
|||
RenderingRulesStorage* st = new RenderingRulesStorage(renderingFileName.c_str());
|
||||
st->parseRulesFromXmlInputStream(renderingFileName.c_str(), NULL);
|
||||
RenderingRuleSearchRequest* searchRequest = new RenderingRuleSearchRequest(st);
|
||||
SearchQuery q(floor(info->left), floor(info->right), ceil(info->top), ceil(info->bottom), searchRequest,
|
||||
new ResultPublisher());
|
||||
ResultPublisher* publisher = new ResultPublisher();
|
||||
SearchQuery q(floor(info->left), floor(info->right), ceil(info->top), ceil(info->bottom), searchRequest, publisher);
|
||||
q.zoom = info->zoom;
|
||||
|
||||
ResultPublisher* res = searchObjectsForRendering(&q, true, "Nothing found");
|
||||
|
@ -244,6 +244,7 @@ void runSimpleRendering( string renderingFileName, string resourceDir, Rendering
|
|||
} else {
|
||||
osmand_log_print(LOG_INFO, "Tile successfully saved to %s", info->tileFileName.c_str());
|
||||
}
|
||||
delete publisher;
|
||||
delete canvas;
|
||||
delete bitmap;
|
||||
free(bitmapData);
|
||||
|
|
|
@ -390,6 +390,7 @@ void RenderingRulesStorage::parseRulesFromXmlInputStream(const char* filename, R
|
|||
done = true;
|
||||
}
|
||||
if (XML_Parse(parser, buffer, len, done) == XML_STATUS_ERROR) {
|
||||
fclose(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -428,6 +429,7 @@ void RenderingRulesStorage::parseRulesFromXmlInputStream(const char* filename, R
|
|||
}
|
||||
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -248,21 +248,25 @@ void drawOneWayPaints(RenderingContext* rc, SkCanvas* cv, SkPath* p) {
|
|||
p->setStrokeWidth(1);
|
||||
p->setPathEffect(arrowDashEffect1)->unref();
|
||||
oneWayPaints.push_back(*p);
|
||||
delete p;
|
||||
|
||||
p = oneWayPaint();
|
||||
p->setStrokeWidth(2);
|
||||
p->setPathEffect(arrowDashEffect2)->unref();
|
||||
oneWayPaints.push_back(*p);
|
||||
delete p;
|
||||
|
||||
p = oneWayPaint();
|
||||
p->setStrokeWidth(3);
|
||||
p->setPathEffect(arrowDashEffect3)->unref();
|
||||
oneWayPaints.push_back(*p);
|
||||
delete p;
|
||||
|
||||
p = oneWayPaint();
|
||||
p->setStrokeWidth(4);
|
||||
p->setPathEffect(arrowDashEffect4)->unref();
|
||||
oneWayPaints.push_back(*p);
|
||||
delete p;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < oneWayPaints.size(); i++) {
|
||||
|
|
|
@ -4,7 +4,7 @@ CPP_FILE_EXTENSION = cc
|
|||
LIBNAME := libproto.a
|
||||
PREBUILT_DIR = ../jni-prebuilt/linux-x86/
|
||||
OBJECTS = $(LOCAL_SRC_FILES:%.$(CPP_FILE_EXTENSION)=build/obj/%.o)
|
||||
CPPFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI -I.
|
||||
CPPFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI -I. -fPIC
|
||||
LDLIBS = -lpthread
|
||||
|
||||
target : $(PREBUILT_DIR)/$(LIBNAME)
|
||||
|
|
|
@ -29,6 +29,7 @@ CPPFLAGS := -DSK_RELEASE \
|
|||
-DNDEBUG \
|
||||
-fno-rtti \
|
||||
-fno-exceptions \
|
||||
-fPIC \
|
||||
$(C_INCLUDES)
|
||||
|
||||
LDLIBS = -lpthread
|
||||
|
|
Loading…
Reference in a new issue