diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index fae1363ae9..96cff9953d 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -384,6 +384,7 @@ public class MapRenderRepositories { currentRenderingContext.width = (int) (requestedBox.getTileWidth() * OsmandRenderer.TILE_SIZE); currentRenderingContext.height = (int) (requestedBox.getTileHeight() * OsmandRenderer.TILE_SIZE); currentRenderingContext.nightMode = nightMode; + currentRenderingContext.highResMode = prefs.USE_HIGH_RES_MAPS.get(); if (checkWhetherInterrupted()) { return; } diff --git a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java index 5b41d7a64e..f87668d99a 100644 --- a/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java +++ b/OsmAnd/src/net/osmand/plus/render/OsmandRenderer.java @@ -106,6 +106,7 @@ public class OsmandRenderer { /*package*/ static class RenderingContext { public boolean interrupted = false; public boolean nightMode = false; + public boolean highResMode = false; List textToDraw = new ArrayList(); List iconsToDraw = new ArrayList(); @@ -357,7 +358,7 @@ public class OsmandRenderer { notifyListeners(notifyList); long beforeIconTextTime = System.currentTimeMillis() - now; - int skewConstant = (int) (16 * dm.density); + int skewConstant = (int) getDensityValue(rc, 16); int iconsW = rc.width / skewConstant ; int iconsH = rc.height / skewConstant; @@ -410,6 +411,14 @@ public class OsmandRenderer { } } private final static boolean findAllTextIntersections = true; + + private float getDensityValue(RenderingContext rc, float val) { + if (rc.highResMode) { + return val * dm.density; + } else { + return val; + } + } public void drawTextOverCanvas(RenderingContext rc, Canvas cv, boolean useEnglishNames) { List boundsNotPathIntersect = new ArrayList(); @@ -439,14 +448,18 @@ public class OsmandRenderer { text.text = Junidecode.unidecode(text.text); } RectF bounds = new RectF(); - paintText.setTextSize(text.textSize * dm.density); + if(!rc.highResMode){ + paintText.setTextSize(getDensityValue(rc, text.textSize)); + } else { + paintText.setTextSize(text.textSize); + } paintText.setFakeBoldText(text.bold); boolean horizontalWayDisplay = (text.pathRotate > 45 && text.pathRotate < 135) || (text.pathRotate > 225 && text.pathRotate < 315); float mes = paintText.measureText(text.text) + (!horizontalWayDisplay ? 0 : text.minDistance); // Paint.ascent is negative, so negate it. int ascent = (int) Math.ceil(-paintText.ascent()); int descent = (int) Math.ceil(paintText.descent()); - float textHeight = ascent + descent + (horizontalWayDisplay ? 0 : text.minDistance) + 5 * dm.density; + float textHeight = ascent + descent + (horizontalWayDisplay ? 0 : text.minDistance) + getDensityValue(rc, 5); if(text.drawOnPath == null || horizontalWayDisplay){ @@ -461,8 +474,8 @@ public class OsmandRenderer { if(boundsIntersect.isEmpty()){ boundsIntersect.add(bounds); } else { - final int diff = (int) (3 * dm.density); - final int diff2 = (int) (15 * dm.density); + final int diff = (int) (getDensityValue(rc, 3)); + final int diff2 = (int) (getDensityValue(rc, 15)); // implement binary search int index = Collections.binarySearch(boundsIntersect, bounds, c); if (index < 0) { @@ -545,8 +558,8 @@ public class OsmandRenderer { } Bitmap ico = cachedIcons.get(text.shieldRes); if (ico != null) { - cv.drawBitmap(ico, text.centerX - ico.getWidth() / 2 - 0.5f * dm.density, - text.centerY - text.textSize / 2 - 6.5f * dm.density, + cv.drawBitmap(ico, text.centerX - ico.getWidth() / 2 - getDensityValue(rc, 0.5f), + text.centerY - text.textSize / 2 - getDensityValue(rc, 6.5f), paintIcon); } }