diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 8ae1fb2565..e5d163c2a4 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -480,8 +480,10 @@ public class BinaryMapIndexReader { } } } - log.info("Search is done. Visit " + req.numberOfVisitedObjects + " objects. Read " + req.numberOfAcceptedObjects + " objects."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + if(req.numberOfVisitedObjects > 0) { + log.debug("Search is done. Visit " + req.numberOfVisitedObjects + " objects. Read " + req.numberOfAcceptedObjects + " objects."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + log.debug("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + } return req.getSearchResults(); } diff --git a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java index 46e55fd9df..d916878ac9 100644 --- a/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/plus/render/MapRenderRepositories.java @@ -594,7 +594,11 @@ public class MapRenderRepositories { if(reuse != null){ log.warn(String.format("Create new image ? %d != %d (w) %d != %d (h) ", currentRenderingContext.width, reuse.getWidth(), currentRenderingContext.height, reuse.getHeight())); } - bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.RGB_565); + if(transparent) { + bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888); + } else { + bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.RGB_565); + } } this.bmp = bmp; this.bmpLocation = tileRect; diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 6c9972bf1b..9cf1b6a622 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -27,9 +27,12 @@ import net.osmand.util.MapUtils; import org.apache.commons.logging.Log; import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Bitmap.Config; import android.graphics.Paint.Style; import android.graphics.PointF; import android.os.Handler; @@ -52,10 +55,26 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall protected final static int LOWEST_ZOOM_TO_ROTATE = 9; private boolean MEASURE_FPS = false; - private int fpsMeasureCount = 0; - private int fpsMeasureMs = 0; - private long fpsFirstMeasurement = 0; - private float fps; + private FPSMeasurement main = new FPSMeasurement(); + private FPSMeasurement additional = new FPSMeasurement(); + private class FPSMeasurement { + int fpsMeasureCount = 0; + int fpsMeasureMs = 0; + long fpsFirstMeasurement = 0; + float fps; + + void calculateFPS(long start, long end) { + fpsMeasureMs += end - start; + fpsMeasureCount++; + if (fpsMeasureCount > 10 || (start - fpsFirstMeasurement) > 400) { + fpsFirstMeasurement = start; + fps = (1000f * fpsMeasureCount / fpsMeasureMs); + fpsMeasureCount = 0; + fpsMeasureMs = 0; + } + } + } + protected static final int emptyTileDivisor = 16; @@ -346,19 +365,16 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall } return settings; } + + private void refreshBaseMapInternal(RotatedTileBox tileBox, DrawSettings drawSettings) { +// bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888); + + } private void refreshMapInternal(boolean updateVectorRendering) { handler.removeMessages(1); - long ms = SystemClock.elapsedRealtime(); - boolean useInternet = getSettings().USE_INTERNET_TO_DOWNLOAD_TILES.get(); - if (useInternet) { - if(application != null) { - application.getResourceManager().getMapTileDownloader().refuseAllPreviousRequests(); - } - } - - SurfaceHolder holder = getHolder(); + long ms = SystemClock.elapsedRealtime(); synchronized (holder) { Canvas canvas = holder.lockCanvas(); if (canvas != null) { @@ -369,27 +385,22 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall currentViewport.getCenterPixelY() != cy) { currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy); } + // make copy to avoid concurrency boolean nightMode = application.getDaynightHelper().isNightMode(); + RotatedTileBox viewportToDraw = currentViewport.copy(); + DrawSettings drawSettings = new DrawSettings(nightMode, updateVectorRendering); if (nightMode) { canvas.drawARGB(255, 100, 100, 100); } else { canvas.drawARGB(255, 225, 225, 225); } - // make copy to avoid concurrency - drawOverMap(canvas, currentViewport.copy(), new DrawSettings(nightMode, updateVectorRendering), false); + drawOverMap(canvas, viewportToDraw, drawSettings, false); } finally { holder.unlockCanvasAndPost(canvas); } } if (MEASURE_FPS) { - fpsMeasureMs += SystemClock.elapsedRealtime() - ms; - fpsMeasureCount++; - if (fpsMeasureCount > 10 || (ms - fpsFirstMeasurement) > 400) { - fpsFirstMeasurement = ms; - fps = (1000f * fpsMeasureCount / fpsMeasureMs); - fpsMeasureCount = 0; - fpsMeasureMs = 0; - } + main.calculateFPS(ms, SystemClock.elapsedRealtime()); } } } @@ -403,7 +414,10 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall } public float getFPS(){ - return fps; + return main.fps; + } + public float getSecondaryFPS(){ + return additional.fps; } private void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings, boolean