Rendering Rule refactoring

This commit is contained in:
Victor Shcherb 2011-10-23 22:59:36 +02:00
parent 41a76a7480
commit b61215e4de
3 changed files with 116 additions and 100 deletions

View file

@ -22,9 +22,11 @@ jmethodID RenderingRuleSearchRequest_setBooleanFilter;
jmethodID RenderingRuleSearchRequest_search; jmethodID RenderingRuleSearchRequest_search;
jmethodID RenderingRuleSearchRequest_searchI; jmethodID RenderingRuleSearchRequest_searchI;
class RenderingRuleSearchRequest
int getIntPropertyValue(jobject renderingRuleSearch, const char* prop)
{ {
public :
int getIntPropertyValue(const char* prop)
{
jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL); jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL);
jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop, jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop,
"Lnet/osmand/render/RenderingRuleProperty;"); "Lnet/osmand/render/RenderingRuleProperty;");
@ -33,10 +35,10 @@ int getIntPropertyValue(jobject renderingRuleSearch, const char* prop)
env->DeleteLocalRef( all); env->DeleteLocalRef( all);
env->DeleteLocalRef( propObj); env->DeleteLocalRef( propObj);
return res; return res;
} }
jstring getStringPropertyValue(jobject renderingRuleSearch, const char* prop) jstring getStringPropertyValue(const char* prop)
{ {
jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL); jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL);
jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop, jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop,
"Lnet/osmand/render/RenderingRuleProperty;"); "Lnet/osmand/render/RenderingRuleProperty;");
@ -45,10 +47,10 @@ jstring getStringPropertyValue(jobject renderingRuleSearch, const char* prop)
env->DeleteLocalRef( all); env->DeleteLocalRef( all);
env->DeleteLocalRef( propObj); env->DeleteLocalRef( propObj);
return res; return res;
} }
void setIntPropertyFilter(jobject renderingRuleSearch, const char* prop, int filter) void setIntPropertyFilter(const char* prop, int filter)
{ {
jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL); jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL);
jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop, jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop,
"Lnet/osmand/render/RenderingRuleProperty;"); "Lnet/osmand/render/RenderingRuleProperty;");
@ -56,11 +58,11 @@ void setIntPropertyFilter(jobject renderingRuleSearch, const char* prop, int fil
env->CallVoidMethod( renderingRuleSearch, RenderingRuleSearchRequest_setIntFilter, propObj, filter); env->CallVoidMethod( renderingRuleSearch, RenderingRuleSearchRequest_setIntFilter, propObj, filter);
env->DeleteLocalRef( all); env->DeleteLocalRef( all);
env->DeleteLocalRef( propObj); env->DeleteLocalRef( propObj);
} }
float getFloatPropertyValue(jobject renderingRuleSearch, const char* prop) float getFloatPropertyValue(const char* prop)
{ {
jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL); jobject all = env->GetObjectField( renderingRuleSearch, RenderingRuleSearchRequest_ALL);
jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop, jfieldID fid = env->GetFieldID( RenderingRuleStoragePropertiesClass, prop,
"Lnet/osmand/render/RenderingRuleProperty;"); "Lnet/osmand/render/RenderingRuleProperty;");
@ -69,23 +71,37 @@ float getFloatPropertyValue(jobject renderingRuleSearch, const char* prop)
env->DeleteLocalRef( all); env->DeleteLocalRef( all);
env->DeleteLocalRef( propObj); env->DeleteLocalRef( propObj);
return res; return res;
} }
int searchRule(jobject renderingRuleSearch, int type)
{ int searchRule(int type)
{
return env->CallBooleanMethod(renderingRuleSearch, RenderingRuleSearchRequest_search, type); return env->CallBooleanMethod(renderingRuleSearch, RenderingRuleSearchRequest_search, type);
} }
void setInitialTagValueZoom(jobject renderingRuleSearch, jstring tag, jstring value, int zoom) void setInitialTagValueZoom(jstring tag, jstring value, int zoom)
{ {
env->CallVoidMethod(renderingRuleSearch, RenderingRuleSearchRequest_setInitialTagValueZoom, tag, value, zoom); env->CallVoidMethod(renderingRuleSearch, RenderingRuleSearchRequest_setInitialTagValueZoom, tag, value, zoom);
} }
RenderingRuleSearchRequest(jobject rrs) :
renderingRuleSearch(rrs) {
}
private :
jobject renderingRuleSearch;
};
jclass globalRef(jobject o) jclass globalRef(jobject o)
{ {
return (jclass) env->NewGlobalRef( o); return (jclass) env->NewGlobalRef( o);
} }
RenderingRuleSearchRequest* initSearchRequest(jobject renderingRuleSearchRequest)
{
return new RenderingRuleSearchRequest(renderingRuleSearchRequest);
}
void initRenderingRules(JNIEnv* ienv, jobject renderingRuleSearchRequest) void initRenderingRules(JNIEnv* ienv, jobject renderingRuleSearchRequest)
{ {

View file

@ -184,7 +184,7 @@ SkBitmap* getCachedBitmap(RenderingContext* rc, jstring js)
// TODO cache shaders // TODO cache shaders
// TODO path effects // TODO path effects
int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area, RenderingContext* rc) { int updatePaint(RenderingRuleSearchRequest* req, SkPaint* paint, int ind, int area, RenderingContext* rc) {
const char* rColor; const char* rColor;
const char* rStrokeW; const char* rStrokeW;
const char* rCap; const char* rCap;
@ -209,15 +209,15 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
paint->setStyle(SkPaint::kStrokeAndFill_Style); paint->setStyle(SkPaint::kStrokeAndFill_Style);
paint->setStrokeWidth(0); paint->setStrokeWidth(0);
} else { } else {
float stroke = getFloatPropertyValue(renderingRuleSearch, rStrokeW); float stroke = req->getFloatPropertyValue(rStrokeW);
if (!(stroke > 0)) { if (!(stroke > 0)) {
return 0; return 0;
} }
paint->setStyle(SkPaint::kStroke_Style); paint->setStyle(SkPaint::kStroke_Style);
paint->setStrokeWidth(stroke); paint->setStrokeWidth(stroke);
jstring capStr = getStringPropertyValue(renderingRuleSearch, rCap); jstring capStr = req->getStringPropertyValue(rCap);
jstring pathEffStr = getStringPropertyValue(renderingRuleSearch, rPathEff); jstring pathEffStr = req->getStringPropertyValue(rPathEff);
if (capStr != NULL && env->GetStringLength(capStr) > 0) { if (capStr != NULL && env->GetStringLength(capStr) > 0) {
const char* cap = env->GetStringUTFChars(capStr, NULL); const char* cap = env->GetStringUTFChars(capStr, NULL);
@ -247,11 +247,11 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
env->DeleteLocalRef(pathEffStr); env->DeleteLocalRef(pathEffStr);
} }
int color = getIntPropertyValue(renderingRuleSearch, rColor); int color = req->getIntPropertyValue(rColor);
paint->setColor(color); paint->setColor(color);
if (ind == 0) { if (ind == 0) {
jstring shader = getStringPropertyValue(renderingRuleSearch, "R_SHADER"); jstring shader = req->getStringPropertyValue("R_SHADER");
if(shader != NULL){ if(shader != NULL){
SkBitmap* bmp = getCachedBitmap(rc, shader); SkBitmap* bmp = getCachedBitmap(rc, shader);
if(bmp == NULL) { if(bmp == NULL) {
@ -272,8 +272,8 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
if (rc->shadowRenderingMode != 1 || ind != 0) { if (rc->shadowRenderingMode != 1 || ind != 0) {
paint->setLooper(NULL); paint->setLooper(NULL);
} else { } else {
int shadowColor = getIntPropertyValue(renderingRuleSearch, "R_SHADOW_COLOR"); int shadowColor = req->getIntPropertyValue("R_SHADOW_COLOR");
int shadowLayer = getIntPropertyValue(renderingRuleSearch, "R_SHADOW_RADIUS"); int shadowLayer = req->getIntPropertyValue("R_SHADOW_RADIUS");
if (shadowColor == 0) { if (shadowColor == 0) {
shadowLayer = 0; shadowLayer = 0;
} }
@ -285,10 +285,10 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
return 1; return 1;
} }
void drawPolyline(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCanvas* cv, SkPaint* paint, void drawPolyline(jobject binaryMapDataObject, RenderingRuleSearchRequest* req, SkCanvas* cv, SkPaint* paint,
RenderingContext* rc, jobject pair, int layer, int drawOnlyShadow) RenderingContext* rc, jobject pair, int layer, int drawOnlyShadow)
{ {
if (renderingRuleSearch == NULL || pair == NULL) { if (req == NULL || pair == NULL) {
return; return;
} }
jint length = env->CallIntMethod( binaryMapDataObject, jint length = env->CallIntMethod( binaryMapDataObject,
@ -300,18 +300,18 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
jstring value = (jstring ) env->GetObjectField( pair, TagValuePair_value); jstring value = (jstring ) env->GetObjectField( pair, TagValuePair_value);
// __android_log_print(ANDROID_LOG_WARN, "net.osmand", "About to search"); // __android_log_print(ANDROID_LOG_WARN, "net.osmand", "About to search");
setInitialTagValueZoom(renderingRuleSearch, tag, value, rc->zoom); req->setInitialTagValueZoom(tag, value, rc->zoom);
setIntPropertyFilter(renderingRuleSearch, "R_LAYER", layer); req->setIntPropertyFilter("R_LAYER", layer);
// TODO oneway // TODO oneway
// int oneway = 0; // int oneway = 0;
//if(rc -> zoom >= 16 && "highway".equals(pair.tag) && MapRenderingTypes.isOneWayWay(obj.getHighwayAttributes())){ //if(rc -> zoom >= 16 && "highway".equals(pair.tag) && MapRenderingTypes.isOneWayWay(obj.getHighwayAttributes())){
//strcmp("highway") oneway = 1; //strcmp("highway") oneway = 1;
//} //}
int rendered = searchRule(renderingRuleSearch,2); int rendered = req->searchRule(2);
env->DeleteLocalRef( tag); env->DeleteLocalRef( tag);
env->DeleteLocalRef( value); env->DeleteLocalRef( value);
if (!rendered || !updatePaint(renderingRuleSearch, paint, 0, 0, rc)) { if (!rendered || !updatePaint(req,paint, 0, 0, rc)) {
return; return;
} }
@ -335,9 +335,9 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
//drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius); //drawPolylineShadow(canvas, rc, path, shadowColor, shadowRadius);
} else { } else {
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
if (updatePaint(renderingRuleSearch, paint, 1, 0, rc)) { if (updatePaint(req, paint, 1, 0, rc)) {
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
if (updatePaint(renderingRuleSearch, paint, 2, 0, rc)) { if (updatePaint(req, paint, 2, 0, rc)) {
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
} }
} }
@ -356,20 +356,20 @@ int updatePaint(jobject renderingRuleSearch, SkPaint* paint, int ind, int area,
} }
} }
void drawMultiPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCanvas* cv, SkPaint* paint, void drawMultiPolygon(jobject binaryMapDataObject,RenderingRuleSearchRequest* req, SkCanvas* cv, SkPaint* paint,
RenderingContext* rc) { RenderingContext* rc) {
if (renderingRuleSearch == NULL) { if (req == NULL) {
return; return;
} }
jstring tag = (jstring) env->CallObjectMethod(binaryMapDataObject, MultiPolygon_getTag); jstring tag = (jstring) env->CallObjectMethod(binaryMapDataObject, MultiPolygon_getTag);
jstring value = (jstring) env->CallObjectMethod(binaryMapDataObject, MultiPolygon_getValue); jstring value = (jstring) env->CallObjectMethod(binaryMapDataObject, MultiPolygon_getValue);
setInitialTagValueZoom(renderingRuleSearch, tag, value, rc->zoom); req->setInitialTagValueZoom(tag, value, rc->zoom);
int rendered = searchRule(renderingRuleSearch, 3); int rendered = req->searchRule(3);
env->DeleteLocalRef(tag); env->DeleteLocalRef(tag);
env->DeleteLocalRef(value); env->DeleteLocalRef(value);
if (!rendered || !updatePaint(renderingRuleSearch, paint, 0, 1, rc)) { if (!rendered || !updatePaint(req, paint, 0, 1, rc)) {
return; return;
} }
@ -404,14 +404,14 @@ void drawMultiPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch,
// for test purpose // for test purpose
// render.strokeWidth = 1.5f; // render.strokeWidth = 1.5f;
// render.color = Color.BLACK; // render.color = Color.BLACK;
if (updatePaint(renderingRuleSearch, paint, 1, 0, rc)) { if (updatePaint(req, paint, 1, 0, rc)) {
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
} }
} }
void drawPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCanvas* cv, SkPaint* paint, void drawPolygon(jobject binaryMapDataObject, RenderingRuleSearchRequest* req, SkCanvas* cv, SkPaint* paint,
RenderingContext* rc, jobject pair) { RenderingContext* rc, jobject pair) {
if (renderingRuleSearch == NULL || pair == NULL) { if (req == NULL || pair == NULL) {
return; return;
} }
jint length = env->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getPointsLength); jint length = env->CallIntMethod(binaryMapDataObject, BinaryMapDataObject_getPointsLength);
@ -421,14 +421,14 @@ void drawPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCan
jstring tag = (jstring) env->GetObjectField(pair, TagValuePair_tag); jstring tag = (jstring) env->GetObjectField(pair, TagValuePair_tag);
jstring value = (jstring) env->GetObjectField(pair, TagValuePair_value); jstring value = (jstring) env->GetObjectField(pair, TagValuePair_value);
setInitialTagValueZoom(renderingRuleSearch, tag, value, rc->zoom); req->setInitialTagValueZoom(tag, value, rc->zoom);
int rendered = searchRule(renderingRuleSearch, 3); int rendered = req->searchRule(3);
env->DeleteLocalRef(tag); env->DeleteLocalRef(tag);
env->DeleteLocalRef(value); env->DeleteLocalRef(value);
float xText = 0; float xText = 0;
float yText = 0; float yText = 0;
if (!rendered || !updatePaint(renderingRuleSearch, paint, 0, 1, rc)) { if (!rendered || !updatePaint(req, paint, 0, 1, rc)) {
return; return;
} }
@ -449,7 +449,7 @@ void drawPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCan
} }
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
if (updatePaint(renderingRuleSearch, paint, 1, 0, rc)) { if (updatePaint(req, paint, 1, 0, rc)) {
cv->drawPath(path, *paint); cv->drawPath(path, *paint);
} }
// TODO polygon text // TODO polygon text
@ -460,19 +460,19 @@ void drawPolygon(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCan
// } // }
} }
void drawPoint(jobject binaryMapDataObject, jobject renderingRuleSearch, SkCanvas* cv, SkPaint* paint, void drawPoint(jobject binaryMapDataObject, RenderingRuleSearchRequest* req, SkCanvas* cv, SkPaint* paint,
RenderingContext* rc, jobject pair, int renderText) RenderingContext* rc, jobject pair, int renderText)
{ {
if (renderingRuleSearch == NULL || pair == NULL) { if (req == NULL || pair == NULL) {
return; return;
} }
jstring tag = (jstring) env->GetObjectField(pair, TagValuePair_tag); jstring tag = (jstring) env->GetObjectField(pair, TagValuePair_tag);
jstring value = (jstring) env->GetObjectField(pair, TagValuePair_value); jstring value = (jstring) env->GetObjectField(pair, TagValuePair_value);
setInitialTagValueZoom(renderingRuleSearch, tag, value, rc->zoom); req->setInitialTagValueZoom(tag, value, rc->zoom);
searchRule(renderingRuleSearch, 1); req->searchRule(1);
jstring resId = getStringPropertyValue(renderingRuleSearch, "R_ICON"); jstring resId = req->getStringPropertyValue("R_ICON");
SkBitmap* bmp = getCachedBitmap(rc, resId); SkBitmap* bmp = getCachedBitmap(rc, resId);
jstring name = NULL; jstring name = NULL;
if (renderText) { if (renderText) {
@ -528,12 +528,12 @@ int getNegativeWayLayer(int type) {
return 0; return 0;
} }
void drawObject(RenderingContext* rc, jobject binaryMapDataObject, SkCanvas* cv, jobject renderingRuleSearch, void drawObject(RenderingContext* rc, jobject binaryMapDataObject, SkCanvas* cv, RenderingRuleSearchRequest* req,
SkPaint* paint, int l, int renderText, int drawOnlyShadow) { 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) {
drawMultiPolygon(binaryMapDataObject, renderingRuleSearch, cv, paint, rc); drawMultiPolygon(binaryMapDataObject, req, cv, paint, rc);
} }
return; return;
} }
@ -547,15 +547,15 @@ void drawObject(RenderingContext* rc, jobject binaryMapDataObject, SkCanvas* cv,
jobject pair = env->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTagValue, l); jobject pair = env->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTagValue, l);
if (t == 1 && !drawOnlyShadow) { if (t == 1 && !drawOnlyShadow) {
// point // point
drawPoint(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair, renderText); drawPoint(binaryMapDataObject, req, cv, paint, rc, pair, renderText);
} else if (t == 2) { } else if (t == 2) {
// polyline // polyline
int layer = getNegativeWayLayer(mainType); int layer = 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, req, cv, paint, rc, pair, layer, drawOnlyShadow);
} else if (t == 3 && !drawOnlyShadow) { } else if (t == 3 && !drawOnlyShadow) {
// polygon // polygon
drawPolygon(binaryMapDataObject, renderingRuleSearch, cv, paint, rc, pair); drawPolygon(binaryMapDataObject, req, cv, paint, rc, pair);
} }
env->DeleteLocalRef(pair); env->DeleteLocalRef(pair);
} }
@ -659,14 +659,15 @@ void drawIconsOverCanvas(RenderingContext* rc, SkCanvas* canvas)
int skewConstant = (int) getDensityValue(rc, 16); int skewConstant = (int) getDensityValue(rc, 16);
int iconsW = rc -> width / skewConstant; int iconsW = rc -> width / skewConstant;
int iconsH = rc -> height / skewConstant; int iconsH = rc -> height / skewConstant;
int len = iconsW * iconsH / 32; int len = (iconsW * iconsH) / 32;
int alreadyDrawnIcons[len]; int alreadyDrawnIcons[len];
size_t i = 0; memset(alreadyDrawnIcons, 0, sizeof(int)*len);
size_t ji = 0;
SkPaint p; SkPaint p;
p.setStyle(SkPaint::kStroke_Style); p.setStyle(SkPaint::kStroke_Style);
for(;i< rc->iconsToDraw.size(); i++) for(;ji< rc->iconsToDraw.size(); ji++)
{ {
IconDrawInfo icon = rc->iconsToDraw.at(i); IconDrawInfo icon = rc->iconsToDraw.at(ji);
if (icon.y >= 0 && icon.y < rc -> height && icon.x >= 0 && icon.x < rc -> width && if (icon.y >= 0 && icon.y < rc -> height && icon.x >= 0 && icon.x < rc -> width &&
icon.bmp != NULL) { icon.bmp != NULL) {
int z = (((int) icon.x / skewConstant) + ((int) icon.y / skewConstant) * iconsW); int z = (((int) icon.x / skewConstant) + ((int) icon.y / skewConstant) * iconsW);
@ -694,7 +695,7 @@ void drawIconsOverCanvas(RenderingContext* rc, SkCanvas* canvas)
void doRendering(jobjectArray binaryMapDataObjects, SkCanvas* canvas, SkPaint* paint, void doRendering(jobjectArray binaryMapDataObjects, SkCanvas* canvas, SkPaint* paint,
jobject renderingRuleSearchRequest, RenderingContext* rc) { RenderingRuleSearchRequest* req, RenderingContext* rc) {
const size_t size = env->GetArrayLength(binaryMapDataObjects); const size_t size = env->GetArrayLength(binaryMapDataObjects);
// put in order map // put in order map
// TODO // TODO
@ -709,7 +710,7 @@ void doRendering(jobjectArray binaryMapDataObjects, SkCanvas* canvas, SkPaint* p
for (; i < size; i++) { for (; i < size; i++) {
jobject binaryMapDataObject = (jobject) env->GetObjectArrayElement(binaryMapDataObjects, i); jobject binaryMapDataObject = (jobject) env->GetObjectArrayElement(binaryMapDataObjects, i);
if (env->IsInstanceOf(binaryMapDataObject, MultiPolygonClass)) { if (env->IsInstanceOf(binaryMapDataObject, MultiPolygonClass)) {
drawObject(rc, binaryMapDataObject, canvas, renderingRuleSearchRequest, paint, 0, 1, 0); drawObject(rc, binaryMapDataObject, canvas, req, paint, 0, 1, 0);
} else { } else {
jintArray types = (jintArray) env->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTypes); jintArray types = (jintArray) env->CallObjectMethod(binaryMapDataObject, BinaryMapDataObject_getTypes);
if (types != NULL) { if (types != NULL) {
@ -717,7 +718,7 @@ void doRendering(jobjectArray binaryMapDataObjects, SkCanvas* canvas, SkPaint* p
env->DeleteLocalRef(types); env->DeleteLocalRef(types);
int j = 0; int j = 0;
for (; j < sizeTypes; j++) { for (; j < sizeTypes; j++) {
drawObject(rc, binaryMapDataObject, canvas, renderingRuleSearchRequest, paint, j, 1, 0); drawObject(rc, binaryMapDataObject, canvas, req, paint, j, 1, 0);
} }
} }
} }
@ -747,9 +748,7 @@ JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_genera
initLibrary(renderingContext); initLibrary(renderingContext);
initRenderingRules(env, renderingRuleSearchRequest); initRenderingRules(env, renderingRuleSearchRequest);
} }
RenderingRuleSearchRequest* req = initSearchRequest(renderingRuleSearchRequest);
SkPaint* paint = new SkPaint; SkPaint* paint = new SkPaint;
paint->setAntiAlias(true); paint->setAntiAlias(true);
@ -764,11 +763,12 @@ JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_genera
copyRenderingContext(renderingContext, &rc); copyRenderingContext(renderingContext, &rc);
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Rendering image"); __android_log_print(ANDROID_LOG_WARN, "net.osmand", "Rendering image");
doRendering(binaryMapDataObjects, canvas, paint, renderingRuleSearchRequest, &rc); doRendering(binaryMapDataObjects, canvas, paint, req, &rc);
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image"); __android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image");
delete paint; delete paint;
delete canvas; delete canvas;
delete req;
mergeRenderingContext(renderingContext, &rc); mergeRenderingContext(renderingContext, &rc);
sprintf(debugMessage, "Native ok."); sprintf(debugMessage, "Native ok.");

Binary file not shown.