Fix issue with transparent no-polygons
This commit is contained in:
parent
41caeaaaa3
commit
d6faeb74d8
3 changed files with 47 additions and 27 deletions
|
@ -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$
|
if(req.numberOfVisitedObjects > 0) {
|
||||||
log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
|
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();
|
return req.getSearchResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -594,7 +594,11 @@ public class MapRenderRepositories {
|
||||||
if(reuse != null){
|
if(reuse != null){
|
||||||
log.warn(String.format("Create new image ? %d != %d (w) %d != %d (h) ", currentRenderingContext.width, reuse.getWidth(), currentRenderingContext.height, reuse.getHeight()));
|
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.bmp = bmp;
|
||||||
this.bmpLocation = tileRect;
|
this.bmpLocation = tileRect;
|
||||||
|
|
|
@ -27,9 +27,12 @@ import net.osmand.util.MapUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Bitmap.Config;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -52,10 +55,26 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
|
|
||||||
protected final static int LOWEST_ZOOM_TO_ROTATE = 9;
|
protected final static int LOWEST_ZOOM_TO_ROTATE = 9;
|
||||||
private boolean MEASURE_FPS = false;
|
private boolean MEASURE_FPS = false;
|
||||||
private int fpsMeasureCount = 0;
|
private FPSMeasurement main = new FPSMeasurement();
|
||||||
private int fpsMeasureMs = 0;
|
private FPSMeasurement additional = new FPSMeasurement();
|
||||||
private long fpsFirstMeasurement = 0;
|
private class FPSMeasurement {
|
||||||
private float fps;
|
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;
|
protected static final int emptyTileDivisor = 16;
|
||||||
|
|
||||||
|
@ -347,18 +366,15 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshBaseMapInternal(RotatedTileBox tileBox, DrawSettings drawSettings) {
|
||||||
|
// bmp = Bitmap.createBitmap(currentRenderingContext.width, currentRenderingContext.height, Config.ARGB_8888);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshMapInternal(boolean updateVectorRendering) {
|
private void refreshMapInternal(boolean updateVectorRendering) {
|
||||||
handler.removeMessages(1);
|
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();
|
SurfaceHolder holder = getHolder();
|
||||||
|
long ms = SystemClock.elapsedRealtime();
|
||||||
synchronized (holder) {
|
synchronized (holder) {
|
||||||
Canvas canvas = holder.lockCanvas();
|
Canvas canvas = holder.lockCanvas();
|
||||||
if (canvas != null) {
|
if (canvas != null) {
|
||||||
|
@ -369,27 +385,22 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
currentViewport.getCenterPixelY() != cy) {
|
currentViewport.getCenterPixelY() != cy) {
|
||||||
currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy);
|
currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy);
|
||||||
}
|
}
|
||||||
|
// make copy to avoid concurrency
|
||||||
boolean nightMode = application.getDaynightHelper().isNightMode();
|
boolean nightMode = application.getDaynightHelper().isNightMode();
|
||||||
|
RotatedTileBox viewportToDraw = currentViewport.copy();
|
||||||
|
DrawSettings drawSettings = new DrawSettings(nightMode, updateVectorRendering);
|
||||||
if (nightMode) {
|
if (nightMode) {
|
||||||
canvas.drawARGB(255, 100, 100, 100);
|
canvas.drawARGB(255, 100, 100, 100);
|
||||||
} else {
|
} else {
|
||||||
canvas.drawARGB(255, 225, 225, 225);
|
canvas.drawARGB(255, 225, 225, 225);
|
||||||
}
|
}
|
||||||
// make copy to avoid concurrency
|
drawOverMap(canvas, viewportToDraw, drawSettings, false);
|
||||||
drawOverMap(canvas, currentViewport.copy(), new DrawSettings(nightMode, updateVectorRendering), false);
|
|
||||||
} finally {
|
} finally {
|
||||||
holder.unlockCanvasAndPost(canvas);
|
holder.unlockCanvasAndPost(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MEASURE_FPS) {
|
if (MEASURE_FPS) {
|
||||||
fpsMeasureMs += SystemClock.elapsedRealtime() - ms;
|
main.calculateFPS(ms, SystemClock.elapsedRealtime());
|
||||||
fpsMeasureCount++;
|
|
||||||
if (fpsMeasureCount > 10 || (ms - fpsFirstMeasurement) > 400) {
|
|
||||||
fpsFirstMeasurement = ms;
|
|
||||||
fps = (1000f * fpsMeasureCount / fpsMeasureMs);
|
|
||||||
fpsMeasureCount = 0;
|
|
||||||
fpsMeasureMs = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -403,7 +414,10 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getFPS(){
|
public float getFPS(){
|
||||||
return fps;
|
return main.fps;
|
||||||
|
}
|
||||||
|
public float getSecondaryFPS(){
|
||||||
|
return additional.fps;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings, boolean
|
private void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings, boolean
|
||||||
|
|
Loading…
Reference in a new issue