Enable FastPFOR encodings in MLT (#4146)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
Tim Sylvester
2026-07-14 12:31:41 -07:00
committed by GitHub
parent f442c704b8
commit 247c776d26
34 changed files with 227 additions and 78 deletions

View File

@@ -102,6 +102,8 @@ public class MapLibreMapOptions implements Parcelable {
private boolean asyncRendererCleanup = false;
private boolean fastPFOREnabled = false;
/**
* Creates a new MapLibreMapOptions object.
*
@@ -167,6 +169,8 @@ public class MapLibreMapOptions implements Parcelable {
actionJournalRenderingReportInterval = in.readInt();
asyncRendererCleanup = in.readByte() != 0;
fastPFOREnabled = in.readByte() != 0;
}
/**
@@ -340,6 +344,10 @@ public class MapLibreMapOptions implements Parcelable {
maplibreMapOptions.asyncRendererCleanup(
typedArray.getBoolean(R.styleable.maplibre_MapView_maplibre_asyncRendererCleanup, false)
);
maplibreMapOptions.fastPFOREnabled(
typedArray.getBoolean(R.styleable.maplibre_MapView_maplibre_fastPFOREnabled, false)
);
} finally {
typedArray.recycle();
}
@@ -852,6 +860,16 @@ public class MapLibreMapOptions implements Parcelable {
return this;
}
/**
* Enable FastPFOR decompression for vector tiles, defaults to false.
* @param enable true to enable, false to disable
* @return This
*/
@NonNull public MapLibreMapOptions fastPFOREnabled(boolean enable) {
this.fastPFOREnabled = enable;
return this;
}
/**
* Enable local ideograph font family, defaults to true.
*
@@ -999,6 +1017,15 @@ public class MapLibreMapOptions implements Parcelable {
return asyncRendererCleanup;
}
/**
* Check whether FastPFOR decompression is enabled for vector tiles.
*
* @return true if enabled
*/
public boolean getFastPFOREnabled() {
return fastPFOREnabled;
}
/**
* Set the flag to render the map surface on top of another surface.
*
@@ -1391,6 +1418,8 @@ public class MapLibreMapOptions implements Parcelable {
dest.writeInt(actionJournalRenderingReportInterval);
dest.writeByte((byte) (asyncRendererCleanup ? 1 : 0));
dest.writeByte((byte) (fastPFOREnabled ? 1 : 0));
}
@Override
@@ -1535,6 +1564,10 @@ public class MapLibreMapOptions implements Parcelable {
return false;
}
if (fastPFOREnabled != options.fastPFOREnabled) {
return false;
}
return false;
}
@@ -1588,6 +1621,7 @@ public class MapLibreMapOptions implements Parcelable {
result = 31 * result + (int) actionJournalLogFileCount;
result = 31 * result + (int) actionJournalRenderingReportInterval;
result = 31 * result + (asyncRendererCleanup ? 1 : 0);
result = 31 * result + (fastPFOREnabled ? 1 : 0);
return result;
}
}

View File

@@ -12,6 +12,8 @@ public class NativeMapOptions {
private final int actionJournalRenderingReportInterval;
private final boolean asyncRendererCleanup;
private final boolean fastPFOREnabled;
public NativeMapOptions(MapLibreMapOptions options) {
pixelRatio = options.getPixelRatio();
crossSourceCollisions = options.getCrossSourceCollisions();
@@ -22,6 +24,7 @@ public class NativeMapOptions {
actionJournalLogFileCount = options.getActionJournalLogFileCount();
actionJournalRenderingReportInterval = options.getActionJournalRenderingReportInterval();
asyncRendererCleanup = options.getAsyncRendererCleanup();
fastPFOREnabled = options.getFastPFOREnabled();
}
public NativeMapOptions(float pixelRatio, boolean crossSourceCollisions) {
@@ -35,6 +38,7 @@ public class NativeMapOptions {
actionJournalRenderingReportInterval = 0;
asyncRendererCleanup = false;
fastPFOREnabled = false;
}
public float pixelRatio() {
@@ -68,4 +72,8 @@ public class NativeMapOptions {
public boolean asyncRendererCleanup() {
return asyncRendererCleanup;
}
public boolean fastPFOREnabled() {
return fastPFOREnabled;
}
}

View File

@@ -11,6 +11,7 @@
<attr name="maplibre_localIdeographFontFamily" format="string"/>
<attr name="maplibre_localIdeographFontFamilies" format="reference"/>
<attr name="maplibre_cross_source_collisions" format="boolean"/>
<attr name="maplibre_fastPFOREnabled" format="boolean"/>
<!--Action Journal-->
<attr name="maplibre_actionJournalEnabled" format="boolean"/>