Implement buffer image to increase FPS

This commit is contained in:
vshcherb 2013-10-16 18:34:32 +02:00
parent ec83f9f72c
commit 0bae5ded80
3 changed files with 10 additions and 12 deletions

View file

@ -818,9 +818,10 @@ public class BinaryMapIndexReader {
} }
} }
if(req.numberOfVisitedObjects > 0) {
log.info("Search is done. Visit " + req.numberOfVisitedObjects + " objects. Read " + req.numberOfAcceptedObjects + " objects."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 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$ log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
return req.getSearchResults(); return req.getSearchResults();
} }
@ -885,8 +886,10 @@ public class BinaryMapIndexReader {
} }
if(req.numberOfVisitedObjects > 0) {
log.info("Search is done. Visit " + req.numberOfVisitedObjects + " objects. Read " + req.numberOfAcceptedObjects + " objects."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 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$ log.info("Read " + req.numberOfReadSubtrees + " subtrees. Go through " + req.numberOfAcceptedSubtrees + " subtrees."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
return req.getSearchResults(); return req.getSearchResults();
} }

View file

@ -144,7 +144,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer {
} }
private RotatedTileBox queryNewData(RotatedTileBox tileBox) { private RotatedTileBox queryNewData(RotatedTileBox tileBox) {
if (queriedBox == null || queriedBox.containsTileBox(tileBox) || Math.abs(queriedBox.getZoom() - tileBox.getZoom()) > ZOOM_THRESHOLD ) { if (queriedBox == null || !queriedBox.containsTileBox(tileBox) || Math.abs(queriedBox.getZoom() - tileBox.getZoom()) > ZOOM_THRESHOLD ) {
tileBox = tileBox.copy(); tileBox = tileBox.copy();
tileBox.increasePixelDimensions(tileBox.getPixWidth() / 2, tileBox.getPixHeight() / 2); tileBox.increasePixelDimensions(tileBox.getPixWidth() / 2, tileBox.getPixHeight() / 2);
AsyncTask<Object, Object, List<BinaryMapDataObject>> task = createNewTask(tileBox); AsyncTask<Object, Object, List<BinaryMapDataObject>> task = createNewTask(tileBox);

View file

@ -457,6 +457,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
if(currentViewport.getPixWidth() != getWidth() || currentViewport.getPixHeight() != getHeight() || if(currentViewport.getPixWidth() != getWidth() || currentViewport.getPixHeight() != getHeight() ||
currentViewport.getCenterPixelY() != cy) { currentViewport.getCenterPixelY() != cy) {
currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy); currentViewport.setPixelDimensions(getWidth(), getHeight(), 0.5f, ratioy);
refreshBufferImage(drawSettings);
} }
// make copy to avoid concurrency // make copy to avoid concurrency
RotatedTileBox viewportToDraw = currentViewport.copy(); RotatedTileBox viewportToDraw = currentViewport.copy();
@ -536,15 +537,9 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
Message msg = Message.obtain(handler, new Runnable() { Message msg = Message.obtain(handler, new Runnable() {
@Override @Override
public void run() { public void run() {
if(bufferBitmap == null) {
System.out.println("St " + System.currentTimeMillis());
}
baseHandler.removeMessages(BASE_REFRESH_MESSAGE); baseHandler.removeMessages(BASE_REFRESH_MESSAGE);
refreshBaseMapInternal(currentViewport.copy(), drawSettings); refreshBaseMapInternal(currentViewport.copy(), drawSettings);
sendRefreshMapMsg(drawSettings, 0); sendRefreshMapMsg(drawSettings, 0);
if(bufferBitmapTmp == null) {
System.out.println("End " + System.currentTimeMillis());
}
} }
}); });
msg.what = BASE_REFRESH_MESSAGE; msg.what = BASE_REFRESH_MESSAGE;