Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgesl committed May 9, 2018
1 parent 0399575 commit 791bcd7
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 36 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>org.marlin</groupId>
<artifactId>marlinfx</artifactId>
<packaging>jar</packaging>
<version>0.9.1-Unsafe-OpenJDK9</version>
<version>0.9.2-Unsafe-OpenJDK9</version>
<name>Marlin software rasterizer</name>

<url>https://github.com/bourgesl/marlin-renderer</url>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/sun/marlin/DDasher.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ public void moveTo(final double x0, final double y0) {

private void emitSeg(double[] buf, int off, int type) {
switch (type) {
case 4:
out.lineTo(buf[off], buf[off + 1]);
return;
case 8:
out.curveTo(buf[off ], buf[off + 1],
buf[off + 2], buf[off + 3],
Expand All @@ -278,9 +281,6 @@ private void emitSeg(double[] buf, int off, int type) {
out.quadTo(buf[off ], buf[off + 1],
buf[off + 2], buf[off + 3]);
return;
case 4:
out.lineTo(buf[off], buf[off + 1]);
return;
default:
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/sun/marlin/DHelpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,17 +764,17 @@ void pullAll(final DPathConsumer2D io) {
io.lineTo(_curves[e], _curves[e+1]);
e += 2;
continue;
case TYPE_QUADTO:
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
e += 4;
continue;
case TYPE_CUBICTO:
io.curveTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3],
_curves[e+4], _curves[e+5]);
e += 6;
continue;
case TYPE_QUADTO:
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
e += 4;
continue;
default:
}
}
Expand Down Expand Up @@ -806,17 +806,17 @@ void popAll(final DPathConsumer2D io) {
e -= 2;
io.lineTo(_curves[e], _curves[e+1]);
continue;
case TYPE_QUADTO:
e -= 4;
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
continue;
case TYPE_CUBICTO:
e -= 6;
io.curveTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3],
_curves[e+4], _curves[e+5]);
continue;
case TYPE_QUADTO:
e -= 4;
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
continue;
default:
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/sun/marlin/DMarlinRenderingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public static void logSettings(final String reClass) {
logInfo("prism.marlin.pixelHeight = "
+ MarlinConst.INITIAL_PIXEL_HEIGHT);

logInfo("prism.marlin.profile = "
+ (MarlinProperties.isProfileQuality() ?
"quality" : "speed"));

logInfo("prism.marlin.subPixel_log2_X = "
+ MarlinConst.SUBPIXEL_LG_POSITIONS_X);
logInfo("prism.marlin.subPixel_log2_Y = "
Expand Down Expand Up @@ -185,7 +189,7 @@ public static void logSettings(final String reClass) {
logInfo("prism.marlin.pathSimplifier.pixTol = "
+ MarlinProperties.getPathSimplifierPixelTolerance());

logInfo("sun.java2d.renderer.clip = "
logInfo("prism.marlin.clip = "
+ MarlinProperties.isDoClip());
logInfo("prism.marlin.clip.runtime.enable = "
+ MarlinProperties.isDoClipRuntimeFlag());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/sun/marlin/Dasher.java
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ public void moveTo(final float x0, final float y0) {

private void emitSeg(float[] buf, int off, int type) {
switch (type) {
case 4:
out.lineTo(buf[off], buf[off + 1]);
return;
case 8:
out.curveTo(buf[off ], buf[off + 1],
buf[off + 2], buf[off + 3],
Expand All @@ -279,9 +282,6 @@ private void emitSeg(float[] buf, int off, int type) {
out.quadTo(buf[off ], buf[off + 1],
buf[off + 2], buf[off + 3]);
return;
case 4:
out.lineTo(buf[off], buf[off + 1]);
return;
default:
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/sun/marlin/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,17 +772,17 @@ void pullAll(final PathConsumer2D io) {
io.lineTo(_curves[e], _curves[e+1]);
e += 2;
continue;
case TYPE_QUADTO:
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
e += 4;
continue;
case TYPE_CUBICTO:
io.curveTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3],
_curves[e+4], _curves[e+5]);
e += 6;
continue;
case TYPE_QUADTO:
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
e += 4;
continue;
default:
}
}
Expand Down Expand Up @@ -814,17 +814,17 @@ void popAll(final PathConsumer2D io) {
e -= 2;
io.lineTo(_curves[e], _curves[e+1]);
continue;
case TYPE_QUADTO:
e -= 4;
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
continue;
case TYPE_CUBICTO:
e -= 6;
io.curveTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3],
_curves[e+4], _curves[e+5]);
continue;
case TYPE_QUADTO:
e -= 4;
io.quadTo(_curves[e], _curves[e+1],
_curves[e+2], _curves[e+3]);
continue;
default:
}
}
Expand Down
43 changes: 37 additions & 6 deletions src/main/java/com/sun/marlin/MarlinProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ public static int getInitialPixelHeight() {
64);
}

/**
* Return true if the profile is 'quality' (default) over 'speed'
*
* @return true if the profile is 'quality' (default), false otherwise
*/
public static boolean isProfileQuality() {
final String key = "prism.marlin.profile";
final String profile = getString(key, "quality");
if ("quality".equals(profile)) {
return true;
}
if ("speed".equals(profile)) {
return false;
}
logInfo("Invalid value for " + key + " = " + profile
+ "; expect value in [quality, speed] !");
return true;
}

/**
* Return the log(2) corresponding to subpixel on x-axis
*
Expand All @@ -91,10 +110,12 @@ public static int getSubPixel_Log2_X() {
* Return the log(2) corresponding to subpixel on y-axis
*
* @return 0 (1 subpixels) < initial pixel size < 8 (256 subpixels)
* (3 by default ie 8 subpixels)
* (3 by default ie 8 subpixels for the quality profile)
* (2 by default ie 4 subpixels for the speed profile)
*/
public static int getSubPixel_Log2_Y() {
return getInteger("prism.marlin.subPixel_log2_Y", 3, 0, 8);
final int def = isProfileQuality() ? 3 : 2;
return getInteger("prism.marlin.subPixel_log2_Y", def, 0, 8);
}

/**
Expand Down Expand Up @@ -201,24 +222,34 @@ public static boolean isLogUnsafeMalloc() {
}

// quality settings

public static float getCurveLengthError() {
return getFloat("prism.marlin.curve_len_err", 0.01f, 1e-6f, 1.0f);
}

public static float getCubicDecD2() {
return getFloat("prism.marlin.cubic_dec_d2", 1.0f, 1e-5f, 4.0f);
final float def = isProfileQuality() ? 1.0f : 2.5f;
return getFloat("prism.marlin.cubic_dec_d2", def, 1e-5f, 4.0f);
}

public static float getCubicIncD1() {
return getFloat("prism.marlin.cubic_inc_d1", 0.2f, 1e-6f, 1.0f);
final float def = isProfileQuality() ? 0.2f : 0.5f;
return getFloat("prism.marlin.cubic_inc_d1", def, 1e-6f, 1.0f);
}

public static float getQuadDecD2() {
return getFloat("prism.marlin.quad_dec_d2", 0.5f, 1e-5f, 4.0f);
final float def = isProfileQuality() ? 0.5f : 1.0f;
return getFloat("prism.marlin.quad_dec_d2", def, 1e-5f, 4.0f);
}

// system property utilities
static String getString(final String key, final String def) {
return AccessController.doPrivileged(
(PrivilegedAction<String>) () -> {
String value = System.getProperty(key);
return (value == null) ? def : value;
});
}

static boolean getBoolean(final String key, final String def) {
return Boolean.valueOf(AccessController.doPrivileged(
(PrivilegedAction<String>) () -> {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/sun/marlin/MarlinRenderingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public static void logSettings(final String reClass) {
logInfo("prism.marlin.pixelHeight = "
+ MarlinConst.INITIAL_PIXEL_HEIGHT);

logInfo("prism.marlin.profile = "
+ (MarlinProperties.isProfileQuality() ?
"quality" : "speed"));

logInfo("prism.marlin.subPixel_log2_X = "
+ MarlinConst.SUBPIXEL_LG_POSITIONS_X);
logInfo("prism.marlin.subPixel_log2_Y = "
Expand Down Expand Up @@ -185,7 +189,7 @@ public static void logSettings(final String reClass) {
logInfo("prism.marlin.pathSimplifier.pixTol = "
+ MarlinProperties.getPathSimplifierPixelTolerance());

logInfo("sun.java2d.renderer.clip = "
logInfo("prism.marlin.clip = "
+ MarlinProperties.isDoClip());
logInfo("prism.marlin.clip.runtime.enable = "
+ MarlinProperties.isDoClipRuntimeFlag());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/sun/marlin/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public final class Version {

private static final String VERSION = "marlinFX-0.9.1-Unsafe-OpenJDK";
private static final String VERSION = "marlinFX-0.9.2-Unsafe-OpenJDK";

public static String getVersion() {
return VERSION;
Expand Down

0 comments on commit 791bcd7

Please sign in to comment.