Update shadow paint only for one mode

This commit is contained in:
Victor Shcherb 2011-10-20 22:36:36 +02:00
parent 7ba54c90ed
commit a8f52ba922

View file

@ -703,7 +703,7 @@ public class OsmandRenderer {
} }
render.setInitialTagValueZoom(tag, value, rc.zoom); render.setInitialTagValueZoom(tag, value, rc.zoom);
boolean rendered = render.search(RenderingRulesStorage.POLYGON_RULES); boolean rendered = render.search(RenderingRulesStorage.POLYGON_RULES);
if(!rendered || !updatePaint(render, paint, 0, true)){ if(!rendered || !updatePaint(render, paint, 0, true, rc)){
return; return;
} }
rc.visible++; rc.visible++;
@ -733,7 +733,7 @@ public class OsmandRenderer {
// for test purpose // for test purpose
// render.strokeWidth = 1.5f; // render.strokeWidth = 1.5f;
// render.color = Color.BLACK; // render.color = Color.BLACK;
if (updatePaint(render, paint, 1, false)) { if (updatePaint(render, paint, 1, false, rc)) {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
} }
@ -750,7 +750,7 @@ public class OsmandRenderer {
// rc.main.color = Color.rgb(245, 245, 245); // rc.main.color = Color.rgb(245, 245, 245);
render.setInitialTagValueZoom(pair.tag, pair.value, zoom); render.setInitialTagValueZoom(pair.tag, pair.value, zoom);
boolean rendered = render.search(RenderingRulesStorage.POLYGON_RULES); boolean rendered = render.search(RenderingRulesStorage.POLYGON_RULES);
if(!rendered || !updatePaint(render, paint, 0, true)){ if(!rendered || !updatePaint(render, paint, 0, true, rc)){
return; return;
} }
rc.visible++; rc.visible++;
@ -770,7 +770,7 @@ public class OsmandRenderer {
if (path != null && len > 0) { if (path != null && len > 0) {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
if (updatePaint(render, paint, 1, false)) { if (updatePaint(render, paint, 1, false, rc)) {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
String name = obj.getName(); String name = obj.getName();
@ -780,7 +780,7 @@ public class OsmandRenderer {
} }
} }
private boolean updatePaint(RenderingRuleSearchRequest req, Paint p, int ind, boolean area){ private boolean updatePaint(RenderingRuleSearchRequest req, Paint p, int ind, boolean area, RenderingContext rc){
RenderingRuleProperty rColor; RenderingRuleProperty rColor;
RenderingRuleProperty rStrokeW; RenderingRuleProperty rStrokeW;
RenderingRuleProperty rCap; RenderingRuleProperty rCap;
@ -838,12 +838,16 @@ public class OsmandRenderer {
} }
// do not check shadow color here // do not check shadow color here
// int shadowColor = req.getIntPropertyValue(req.ALL.R_SHADOW_COLOR); if(rc.shadowRenderingMode != 1) {
// int shadowLayer = req.getIntPropertyValue(req.ALL.R_SHADOW_RADIUS); paint.clearShadowLayer();
// if(shadowColor == 0){ } else {
// shadowLayer = 0; int shadowColor = req.getIntPropertyValue(req.ALL.R_SHADOW_COLOR);
// } int shadowLayer = req.getIntPropertyValue(req.ALL.R_SHADOW_RADIUS);
// p.setShadowLayer(shadowLayer, 0, 0, shadowColor); if (shadowColor == 0) {
shadowLayer = 0;
}
p.setShadowLayer(shadowLayer, 0, 0, shadowColor);
}
} else { } else {
p.setShader(null); p.setShader(null);
p.clearShadowLayer(); p.clearShadowLayer();
@ -968,7 +972,7 @@ public class OsmandRenderer {
render.setInitialTagValueZoom(pair.tag, pair.value, rc.zoom); render.setInitialTagValueZoom(pair.tag, pair.value, rc.zoom);
render.setIntFilter(render.ALL.R_LAYER, layer); render.setIntFilter(render.ALL.R_LAYER, layer);
boolean rendered = render.search(RenderingRulesStorage.LINE_RULES); boolean rendered = render.search(RenderingRulesStorage.LINE_RULES);
if(!rendered || !updatePaint(render, paint, 0, false)){ if(!rendered || !updatePaint(render, paint, 0, false, rc)){
return; return;
} }
boolean oneway = false; boolean oneway = false;
@ -1023,13 +1027,10 @@ public class OsmandRenderer {
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 {
if(rc.shadowRenderingMode != 1) {
paint.clearShadowLayer();
}
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
if (updatePaint(render, paint, 1, false)) { if (updatePaint(render, paint, 1, false, rc)) {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
if (updatePaint(render, paint, 2, false)) { if (updatePaint(render, paint, 2, false, rc)) {
canvas.drawPath(path, paint); canvas.drawPath(path, paint);
} }
} }