Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrushforth committed Jul 26, 2019
2 parents 75d439e + e142e0a commit 561153d
Show file tree
Hide file tree
Showing 76 changed files with 2,587 additions and 248 deletions.
43 changes: 28 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
# FIXME: Eventually we should include the needed patterns from .hgingore
# The goal is that a full build & test, followed by "git status" would show
# no untracked files

*.orig
*.bak
*.rej
*.swp
build/
# Ignore the following directories and files
.gradle/
**/nbproject/private/
.hg/
Debug/
Release/
bin/
build/
dist/
webrev/
webrev.zip
gradle.properties
apps/samples/Ensemble8/lib/
testbin/
**/Ensemble8/lib/
**/Ensemble8/src/generated/resources/ensemble/search/index/write.lock
**/nbproject/private/

# Ignore webrevs
/webrev/
/webrev.zip

# Ignore Eclipse files
org.eclipse.buildship*

# Ignore IntelliJ files
.idea/tasks.xml
.idea/workspace.xml
.idea/inspectionProfiles/*
.idea/inspectionProfiles/**
.idea/copyright/profiles_settings.xml
.idea/codeStyles/*
.idea/codeStyles/**
.idea/checkstyle-idea.xml

# Ignore the following file suffixes
*.vcxproj.user
*.orig
*.bak
*.rej
*.swp
*~
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019, 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
Expand All @@ -25,9 +25,12 @@

package com.sun.javafx.tk;

import com.sun.javafx.geom.Rectangle;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;

import javafx.scene.image.PixelFormat;
import javafx.scene.image.PixelReader;
import javafx.scene.image.WritablePixelFormat;
Expand Down Expand Up @@ -97,4 +100,6 @@ public void setPixels(int x, int y, int w, int h,

public void setPixels(int dstx, int dsty, int w, int h,
PixelReader reader, int srcx, int srcy);

public void bufferDirty(Rectangle rect);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2019, 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
Expand Down Expand Up @@ -28,6 +28,7 @@
import javafx.application.ConditionalFeature;
import javafx.geometry.Dimension2D;
import javafx.scene.image.Image;
import javafx.scene.image.PixelBuffer;
import javafx.scene.input.Dragboard;
import javafx.scene.input.InputMethodRequests;
import javafx.scene.input.KeyCode;
Expand Down Expand Up @@ -56,6 +57,7 @@
import javafx.stage.Window;
import java.io.File;
import java.io.InputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.security.AccessControlContext;
Expand Down Expand Up @@ -131,7 +133,6 @@
import com.sun.javafx.logging.PulseLogger;
import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
import com.sun.javafx.scene.input.DragboardHelper;
import com.sun.prism.impl.ManagedResource;

public final class QuantumToolkit extends Toolkit {

Expand Down Expand Up @@ -1324,6 +1325,23 @@ static class QuantumImage implements com.sun.javafx.tk.ImageLoader, ResourceFact
this.image = image;
}

QuantumImage(PixelBuffer<Buffer> pixelBuffer) {
switch (pixelBuffer.getPixelFormat().getType()) {
case INT_ARGB_PRE:
image = com.sun.prism.Image.fromPixelBufferPreData(PixelFormat.INT_ARGB_PRE,
pixelBuffer.getBuffer(), pixelBuffer.getWidth(), pixelBuffer.getHeight());
break;

case BYTE_BGRA_PRE:
image = com.sun.prism.Image.fromPixelBufferPreData(PixelFormat.BYTE_BGRA_PRE,
pixelBuffer.getBuffer(), pixelBuffer.getWidth(), pixelBuffer.getHeight());
break;

default:
throw new InternalError("Unsupported PixelFormat: " + pixelBuffer.getPixelFormat().getType());
}
}

RTTexture getRT(int w, int h, ResourceFactory rfNew) {
boolean rttOk = rt != null && rf == rfNew &&
rt.getContentWidth() == w && rt.getContentHeight() == h;
Expand Down Expand Up @@ -1396,6 +1414,10 @@ public Exception getException() {
return new QuantumImage((com.sun.prism.Image) platformImage);
}

if (platformImage instanceof PixelBuffer) {
return new QuantumImage((PixelBuffer<Buffer>) platformImage);
}

throw new UnsupportedOperationException("unsupported class for loadPlatformImage");
}

Expand Down Expand Up @@ -1477,7 +1499,7 @@ public void run() {
boolean errored = false;
try {
QuantumImage pImage = (params.platformImage instanceof QuantumImage) ?
(QuantumImage)params.platformImage : new QuantumImage(null);
(QuantumImage)params.platformImage : new QuantumImage((com.sun.prism.Image)null);

com.sun.prism.RTTexture rt = pImage.getRT(w, h, rf);

Expand Down
49 changes: 24 additions & 25 deletions modules/javafx.graphics/src/main/java/com/sun/marlin/DDasher.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public final class DDasher implements DPathConsumer2D, MarlinConst {
static final double CURVE_LEN_ERR = MarlinProperties.getCurveLengthError(); // 0.01 initial
static final double MIN_T_INC = 1.0d / (1 << REC_LIMIT);

static final double EPS = 1e-6d;

// More than 24 bits of mantissa means we can no longer accurately
// measure the number of times cycled through the dash array so we
// punt and override the phase to just be 0 past that point.
Expand Down Expand Up @@ -361,7 +363,7 @@ public void lineTo(final double x1, final double y1) {

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down Expand Up @@ -416,13 +418,13 @@ private void _lineTo(final double x1, final double y1) {
boolean _dashOn = dashOn;
double _phase = phase;

double leftInThisDashSegment, d;
double leftInThisDashSegment, rem;

while (true) {
d = _dash[_idx];
leftInThisDashSegment = d - _phase;
leftInThisDashSegment = _dash[_idx] - _phase;
rem = len - leftInThisDashSegment;

if (len <= leftInThisDashSegment) {
if (rem <= EPS) {
_curCurvepts[0] = x1;
_curCurvepts[1] = y1;

Expand All @@ -431,26 +433,21 @@ private void _lineTo(final double x1, final double y1) {
// Advance phase within current dash segment
_phase += len;

// TODO: compare double values using epsilon:
if (len == leftInThisDashSegment) {
// compare values using epsilon:
if (Math.abs(rem) <= EPS) {
_phase = 0.0d;
_idx = (_idx + 1) % _dashLen;
_dashOn = !_dashOn;
}
break;
}

if (_phase == 0.0d) {
_curCurvepts[0] = cx0 + d * cx;
_curCurvepts[1] = cy0 + d * cy;
} else {
_curCurvepts[0] = cx0 + leftInThisDashSegment * cx;
_curCurvepts[1] = cy0 + leftInThisDashSegment * cy;
}
_curCurvepts[0] = cx0 + leftInThisDashSegment * cx;
_curCurvepts[1] = cy0 + leftInThisDashSegment * cy;

goTo(_curCurvepts, 0, 4, _dashOn);

len -= leftInThisDashSegment;
len = rem;
// Advance to next dash segment
_idx = (_idx + 1) % _dashLen;
_dashOn = !_dashOn;
Expand Down Expand Up @@ -506,26 +503,26 @@ public void skipLen() {
_dashOn = (iterations + (_dashOn ? 1L : 0L) & 1L) == 1L;
}

double leftInThisDashSegment, d;
double leftInThisDashSegment, rem;

while (true) {
d = _dash[_idx];
leftInThisDashSegment = d - _phase;
leftInThisDashSegment = _dash[_idx] - _phase;
rem = len - leftInThisDashSegment;

if (len <= leftInThisDashSegment) {
if (rem <= EPS) {
// Advance phase within current dash segment
_phase += len;

// TODO: compare double values using epsilon:
if (len == leftInThisDashSegment) {
// compare values using epsilon:
if (Math.abs(rem) <= EPS) {
_phase = 0.0d;
_idx = (_idx + 1) % _dashLen;
_dashOn = !_dashOn;
}
break;
}

len -= leftInThisDashSegment;
len = rem;
// Advance to next dash segment
_idx = (_idx + 1) % _dashLen;
_dashOn = !_dashOn;
Expand Down Expand Up @@ -579,7 +576,9 @@ private void somethingTo(final int type) {
goTo(_curCurvepts, curCurveoff + 2, type, _dashOn);

_phase += _li.lastSegLen();
if (_phase >= _dash[_idx]) {

// compare values using epsilon:
if (_phase + EPS >= _dash[_idx]) {
_phase = 0.0d;
_idx = (_idx + 1) % _dashLen;
_dashOn = !_dashOn;
Expand Down Expand Up @@ -938,7 +937,7 @@ public void curveTo(final double x1, final double y1,

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down Expand Up @@ -1024,7 +1023,7 @@ public void quadTo(final double x1, final double y1,

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static int findSubdivPoints(final DCurve c, final double[] pts,
final double y12 = pts[3] - pts[1];
// if the curve is already parallel to either axis we gain nothing
// from rotating it.
if ((y12 != 0.0d && x12 != 0.0d)) {
if ((y12 != 0.0d) && (x12 != 0.0d)) {
// we rotate it so that the first vector in the control polygon is
// parallel to the x-axis. This will ensure that rotated quarter
// circles won't be subdivided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ private void lineTo(final double x1, final double y1,

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down Expand Up @@ -634,6 +634,9 @@ public void closePath() {
emitReverse();

this.prev = CLOSE;
this.cx0 = sx0;
this.cy0 = sy0;
this.cOutCode = sOutCode;

if (opened) {
// do not emit close
Expand Down Expand Up @@ -668,7 +671,9 @@ private void finish(final int outcode) {
// i.e. if caps must be drawn or not ?
// Solution: use the ClosedPathDetector before Stroker to determine
// if the path is a closed path or not
if (!rdrCtx.closedPath) {
if (rdrCtx.closedPath) {
emitReverse();
} else {
if (outcode == 0) {
// current point = end's cap:
if (capStyle == CAP_ROUND) {
Expand All @@ -693,8 +698,6 @@ private void finish(final int outcode) {
}
}
}
} else {
emitReverse();
}
emitClose();
}
Expand Down Expand Up @@ -1058,7 +1061,7 @@ public void curveTo(final double x1, final double y1,

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down Expand Up @@ -1206,7 +1209,7 @@ public void quadTo(final double x1, final double y1,

// basic rejection criteria:
if (sideCode == 0) {
// ovelap clip:
// overlap clip:
if (subdivide) {
// avoid reentrance
subdivide = false;
Expand Down
Loading

0 comments on commit 561153d

Please sign in to comment.