Add timing
This commit is contained in:
parent
a3520e4bc8
commit
6f9fdb2b18
7 changed files with 114 additions and 65 deletions
|
@ -99,20 +99,27 @@
|
|||
<filter tag="highway" value="primary" order="55" shadowLevel="1"/>
|
||||
<filter tag="highway" value="secondary" order="54" shadowLevel="1"/>
|
||||
<filter tag="highway" value="tertiary" order="53" shadowLevel="1"/>
|
||||
<filter tag="highway" value="road" order="51" shadowLevel="1"/>
|
||||
<filter tag="highway" value="unclassified" order="51" shadowLevel="1"/>
|
||||
<filter tag="highway" value="residential" order="52" shadowLevel="1"/>
|
||||
<filter tag="highway" value="service" order="52" shadowLevel="1"/>
|
||||
<filter tag="highway" value="living_street" order="47" shadowLevel="1"/>
|
||||
<filter tag="highway" value="track" order="50" shadowLevel="1"/>
|
||||
<filter tag="highway" value="path" order="48" shadowLevel="1"/>
|
||||
|
||||
<group>
|
||||
<filter tag="highway" value="residential" order="52" />
|
||||
<filter tag="highway" value="service" order="52" />
|
||||
<filter tag="highway" value="road" order="51" />
|
||||
<filter tag="highway" value="unclassified" order="51" />
|
||||
<filter tag="highway" value="track" order="50" />
|
||||
<filter tag="highway" value="path" order="48" />
|
||||
<filter tag="highway" value="living_street" order="47" />
|
||||
<groupFilter minzoom="14" shadowLevel="1"/>
|
||||
</group>
|
||||
|
||||
<filter tag="highway" value="construction" order="46" shadowLevel="1"/>
|
||||
<filter tag="highway" value="proposed" order="45" shadowLevel="1"/>
|
||||
<filter tag="highway" value="motorway_link" order="44" shadowLevel="1"/>
|
||||
<filter tag="highway" value="trunk_link" order="43" shadowLevel="1"/>
|
||||
<filter tag="highway" value="primary_link" order="42" shadowLevel="1"/>
|
||||
<filter tag="highway" value="secondary_link" order="41" shadowLevel="1"/>
|
||||
<group>
|
||||
<filter tag="highway" value="construction" order="46" />
|
||||
<filter tag="highway" value="proposed" order="45" />
|
||||
<filter tag="highway" value="motorway_link" order="44"/>
|
||||
<filter tag="highway" value="trunk_link" order="43" />
|
||||
<filter tag="highway" value="primary_link" order="42"/>
|
||||
<filter tag="highway" value="secondary_link" order="41"/>
|
||||
<groupFilter minzoom="15" shadowLevel="1"/>
|
||||
</group>
|
||||
|
||||
<filter appMode="pedestrian" tag="highway" value="pedestrian" order="60" />
|
||||
<filter appMode="pedestrian" tag="highway" value="cycleway" order="45" />
|
||||
|
@ -143,11 +150,11 @@
|
|||
</order>
|
||||
|
||||
|
||||
<!-- PRIORITY Input to filter : tag, value, zoom [minzoom, maxzoom], textLength, ref, textOrder (default=20) -->
|
||||
<!-- PRIORITY Input to filter : tag, value, zoom [minzoom, maxzoom], textLength, ref, textOrder (default=100) -->
|
||||
<text>
|
||||
<!-- Highway ref -->
|
||||
<filter minzoom="10" tag="highway" value="motorway" ref="true" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true"
|
||||
textOrder="6">
|
||||
<filter minzoom="10" tag="highway" value="motorway" ref="true" textMinDistance="150" textColor="#ffffff" textSize="12" textBold="true"
|
||||
textOrder="7">
|
||||
<filter textLength="1" textShield="mot_shield1" />
|
||||
<filter textLength="2" textShield="mot_shield2" />
|
||||
<filter textLength="3" textShield="mot_shield3" />
|
||||
|
@ -156,8 +163,8 @@
|
|||
<filter textLength="6" textShield="mot_shield6" />
|
||||
</filter>
|
||||
|
||||
<filter minzoom="10" tag="highway" value="trunk" ref="true" textMinDistance="70" textColor="#ffffff" textSize="12" textBold="true"
|
||||
textOrder="6">
|
||||
<filter minzoom="10" tag="highway" value="trunk" ref="true" textMinDistance="150" textColor="#ffffff" textSize="12" textBold="true"
|
||||
textOrder="7">
|
||||
<filter textLength="1" textShield="tru_shield1" />
|
||||
<filter textLength="2" textShield="tru_shield2" />
|
||||
<filter textLength="3" textShield="tru_shield3" />
|
||||
|
@ -166,8 +173,8 @@
|
|||
<filter textLength="6" textShield="tru_shield6" />
|
||||
</filter>
|
||||
|
||||
<filter minzoom="11" tag="highway" value="primary" ref="true" textMinDistance="70" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="7">
|
||||
<filter minzoom="11" tag="highway" value="primary" ref="true" textMinDistance="150" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="8">
|
||||
<filter textLength="1" textShield="pri_shield1" />
|
||||
<filter textLength="2" textShield="pri_shield2" />
|
||||
<filter textLength="3" textShield="pri_shield3" />
|
||||
|
@ -176,8 +183,8 @@
|
|||
<filter textLength="6" textShield="pri_shield6" />
|
||||
</filter>
|
||||
|
||||
<filter minzoom="13" tag="highway" value="secondary" ref="true" textMinDistance="70" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="8">
|
||||
<filter minzoom="13" tag="highway" value="secondary" ref="true" textMinDistance="150" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="9">
|
||||
<filter textLength="1" textShield="sec_shield1" />
|
||||
<filter textLength="2" textShield="sec_shield2" />
|
||||
<filter textLength="3" textShield="sec_shield3" />
|
||||
|
@ -186,8 +193,8 @@
|
|||
<filter textLength="6" textShield="sec_shield6" />
|
||||
</filter>
|
||||
|
||||
<filter minzoom="14" tag="highway" value="tertiary" ref="true" textMinDistance="70" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="9">
|
||||
<filter minzoom="14" tag="highway" value="tertiary" ref="true" textMinDistance="150" textColor="#ffffff" textSize="12"
|
||||
textBold="true" textOrder="10">
|
||||
<filter textLength="1" textShield="ter_shield1" />
|
||||
<filter textLength="2" textShield="ter_shield2" />
|
||||
<filter textLength="3" textShield="ter_shield3" />
|
||||
|
@ -290,12 +297,12 @@
|
|||
<filter minzoom="13" textSize="12" textColor="#ff000000" textWrapWidth="10" tag="natural" value="wood" textOrder="10"/>
|
||||
|
||||
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="stream" textOrder="15"/>
|
||||
<filter minzoom="11" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="river" textOrder="10"/>
|
||||
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="70" tag="waterway" value="canal" textOrder="10"/>
|
||||
<filter minzoom="11" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="80" tag="waterway" value="river" textOrder="10"/>
|
||||
<filter minzoom="13" textSize="12" textColor="#6699cc" textOnPath="true" textMinDistance="80" tag="waterway" value="canal" textOrder="10"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="ditch" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#6699cc" textOnPath="true" tag="waterway" value="drain" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock_gate" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="70" tag="waterway" value="lock" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="30" tag="waterway" value="lock_gate" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" textColor="#0066ff" textDy="7" textWrapWidth="30" tag="waterway" value="lock" textOrder="15"/>
|
||||
<filter minzoom="15" textSize="12" tag="waterway" value="dam" textOrder="15"/>
|
||||
|
||||
<filter minzoom="16" textSize="12" textHaloRadius="1" textDy="7" textWrapWidth="20" tag="historic" value="memorial" textColor="#654321">
|
||||
|
|
|
@ -72,6 +72,35 @@ jfieldID getFid(jclass cls,const char* fieldName, const char* sig )
|
|||
return env->GetFieldID( cls, fieldName, sig);
|
||||
}
|
||||
|
||||
class timer {
|
||||
int elapsedTime;
|
||||
timeval startInit;
|
||||
timeval endInit;
|
||||
bool run;
|
||||
public:
|
||||
timer() {
|
||||
elapsedTime = 0;
|
||||
}
|
||||
void start() {
|
||||
if (!run) {
|
||||
gettimeofday(&startInit, NULL);
|
||||
}
|
||||
run = true;
|
||||
}
|
||||
void pause() {
|
||||
if (run) {
|
||||
gettimeofday(&endInit, NULL);
|
||||
elapsedTime += (endInit.tv_sec * 1000 + endInit.tv_usec / 1000)
|
||||
- (startInit.tv_sec * 1000 + startInit.tv_usec / 1000);
|
||||
}
|
||||
run = false;
|
||||
}
|
||||
int getElapsedTime() {
|
||||
pause();
|
||||
return elapsedTime;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct RenderingContext {
|
||||
jobject originalRC;
|
||||
|
@ -83,7 +112,6 @@ struct RenderingContext {
|
|||
float mapTextSize;
|
||||
float density;
|
||||
|
||||
|
||||
float leftX;
|
||||
float topY;
|
||||
int width;
|
||||
|
@ -98,7 +126,8 @@ struct RenderingContext {
|
|||
int pointInsideCount;
|
||||
int visible;
|
||||
int allObjects;
|
||||
int textRendering;
|
||||
timer textRendering;
|
||||
timer nativeOperations;
|
||||
|
||||
// use to calculate points
|
||||
float calcX;
|
||||
|
@ -190,15 +219,19 @@ SkBitmap* getCachedBitmap(RenderingContext* rc, std::string js)
|
|||
if (cachedBitmaps.find(js) != cachedBitmaps.end()) {
|
||||
return cachedBitmaps[js];
|
||||
}
|
||||
rc->nativeOperations.pause();
|
||||
jstring jstr = env->NewStringUTF(js.c_str());
|
||||
jobject bmp = env->CallStaticObjectMethod(RenderingIconsClass, RenderingIcons_getIcon, rc->androidContext, jstr);
|
||||
SkBitmap* res = getNativeBitmap(bmp);
|
||||
rc->nativeOperations.start();
|
||||
|
||||
env->DeleteLocalRef(bmp);
|
||||
env->DeleteLocalRef(jstr);
|
||||
if(res != NULL){
|
||||
res = new SkBitmap(*res);
|
||||
}
|
||||
cachedBitmaps[js] = res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -485,7 +485,7 @@ public:
|
|||
}
|
||||
|
||||
int getIntPropertyValue(RenderingRuleProperty* prop, int def) {
|
||||
if (prop == NULL) {
|
||||
if (prop == NULL || values[prop->id] == -1) {
|
||||
return def;
|
||||
}
|
||||
return values[prop->id];
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "textdraw.cpp"
|
||||
#include "mapObjects.cpp"
|
||||
|
||||
#define NAT_COUNT(rc, op) rc->nativeOperations.pause(); op; rc->nativeOperations.start()
|
||||
|
||||
char debugMessage[1024];
|
||||
|
||||
|
@ -238,7 +239,7 @@ void drawPolylineShadow(SkCanvas* cv, SkPaint* paint, RenderingContext* rc, SkPa
|
|||
// simply draw shadow? difference from option 3 ?
|
||||
// paint->setColor(0xffffffff);
|
||||
paint->setLooper(new SkBlurDrawLooper(shadowRadius, 0, 0, shadowColor))->unref();
|
||||
cv->drawPath(*path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(*path, *paint));
|
||||
}
|
||||
|
||||
// option shadow = 3 with solid border
|
||||
|
@ -247,7 +248,7 @@ void drawPolylineShadow(SkCanvas* cv, SkPaint* paint, RenderingContext* rc, SkPa
|
|||
paint->setStrokeWidth(paint->getStrokeWidth() + shadowRadius * 2);
|
||||
paint->setColor(0xffbababa);
|
||||
// paint->setColor(shadowColor);
|
||||
cv->drawPath(*path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(*path, *paint));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,7 +260,7 @@ SkPaint* oneWayPaint(){
|
|||
oneWay->setAntiAlias(true);
|
||||
return oneWay;
|
||||
}
|
||||
void drawOneWayPaints(SkCanvas* cv, SkPath* p) {
|
||||
void drawOneWayPaints(RenderingContext* rc, SkCanvas* cv, SkPath* p) {
|
||||
if (oneWayPaints.size() == 0) {
|
||||
SkPathEffect* arrowDashEffect1 = new SkDashPathEffect((float []){ 0, 12, 10, 152 }, 4, 0);
|
||||
SkPathEffect* arrowDashEffect2 = new SkDashPathEffect((float[]){ 0, 12, 9, 153 }, 4, 1);
|
||||
|
@ -288,7 +289,7 @@ void drawOneWayPaints(SkCanvas* cv, SkPath* p) {
|
|||
}
|
||||
|
||||
for (size_t i = 0; i < oneWayPaints.size(); i++) {
|
||||
cv->drawPath(*p, oneWayPaints.at(i));
|
||||
NAT_COUNT(rc, cv->drawPath(*p, oneWayPaints.at(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,15 +344,15 @@ void drawPolyline(MapDataObject* mObj, RenderingRuleSearchRequest* req, SkCanvas
|
|||
int shadowRadius = req->getIntPropertyValue(req->props()->R_SHADOW_RADIUS);
|
||||
drawPolylineShadow(cv, paint, rc, &path, shadowColor, shadowRadius);
|
||||
} else {
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
if (updatePaint(req, paint, 1, 0, rc)) {
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
if (updatePaint(req, paint, 2, 0, rc)) {
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
}
|
||||
}
|
||||
if (oneway && !drawOnlyShadow) {
|
||||
drawOneWayPaints(cv, &path);
|
||||
drawOneWayPaints(rc, cv, &path);
|
||||
}
|
||||
if (!drawOnlyShadow && mObj->name.length() > 0) {
|
||||
drawPointText(req, rc,pair.first, pair.second, middlePoint.fX, middlePoint.fY, mObj->name,
|
||||
|
@ -400,12 +401,12 @@ void drawMultiPolygon(MultiPolygonObject* mapObject,RenderingRuleSearchRequest*
|
|||
}
|
||||
}
|
||||
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
// for test purpose
|
||||
// render.strokeWidth = 1.5f;
|
||||
// render.color = Color.BLACK;
|
||||
if (updatePaint(req, paint, 1, 0, rc)) {
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -442,9 +443,9 @@ void drawPolygon(MapDataObject* mObj, RenderingRuleSearchRequest* req, SkCanvas*
|
|||
yText += rc->calcY;
|
||||
}
|
||||
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
if (updatePaint(req, paint, 1, 0, rc)) {
|
||||
cv->drawPath(path, *paint);
|
||||
NAT_COUNT(rc, cv->drawPath(path, *paint));
|
||||
}
|
||||
std::string name = mObj->name;
|
||||
if (name.length() > 0) {
|
||||
|
@ -582,7 +583,7 @@ void mergeRenderingContext(jobject orc, RenderingContext* rc)
|
|||
env->SetIntField( orc, getFid(RenderingContextClass, "pointInsideCount", "I" ) , rc->pointInsideCount);
|
||||
env->SetIntField( orc, getFid(RenderingContextClass, "visible", "I" ) , rc->visible);
|
||||
env->SetIntField( orc, getFid(RenderingContextClass, "allObjects", "I" ) , rc->allObjects);
|
||||
env->SetIntField( orc, getFid(RenderingContextClass, "textRenderingTime", "I" ) , rc->textRendering);
|
||||
env->SetIntField( orc, getFid(RenderingContextClass, "textRenderingTime", "I" ) , rc->textRendering.getElapsedTime());
|
||||
env->DeleteLocalRef(rc->androidContext);
|
||||
|
||||
}
|
||||
|
@ -627,7 +628,7 @@ void drawIconsOverCanvas(RenderingContext* rc, SkCanvas* canvas)
|
|||
if (((ind >> b) & 1) == 0) {
|
||||
alreadyDrawnIcons[i] = ind | (1 << b);
|
||||
SkBitmap* ico = icon.bmp;
|
||||
canvas->drawBitmap(*ico, icon.x - ico->width() / 2, icon.y - ico->height() / 2, &p);
|
||||
NAT_COUNT(rc, canvas->drawBitmap(*ico, icon.x - ico->width() / 2, icon.y - ico->height() / 2, &p));
|
||||
}
|
||||
}
|
||||
if(rc->interrupted()){
|
||||
|
@ -758,14 +759,10 @@ void doRendering(std::vector <BaseMapDataObject* > mapDataObjects, SkCanvas* can
|
|||
objectDrawn(true);
|
||||
drawIconsOverCanvas(rc, canvas);
|
||||
|
||||
struct timeval startInit;
|
||||
struct timeval endInit;
|
||||
gettimeofday(&startInit, NULL);
|
||||
rc->textRendering.start();
|
||||
objectDrawn(true);
|
||||
drawTextOverCanvas(rc, canvas);
|
||||
gettimeofday(&endInit, NULL);
|
||||
|
||||
rc->textRendering = (endInit.tv_sec * 1000 + endInit.tv_usec/1000) - (startInit.tv_sec * 1000 + startInit.tv_usec / 1000);
|
||||
rc->textRendering.pause();
|
||||
}
|
||||
|
||||
|
||||
|
@ -775,24 +772,23 @@ extern "C" {
|
|||
JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_generateRendering( JNIEnv* ienv,
|
||||
jobject obj, jobject renderingContext, jobjectArray binaryMapDataObjects, jobject bmpObj,
|
||||
jboolean useEnglishNames, jobject renderingRuleSearchRequest, jint defaultColor) {
|
||||
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering");
|
||||
struct timeval startInit;
|
||||
struct timeval endInit;
|
||||
gettimeofday(&startInit, NULL);
|
||||
if(!env) {
|
||||
env = ienv;
|
||||
loadLibrary(renderingContext);
|
||||
}
|
||||
|
||||
SkBitmap* bmp = getNativeBitmap(bmpObj);
|
||||
sprintf(debugMessage, "Image w:%d h:%d !", bmp->width(), bmp->height());
|
||||
__android_log_print(ANDROID_LOG_WARN, "net.osmand", debugMessage);
|
||||
|
||||
SkCanvas* canvas = new SkCanvas(*bmp);
|
||||
canvas->drawColor(defaultColor);
|
||||
|
||||
SkPaint* paint = new SkPaint;
|
||||
paint->setAntiAlias(true);
|
||||
|
||||
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Initializing rendering");
|
||||
timer initObjects;
|
||||
initObjects.start();
|
||||
|
||||
|
||||
RenderingRuleSearchRequest* req = initSearchRequest(renderingRuleSearchRequest);
|
||||
|
||||
|
@ -802,11 +798,13 @@ JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_genera
|
|||
|
||||
|
||||
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "Rendering image");
|
||||
gettimeofday(&endInit, NULL);
|
||||
initObjects.pause();
|
||||
|
||||
|
||||
// Main part do rendering
|
||||
rc.nativeOperations.start();
|
||||
doRendering(mapDataObjects, canvas, paint, req, &rc);
|
||||
rc.nativeOperations.pause();
|
||||
|
||||
mergeRenderingContext(renderingContext, &rc);
|
||||
__android_log_print(ANDROID_LOG_WARN, "net.osmand", "End Rendering image");
|
||||
|
@ -817,8 +815,8 @@ JNIEXPORT jstring JNICALL Java_net_osmand_plus_render_NativeOsmandLibrary_genera
|
|||
delete req;
|
||||
deleteObjects(mapDataObjects);
|
||||
|
||||
int lt = (endInit.tv_sec * 1000 + endInit.tv_usec/1000) - (startInit.tv_sec * 1000 + startInit.tv_usec / 1000);
|
||||
sprintf(debugMessage, "Native ok (init %d) ", lt);
|
||||
sprintf(debugMessage, "Native ok (init %d, native op %d) ", initObjects.getElapsedTime(),
|
||||
rc.nativeOperations.getElapsedTime());
|
||||
jstring result = env->NewStringUTF( debugMessage);
|
||||
|
||||
// unloadLibrary();
|
||||
|
|
|
@ -155,7 +155,7 @@ void drawTextOnCanvas(SkCanvas* cv, std::string text, float centerX, float cente
|
|||
}
|
||||
|
||||
|
||||
void drawWrappedText(SkCanvas* cv, TextDrawInfo* text, float textSize, SkPaint& paintText) {
|
||||
void drawWrappedText(RenderingContext* rc, SkCanvas* cv, TextDrawInfo* text, float textSize, SkPaint& paintText) {
|
||||
if(text->textWrap == 0) {
|
||||
// set maximum for all text
|
||||
text->textWrap = 40;
|
||||
|
@ -191,12 +191,16 @@ void drawWrappedText(SkCanvas* cv, TextDrawInfo* text, float textSize, SkPaint&
|
|||
pos++;
|
||||
}
|
||||
if(lastSpace == -1) {
|
||||
rc->nativeOperations.pause();
|
||||
drawTextOnCanvas(cv, text->text.substr(start, pos),
|
||||
text->centerX, text->centerY + line * (textSize + 2), paintText, text->textShadow);
|
||||
rc->nativeOperations.start();
|
||||
start = pos;
|
||||
} else {
|
||||
rc->nativeOperations.pause();
|
||||
drawTextOnCanvas(cv, text->text.substr(start, lastSpace),
|
||||
text->centerX, text->centerY + line * (textSize + 2), paintText, text->textShadow);
|
||||
rc->nativeOperations.start();
|
||||
start = lastSpace + 1;
|
||||
limit += (start - pos) - 1;
|
||||
}
|
||||
|
@ -204,7 +208,9 @@ void drawWrappedText(SkCanvas* cv, TextDrawInfo* text, float textSize, SkPaint&
|
|||
|
||||
}
|
||||
} else {
|
||||
rc->nativeOperations.pause();
|
||||
drawTextOnCanvas(cv, text->text, text->centerX, text->centerY, paintText, text->textShadow);
|
||||
rc->nativeOperations.start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,25 +441,30 @@ void drawTextOverCanvas(RenderingContext* rc, SkCanvas* cv) {
|
|||
paintText.setColor(WHITE_COLOR);
|
||||
paintText.setStyle(SkPaint::kStroke_Style);
|
||||
paintText.setStrokeWidth(2 + text->textShadow);
|
||||
rc->nativeOperations.pause();
|
||||
cv->drawTextOnPathHV(text->text.c_str(), text->text.length(), *text->path, text->hOffset,
|
||||
text->vOffset, paintText);
|
||||
rc->nativeOperations.start();
|
||||
// reset
|
||||
paintText.setStyle(SkPaint::kFill_Style);
|
||||
paintText.setStrokeWidth(2);
|
||||
paintText.setColor(text->textColor);
|
||||
}
|
||||
rc->nativeOperations.pause();
|
||||
cv->drawTextOnPathHV(text->text.c_str(), text->text.length(), *text->path, text->hOffset,
|
||||
text->vOffset, paintText);
|
||||
rc->nativeOperations.start();
|
||||
} else {
|
||||
if (text->shieldRes.length() > 0) {
|
||||
SkBitmap* ico = getCachedBitmap(rc, text->shieldRes);
|
||||
if (ico != NULL) {
|
||||
rc->nativeOperations.pause();
|
||||
cv->drawBitmap(*ico, text->centerX - ico->width() / 2 - 0.5f,
|
||||
text->centerY - ico->height() / 2 - getDensityValue(rc, 4.5f), &paintIcon);
|
||||
rc->nativeOperations.start();
|
||||
}
|
||||
}
|
||||
|
||||
drawWrappedText(cv, text, textSize, paintText);
|
||||
drawWrappedText(rc, cv, text, textSize, paintText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -90,7 +90,7 @@ public class OsmandRenderer {
|
|||
int textWrap = 0;
|
||||
boolean bold = false;
|
||||
String shieldRes = null;
|
||||
int textOrder = 20;
|
||||
int textOrder = 100;
|
||||
|
||||
public void fillProperties(RenderingRuleSearchRequest render, float centerX, float centerY){
|
||||
this.centerX = centerX;
|
||||
|
@ -107,7 +107,7 @@ public class OsmandRenderer {
|
|||
if(render.isSpecified(render.ALL.R_TEXT_SHIELD)) {
|
||||
shieldRes = render.getStringPropertyValue(render.ALL.R_TEXT_SHIELD);
|
||||
}
|
||||
textOrder = render.getIntPropertyValue(render.ALL.R_TEXT_ORDER, 20);
|
||||
textOrder = render.getIntPropertyValue(render.ALL.R_TEXT_ORDER, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue