< prev index next >
src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -45,11 +45,25 @@
* Marlin RendererEngine implementation (derived from Pisces)
*/
public final class MarlinRenderingEngine extends RenderingEngine
implements MarlinConst
{
- private static enum NormMode {
+ // slightly slower ~2% if enabled stroker clipping (lines) but skipping cap / join handling is few percents faster in specific cases
+ static final boolean DISABLE_2ND_STROKER_CLIPPING = true;
+
+ static final boolean DO_TRACE_PATH = false;
+
+ static final boolean DO_CLIP = MarlinProperties.isDoClip();
+ static final boolean DO_CLIP_FILL = true;
+ static final boolean DO_CLIP_RUNTIME_ENABLE = MarlinProperties.isDoClipRuntimeFlag();
+
+ private static final float MIN_PEN_SIZE = 1.0f / MIN_SUBPIXELS;
+
+ static final float UPPER_BND = Float.MAX_VALUE / 2.0f;
+ static final float LOWER_BND = -UPPER_BND;
+
+ private enum NormMode {
ON_WITH_AA {
@Override
PathIterator getNormalizingPathIterator(final RendererContext rdrCtx,
final PathIterator src)
{
@@ -78,22 +92,10 @@
abstract PathIterator getNormalizingPathIterator(RendererContext rdrCtx,
PathIterator src);
}
- private static final float MIN_PEN_SIZE = 1.0f / NORM_SUBPIXELS;
-
- static final float UPPER_BND = Float.MAX_VALUE / 2.0f;
- static final float LOWER_BND = -UPPER_BND;
-
- static final boolean DO_CLIP = MarlinProperties.isDoClip();
- static final boolean DO_CLIP_FILL = true;
-
- static final boolean DO_TRACE_PATH = false;
-
- static final boolean DO_CLIP_RUNTIME_ENABLE = MarlinProperties.isDoClipRuntimeFlag();
-
/**
* Public constructor
*/
public MarlinRenderingEngine() {
super();
@@ -417,18 +419,31 @@
// deltaTransformConsumer may adjust the clip rectangle:
pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat);
// stroker will adjust the clip rectangle (width / miter limit):
- pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale);
+ pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit, scale,
+ (dashes == null));
+
+ // Curve Monotizer:
+ rdrCtx.monotonizer.init(width);
if (dashes != null) {
if (!recycleDashes) {
dashLen = dashes.length;
}
+ if (DO_TRACE_PATH) {
+ pc2d = transformerPC2D.traceDasher(pc2d);
+ }
pc2d = rdrCtx.dasher.init(pc2d, dashes, dashLen, dashphase,
recycleDashes);
+
+ if (DISABLE_2ND_STROKER_CLIPPING) {
+ // disable stoker clipping
+ rdrCtx.stroker.disableClipping();
+ }
+
} else if (rdrCtx.doClip && (caps != Stroker.CAP_BUTT)) {
if (DO_TRACE_PATH) {
pc2d = transformerPC2D.traceClosedPathDetector(pc2d);
}
@@ -623,10 +638,16 @@
}
private static void pathTo(final RendererContext rdrCtx, final PathIterator pi,
PathConsumer2D pc2d)
{
+ if (USE_PATH_SIMPLIFIER) {
+ // Use path simplifier at the first step
+ // to remove useless points
+ pc2d = rdrCtx.pathSimplifier.init(pc2d);
+ }
+
// mark context as DIRTY:
rdrCtx.dirty = true;
pathToLoop(rdrCtx.float6, pi, pc2d);
@@ -1068,12 +1089,14 @@
logInfo("sun.java2d.renderer.useRef = "
+ refType);
logInfo("sun.java2d.renderer.edges = "
+ MarlinConst.INITIAL_EDGES_COUNT);
- logInfo("sun.java2d.renderer.pixelsize = "
- + MarlinConst.INITIAL_PIXEL_DIM);
+ logInfo("sun.java2d.renderer.pixelWidth = "
+ + MarlinConst.INITIAL_PIXEL_WIDTH);
+ logInfo("sun.java2d.renderer.pixelHeight = "
+ + MarlinConst.INITIAL_PIXEL_HEIGHT);
logInfo("sun.java2d.renderer.subPixel_log2_X = "
+ MarlinConst.SUBPIXEL_LG_POSITIONS_X);
logInfo("sun.java2d.renderer.subPixel_log2_Y = "
+ MarlinConst.SUBPIXEL_LG_POSITIONS_Y);
@@ -1099,16 +1122,25 @@
+ MarlinCache.RLE_MIN_WIDTH);
// optimisation parameters
logInfo("sun.java2d.renderer.useSimplifier = "
+ MarlinConst.USE_SIMPLIFIER);
+ logInfo("sun.java2d.renderer.usePathSimplifier= "
+ + MarlinConst.USE_PATH_SIMPLIFIER);
+ logInfo("sun.java2d.renderer.pathSimplifier.pixTol = "
+ + MarlinProperties.getPathSimplifierPixelTolerance());
logInfo("sun.java2d.renderer.clip = "
+ MarlinProperties.isDoClip());
logInfo("sun.java2d.renderer.clip.runtime.enable = "
+ MarlinProperties.isDoClipRuntimeFlag());
+ logInfo("sun.java2d.renderer.clip.subdivider = "
+ + MarlinProperties.isDoClipSubdivider());
+ logInfo("sun.java2d.renderer.clip.subdivider.minLength = "
+ + MarlinProperties.getSubdividerMinLength());
+
// debugging parameters
logInfo("sun.java2d.renderer.doStats = "
+ MarlinConst.DO_STATS);
logInfo("sun.java2d.renderer.doMonitors = "
+ MarlinConst.DO_MONITORS);
@@ -1122,10 +1154,12 @@
+ MarlinConst.LOG_CREATE_CONTEXT);
logInfo("sun.java2d.renderer.logUnsafeMalloc = "
+ MarlinConst.LOG_UNSAFE_MALLOC);
// quality settings
+ logInfo("sun.java2d.renderer.curve_len_err = "
+ + MarlinProperties.getCurveLengthError());
logInfo("sun.java2d.renderer.cubic_dec_d2 = "
+ MarlinProperties.getCubicDecD2());
logInfo("sun.java2d.renderer.cubic_inc_d1 = "
+ MarlinProperties.getCubicIncD1());
logInfo("sun.java2d.renderer.quad_dec_d2 = "
< prev index next >