Skip to content

Commit

Permalink
merge: fix Stroker and PathClipFilter (filler) to handle huge coordin…
Browse files Browse the repository at this point in the history
…ates up to 1E15 arround clip
  • Loading branch information
bourgesl committed Oct 25, 2021
1 parent e0c3d82 commit c7bf795
Show file tree
Hide file tree
Showing 18 changed files with 1,943 additions and 222 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven

- name: Build (Maven)
run: |
mvn verify
echo "That's All, folks !"
- name: Upload
uses: actions/upload-artifact@v2
with:
name: marlin-build
path: target/marlin-*.jar

9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion run_draw_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#RDR="-Dsun.java2d.renderer=sun.java2d.pisces.PiscesRenderingEngine"

MARLIN_PREFIX="/home/marlin/mapbench/lib/marlin-0.9.4.3-Unsafe"
#MARLIN_PREFIX="./target/marlin-1.0.0-EA-Unsafe"
MARLIN_PREFIX="./target/marlin-1.0.0-EA-Unsafe"

BOOTCLASSPATH="-Xbootclasspath/a:$MARLIN_PREFIX.jar -Xbootclasspath/p:$MARLIN_PREFIX-sun-java2d.jar"
RDR="-Dsun.java2d.renderer=org.marlin.pisces.DMarlinRenderingEngine"
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/org/marlin/pisces/DHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ static final class PolyStack {
* clean up before reusing this instance
*/
void dispose() {
end = 0;
end = 0;
numCurves = 0;

if (DO_STATS) {
Expand Down Expand Up @@ -1181,14 +1181,24 @@ void push(final int v) {
}
}

void pullAll(final double[] points, final DPathConsumer2D io) {
void pullAll(final double[] points, final DPathConsumer2D io,
final boolean moveFirst)
{
final int nc = end;
if (nc == 0) {
return;
}
final int[] _values = indices;

int i = 0;

if (moveFirst) {
int j = _values[i] << 1;
io.moveTo(points[j], points[j + 1]);
i++;
}

for (int i = 0, j; i < nc; i++) {
for (int j; i < nc; i++) {
j = _values[i] << 1;
io.lineTo(points[j], points[j + 1]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ private static void logSettings(final String reClass) {
+ MarlinProperties.getQuadDecD2());

logInfo("Renderer settings:");
logInfo("SORT = " + (MergeSort.USE_DPQS ? "DPQS_20190501" : "MERGE"));
logInfo("SORT = " + MergeSort.SORT_TYPE);
logInfo("CUB_DEC_BND = " + DRenderer.CUB_DEC_BND);
logInfo("CUB_INC_BND = " + DRenderer.CUB_INC_BND);
logInfo("QUAD_DEC_BND = " + DRenderer.QUAD_DEC_BND);
Expand Down
22 changes: 8 additions & 14 deletions src/main/java/org/marlin/pisces/DPQSSorterContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@ final class DPQSSorterContext {
static final boolean LOG_ALLOC = false;
static final boolean CHECK_ALLOC = false && LOG_ALLOC;

/**
* Max capacity of the index array for tracking runs.
*/
static final int MAX_RUN_CAPACITY = DualPivotQuicksort20191112Ext.MAX_RUN_CAPACITY;

/* members */
final int[] run;
int[] auxA;
int[] auxB;
final int[] run;
boolean runInit;

DPQSSorterContext() {
// preallocate max runs:
final int max = getMaxRunCount(Integer.MAX_VALUE) + 1;
if (LOG_ALLOC) {
MarlinUtils.logInfo("alloc run: " + max);
MarlinUtils.logInfo("alloc run: " + MAX_RUN_CAPACITY);
}
run = new int[max];
run = new int[MAX_RUN_CAPACITY];
}

void initBuffers(final int length, final int[] a, final int[] b) {
Expand All @@ -65,14 +69,4 @@ void initBuffers(final int length, final int[] a, final int[] b) {
runInit = true;
}

/**
* Calculates the max number of runs.
*
* @param size the array size
* @return the max number of runs
*/
static int getMaxRunCount(int size) {
return size > 2048000 ? 2000 : size >> 10 | 5;
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/marlin/pisces/DRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ public void quadTo(final double pix_x1, final double pix_y1,

@Override
public void closePath() {
if (x0 != sx0 || y0 != sy0) {
if ((x0 != sx0) || (y0 != sy0)) {
addLine(x0, y0, sx0, sy0);
x0 = sx0;
y0 = sy0;
Expand Down Expand Up @@ -1061,7 +1061,7 @@ private void _endRendering(final int ymin, final int ymax) {
// (ie i < prevNumCrossings):

skipISort = (prevNumCrossings >= MergeSort.DISABLE_ISORT_THRESHOLD);
useDPQS = MergeSort.USE_DPQS && (skipISort || (ptrLen >= MergeSort. DPQS_THRESHOLD));
useDPQS = MergeSort.USE_DPQS && (skipISort || (ptrLen >= MergeSort.DPQS_THRESHOLD));

if (DO_STATS && useDPQS) {
rdrCtx.stats.stat_rdr_crossings_dpqs.add((skipISort) ? numCrossings : ptrLen);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/marlin/pisces/DStroker.java
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ public void closePath() {

// basic acceptance criteria
if ((sOutCode & cOutCode) == 0) {
if (cx0 != sx0 || cy0 != sy0) {
if ((cx0 != sx0) || (cy0 != sy0)) {
// may subdivide line:
lineTo(sx0, sy0);
}
Expand Down
Loading

0 comments on commit c7bf795

Please sign in to comment.