diff --git a/wrappers/android/build.sh b/wrappers/android/build.sh index dd4dd2977..22eeac3af 100755 --- a/wrappers/android/build.sh +++ b/wrappers/android/build.sh @@ -54,18 +54,20 @@ buildArch() fi } -buildArch "armeabi-v7a" +buildArch "arm64-v8a" retcode=$? if [[ $retcode -ne 0 ]]; then - echo "buildArch(armeabi-v7a) failed with $retcode, exiting..." + echo "buildArch(arm64-v8a) failed with $retcode, exiting..." exit $retcode fi -buildArch "arm64-v8a" +#exit 0; # for testing purposes + +buildArch "armeabi-v7a" retcode=$? if [[ $retcode -ne 0 ]]; then - echo "buildArch(arm64-v8a) failed with $retcode, exiting..." - exit $retcode + echo "buildArch(armeabi-v7a) failed with $retcode, exiting..." + exit $retcode fi buildArch "x86" diff --git a/wrappers/android/src/net/osmand/core/android/MapRendererView.java b/wrappers/android/src/net/osmand/core/android/MapRendererView.java index ebfc26fbd..d698328c4 100644 --- a/wrappers/android/src/net/osmand/core/android/MapRendererView.java +++ b/wrappers/android/src/net/osmand/core/android/MapRendererView.java @@ -2,7 +2,9 @@ import android.content.Context; import android.graphics.Bitmap; +import android.graphics.Canvas; import android.graphics.Matrix; +import android.graphics.Paint; import android.os.Bundle; import android.util.AttributeSet; import android.util.Log; @@ -77,7 +79,7 @@ public abstract class MapRendererView extends FrameLayout { /** * Optional bitmap for offscreen rendering */ - private Bitmap _resultBitmap; + private Bitmap _offscreenBitmap; /** * Offscreen rendering result is ready @@ -302,25 +304,20 @@ public IMapRendererSetupOptionsConfigurator getMapRendererSetupOptionsConfigurat */ protected abstract IMapRenderer createMapRendererInstance(); - public Bitmap getBitmap() { + public Bitmap getBitmap(Bitmap toDraw) { if (_byteBuffer != null) { if (_renderingResultIsReady) { - Bitmap bitmap = Bitmap.createBitmap(_windowWidth, _windowHeight, Bitmap.Config.ARGB_8888); + if (_offscreenBitmap == null || _offscreenBitmap.getWidth() != _windowWidth || _offscreenBitmap.getHeight() != _windowHeight) { + _offscreenBitmap = Bitmap.createBitmap(_windowWidth, _windowHeight, Bitmap.Config.ARGB_8888); + } synchronized (_byteBuffer) { _byteBuffer.rewind(); - bitmap.copyPixelsFromBuffer(_byteBuffer); + _offscreenBitmap.copyPixelsFromBuffer(_byteBuffer); _renderingResultIsReady = false; } - Matrix matrix = new Matrix(); - matrix.preScale(1.0f, -1.0f); - _resultBitmap = Bitmap.createBitmap(bitmap, 0, 0, _windowWidth, _windowHeight, matrix, true); } - if (_resultBitmap == null) - _resultBitmap = Bitmap.createBitmap(_windowWidth, _windowHeight, Bitmap.Config.ARGB_8888); - return _resultBitmap; } - else - return null; + return _offscreenBitmap; } public IMapRenderer getRenderer() { @@ -338,8 +335,8 @@ public void stopRenderer() { releaseRendering(); removeAllViews(); _byteBuffer = null; - _resultBitmap = null; _mapAnimator = null; + _offscreenBitmap = null; _mapMarkersAnimator = null; _glSurfaceView = null; } @@ -358,7 +355,7 @@ public void run() { synchronized (this) { waitRelease = false; this.notifyAll(); - } + } } }; _glSurfaceView.queueEvent(releaseTask); @@ -1186,7 +1183,7 @@ public final float getSurfaceZoomAfterPinchWithParams( firstLocation31, firstHeightInMeters, firstScreenPoint, secondLocation31, secondHeightInMeters, secondScreenPoint ); - } + } public final boolean getZoomAndRotationAfterPinch( PointI firstLocation31, float firstHeightInMeters, PointI firstPoint, @@ -1304,7 +1301,7 @@ public final double getTileSizeOnScreenInPixels() { return _mapRenderer.getTileSizeOnScreenInPixels(); } - + public final int getMaxMissingDataZoomShift() { NativeCore.checkIfLoaded(); @@ -1628,7 +1625,7 @@ private int findConfigAttrib(EGL10 egl, EGLDisplay display, * Implements creation of main and GPU-worker contexts along with needed resources */ private final class EGLContextFactory implements GLSurfaceView.EGLContextFactory { - private int EGL_CONTEXT_CLIENT_VERSION = 0x3098; + private int EGL_CONTEXT_CLIENT_VERSION = 0x3098; /** * EGL attributes used to initialize EGL context: * - EGL context must support at least OpenGLES 3.0 @@ -1815,7 +1812,7 @@ public void onSurfaceChanged(GL10 gl, int width, int height) { _setupOptions.setGpuWorkerThreadPrologue(null); _setupOptions.setGpuWorkerThreadEpilogue(null); } - _setupOptions.setFrameUpdateRequestCallback(_renderRequestCallback.getBinding()); + _setupOptions.setFrameUpdateRequestCallback(_renderRequestCallback.getBinding()); _mapRenderer.setup(_setupOptions); if (!_mapRenderer.initializeRendering(true)) Log.e(TAG, "Failed to initialize rendering");