Fix tiles sampling on 28+

This commit is contained in:
max-klaus 2019-12-15 11:30:26 +03:00
parent 1264d9a714
commit 411e87f9e0

View file

@ -7,6 +7,7 @@ import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.widget.Toast;
import net.osmand.data.QuadRect;
@ -40,6 +41,7 @@ public class MapTileLayer extends BaseMapLayer {
protected ResourceManager resourceManager;
protected OsmandSettings settings;
private boolean visible = true;
private boolean useSampling;
public MapTileLayer(boolean mainMap) {
@ -57,6 +59,8 @@ public class MapTileLayer extends BaseMapLayer {
settings = view.getSettings();
resourceManager = view.getApplication().getResourceManager();
useSampling = Build.VERSION.SDK_INT < 28;
paintBitmap = new Paint();
paintBitmap.setFilterBitmap(true);
paintBitmap.setAlpha(getAlpha());
@ -207,7 +211,7 @@ public class MapTileLayer extends BaseMapLayer {
int xZoom = (tileX % div) * tileSize / div;
int yZoom = (tileY % div) * tileSize / div;
// nice scale
boolean useSampling = false;//kzoom > 3;
boolean useSampling = this.useSampling && kzoom > 3;
bitmapToZoom.set(Math.max(xZoom, 0), Math.max(yZoom, 0),
Math.min(xZoom + tileSize / div, tileSize),
Math.min(yZoom + tileSize / div, tileSize));