< prev index next >
modules/javafx.graphics/src/main/java/com/sun/prism/impl/shape/DMarlinPrismUtils.java
Print this page
*** 36,46 ****
--- 36,48 ----
import com.sun.marlin.DMarlinRenderer;
import com.sun.marlin.DPathConsumer2D;
import com.sun.marlin.DRendererContext;
import com.sun.marlin.DStroker;
import com.sun.marlin.DTransformingPathConsumer2D;
+ import com.sun.marlin.MarlinUtils;
import com.sun.prism.BasicStroke;
+ import java.util.Arrays;
public final class DMarlinPrismUtils {
private static final boolean FORCE_NO_AA = false;
*** 84,94 ****
// transformation before the path processing.
BaseTransform strokerTx = null;
int dashLen = -1;
boolean recycleDashes = false;
- double scale = 1.0d;
double width = lineWidth;
float[] dashes = stroke.getDashArray();
double[] dashesD = null;
double dashphase = stroke.getDashPhase();
--- 86,95 ----
*** 110,120 ****
// need to transform input paths to stroker and tell stroker
// the scaled width. This condition is satisfied if
// a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we
// leave a bit of room for error.
if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) {
! scale = Math.sqrt(a*a + c*c);
if (dashesD != null) {
for (int i = 0; i < dashLen; i++) {
dashesD[i] *= scale;
}
--- 111,121 ----
// need to transform input paths to stroker and tell stroker
// the scaled width. This condition is satisfied if
// a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we
// leave a bit of room for error.
if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) {
! final double scale = Math.sqrt(a*a + c*c);
if (dashesD != null) {
for (int i = 0; i < dashLen; i++) {
dashesD[i] *= scale;
}
*** 145,163 ****
// either tx is null or it's the identity. In either case
// we don't transform the path.
tx = null;
}
- // Get renderer offsets:
- double rdrOffX = 0.0d, rdrOffY = 0.0d;
-
- if (rdrCtx.doClip && (tx != null)) {
- final DMarlinRenderer renderer = (DMarlinRenderer)out;
- rdrOffX = renderer.getOffsetX();
- rdrOffY = renderer.getOffsetY();
- }
-
// Prepare the pipeline:
DPathConsumer2D pc = out;
final DTransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
--- 146,155 ----
*** 171,186 ****
// to remove collinear segments (notably due to cap square)
pc = rdrCtx.simplifier.init(pc);
}
// deltaTransformConsumer may adjust the clip rectangle:
! pc = transformerPC2D.deltaTransformConsumer(pc, strokerTx, rdrOffX, rdrOffY);
// stroker will adjust the clip rectangle (width / miter limit):
pc = rdrCtx.stroker.init(pc, width, stroke.getEndCap(),
stroke.getLineJoin(), stroke.getMiterLimit(),
! scale, rdrOffX, rdrOffY, (dashesD == null));
// Curve Monotizer:
rdrCtx.monotonizer.init(width);
if (dashesD != null) {
--- 163,178 ----
// to remove collinear segments (notably due to cap square)
pc = rdrCtx.simplifier.init(pc);
}
// deltaTransformConsumer may adjust the clip rectangle:
! pc = transformerPC2D.deltaTransformConsumer(pc, strokerTx);
// stroker will adjust the clip rectangle (width / miter limit):
pc = rdrCtx.stroker.init(pc, width, stroke.getEndCap(),
stroke.getLineJoin(), stroke.getMiterLimit(),
! (dashesD == null));
// Curve Monotizer:
rdrCtx.monotonizer.init(width);
if (dashesD != null) {
*** 239,252 ****
{
if (DO_CLIP || (DO_CLIP_RUNTIME_ENABLE && MarlinProperties.isDoClipAtRuntime())) {
// Define the initial clip bounds:
final double[] clipRect = rdrCtx.clipRect;
! clipRect[0] = clip.y;
! clipRect[1] = clip.y + clip.height;
! clipRect[2] = clip.x;
! clipRect[3] = clip.x + clip.width;
// Enable clipping:
rdrCtx.doClip = true;
}
--- 231,260 ----
{
if (DO_CLIP || (DO_CLIP_RUNTIME_ENABLE && MarlinProperties.isDoClipAtRuntime())) {
// Define the initial clip bounds:
final double[] clipRect = rdrCtx.clipRect;
! // Adjust the clipping rectangle with the renderer offsets
! final double rdrOffX = renderer.getOffsetX();
! final double rdrOffY = renderer.getOffsetY();
!
! // add a small rounding error:
! final double margin = 1e-3d;
!
! clipRect[0] = clip.y
! - margin + rdrOffY;
! clipRect[1] = clip.y + clip.height
! + margin + rdrOffY;
! clipRect[2] = clip.x
! - margin + rdrOffX;
! clipRect[3] = clip.x + clip.width
! + margin + rdrOffX;
!
! if (MarlinConst.DO_LOG_CLIP) {
! MarlinUtils.logInfo("clipRect (clip): "
! + Arrays.toString(rdrCtx.clipRect));
! }
// Enable clipping:
rdrCtx.doClip = true;
}
*** 265,282 ****
DPathConsumer2D pc = renderer;
final DTransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
if (DO_CLIP_FILL && rdrCtx.doClip) {
- double rdrOffX = renderer.getOffsetX();
- double rdrOffY = renderer.getOffsetY();
-
if (DO_TRACE_PATH) {
// trace Filler:
pc = rdrCtx.transformerPC2D.traceFiller(pc);
}
! pc = rdrCtx.transformerPC2D.pathClipper(pc, rdrOffX, rdrOffY);
}
if (DO_TRACE_PATH) {
// trace Input:
pc = transformerPC2D.traceInput(pc);
--- 273,287 ----
DPathConsumer2D pc = renderer;
final DTransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
if (DO_CLIP_FILL && rdrCtx.doClip) {
if (DO_TRACE_PATH) {
// trace Filler:
pc = rdrCtx.transformerPC2D.traceFiller(pc);
}
! pc = rdrCtx.transformerPC2D.pathClipper(pc);
}
if (DO_TRACE_PATH) {
// trace Input:
pc = transformerPC2D.traceInput(pc);
< prev index next >