diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index 7814cfd56..21a9e372c 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -1453,15 +1453,15 @@ public class PGraphicsOpenGL extends PGraphics { if (primarySurface) { int[] temp = new int[1]; pgl.glGetIntegerv(PGL.GL_SAMPLES, temp, 0); - if (antialias != temp[0] && 1 < temp[0] && 1 < antialias) { - antialias = temp[0]; + if (quality != temp[0] && 1 < temp[0] && 1 < quality) { + quality = temp[0]; } } - if (antialias < 2) { + if (quality < 2) { pgl.glDisable(PGL.GL_MULTISAMPLE); - pgl.glEnable(PGL.GL_POINT_SMOOTH); - pgl.glEnable(PGL.GL_LINE_SMOOTH); - pgl.glEnable(PGL.GL_POLYGON_SMOOTH); +// pgl.glEnable(PGL.GL_POINT_SMOOTH); +// pgl.glEnable(PGL.GL_LINE_SMOOTH); +// pgl.glEnable(PGL.GL_POLYGON_SMOOTH); } else { pgl.glEnable(PGL.GL_MULTISAMPLE); pgl.glDisable(PGL.GL_POINT_SMOOTH); @@ -1647,11 +1647,11 @@ public class PGraphicsOpenGL extends PGraphics { } pgl.glDepthFunc(PGL.GL_LEQUAL); - if (antialias < 2) { + if (quality < 2) { pgl.glDisable(PGL.GL_MULTISAMPLE); - pgl.glEnable(PGL.GL_POINT_SMOOTH); - pgl.glEnable(PGL.GL_LINE_SMOOTH); - pgl.glEnable(PGL.GL_POLYGON_SMOOTH); +// pgl.glEnable(PGL.GL_POINT_SMOOTH); +// pgl.glEnable(PGL.GL_LINE_SMOOTH); +// pgl.glEnable(PGL.GL_POLYGON_SMOOTH); } else { pgl.glEnable(PGL.GL_MULTISAMPLE); pgl.glDisable(PGL.GL_POINT_SMOOTH); @@ -3099,10 +3099,10 @@ public class PGraphicsOpenGL extends PGraphics { level = maxSamples; } - if (antialias != level) { - antialias = level; - if (antialias == 1) { - antialias = 0; + if (quality != level) { + quality = level; + if (quality == 1) { + quality = 0; } // This will trigger a surface restart next time // requestDraw() is called. @@ -3114,8 +3114,8 @@ public class PGraphicsOpenGL extends PGraphics { public void noSmooth() { smooth = false; - if (1 < antialias) { - antialias = 0; + if (1 < quality) { + quality = 0; // This will trigger a surface restart next time // requestDraw() is called. pgl.initialized = false; @@ -5615,7 +5615,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void initPrimary() { - pgl.initPrimarySurface(antialias); + pgl.initPrimarySurface(quality); pg = this; } @@ -5638,8 +5638,8 @@ public class PGraphicsOpenGL extends PGraphics { offscreenFramebufferMultisample.release(); } - if (PGraphicsOpenGL.fboMultisampleSupported && 1 < antialias) { - offscreenFramebufferMultisample = new PFramebuffer(parent, texture.glWidth, texture.glHeight, antialias, 0, + if (PGraphicsOpenGL.fboMultisampleSupported && 1 < quality) { + offscreenFramebufferMultisample = new PFramebuffer(parent, texture.glWidth, texture.glHeight, quality, 0, depthBits, stencilBits, depthBits == 24 && stencilBits == 8 && packedDepthStencilSupported, false); @@ -5653,7 +5653,7 @@ public class PGraphicsOpenGL extends PGraphics { false, false); } else { - antialias = 0; + quality = 0; offscreenFramebuffer = new PFramebuffer(parent, texture.glWidth, texture.glHeight, 1, 1, depthBits, stencilBits, depthBits == 24 && stencilBits == 8 && packedDepthStencilSupported, false); diff --git a/java/libraries/opengl/src/processing/opengl/geom/LinePath.java b/java/libraries/opengl/src/processing/opengl/geom/LinePath.java index b58b48bf1..5ce2c89d8 100644 --- a/java/libraries/opengl/src/processing/opengl/geom/LinePath.java +++ b/java/libraries/opengl/src/processing/opengl/geom/LinePath.java @@ -392,7 +392,8 @@ public class LinePath { float miterlimit, PMatrix2D transform) { final LinePath dest = new LinePath(); - strokeTo(src, weight, caps, join, miterlimit, transform, new LineSink() { +// strokeTo(src, weight, caps, join, miterlimit, transform, new LineSink() { + strokeTo(src, weight, caps, join, miterlimit, transform, new LineStroker() { public void moveTo(int x0, int y0) { dest.moveTo(S15_16ToFloat(x0), S15_16ToFloat(y0)); } @@ -418,7 +419,8 @@ public class LinePath { private static void strokeTo(LinePath src, float width, int caps, int join, float miterlimit, PMatrix2D transform, - LineSink lsink) { +// LineSink lsink) { + LineStroker lsink) { lsink = new LineStroker(lsink, FloatToS15_16(width), caps, join, FloatToS15_16(miterlimit), transform == null ? identity : transform); @@ -428,7 +430,8 @@ public class LinePath { } - private static void pathTo(PathIterator pi, LineSink lsink) { +// private static void pathTo(PathIterator pi, LineSink lsink) { + private static void pathTo(PathIterator pi, LineStroker lsink) { float coords[] = new float[2]; while (!pi.isDone()) { switch (pi.currentSegment(coords)) { diff --git a/java/libraries/opengl/src/processing/opengl/geom/LineSink.java b/java/libraries/opengl/src/processing/opengl/geom/LineSink.java deleted file mode 100644 index 2e57143cd..000000000 --- a/java/libraries/opengl/src/processing/opengl/geom/LineSink.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2007, 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 - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package processing.opengl.geom; - -/** - * The LineSink interface accepts a series of line - * drawing commands: moveTo, lineTo, - * close (equivalent to a lineTo command - * with an argument equal to the argument of the last - * moveTo command), and end. - * - */ -public abstract class LineSink { - /** - * Moves the current drawing position to the point (x0, - * y0). - * - * @param x0 the X coordinate in S15.16 format - * @param y0 the Y coordinate in S15.16 format - */ - public abstract void moveTo(int x0, int y0); - - /** - * Provides a hint that the current segment should be joined to - * the following segment using an explicit miter or round join if - * required. - * - *

An application-generated path will generally have no need - * to contain calls to this method; they are typically introduced - * by a Flattener to mark segment divisions that - * appear in its input, and consumed by a Stroker - * that is responsible for emitting the miter or round join - * segments. - * - *

Other LineSink classes should simply pass this - * hint to their output sink as needed. - */ - public abstract void lineJoin(); - - /** - * Draws a line from the current drawing position to the point - * (x1, y1) and sets the current drawing position to - * (x1, y1). - * - * @param x1 the X coordinate in S15.16 format - * @param y1 the Y coordinate in S15.16 format - */ - public abstract void lineTo(int x1, int y1); - - /** - * Closes the current path by drawing a line from the current - * drawing position to the point specified by the moset recent - * moveTo command. - */ - public abstract void close(); - - /** - * Ends the current path. It may be necessary to end a path in - * order to allow end caps to be drawn. - */ - public abstract void end(); -} diff --git a/java/libraries/opengl/src/processing/opengl/geom/LineStroker.java b/java/libraries/opengl/src/processing/opengl/geom/LineStroker.java index 883e192e1..09ceb4cbe 100644 --- a/java/libraries/opengl/src/processing/opengl/geom/LineStroker.java +++ b/java/libraries/opengl/src/processing/opengl/geom/LineStroker.java @@ -27,24 +27,17 @@ package processing.opengl.geom; import processing.core.PMatrix2D; -public class LineStroker extends LineSink { - LineSink output; - - int lineWidth; - - int capStyle; - - int joinStyle; - - int miterLimit; - - int m00, m01; - - int m10, m11; - - int lineWidth2; - - long scaledLineWidth2; +public class LineStroker /*extends LineSink*/ { +// private LineSink output; + private LineStroker output; +// private int lineWidth; + private int capStyle; + private int joinStyle; +// private int miterLimit; + private int m00, m01; + private int m10, m11; + private int lineWidth2; + private long scaledLineWidth2; // For any pen offset (pen_dx, pen_dy) that does not depend on // the line orientation, the pen should be transformed so that: @@ -59,45 +52,30 @@ public class LineStroker extends LineSink { // // pen_dx'(r, theta) = r*(m00*cos(theta) + m01*sin(theta)) // pen_dy'(r, theta) = r*(m10*cos(theta) + m11*sin(theta)) - int numPenSegments; + private int numPenSegments; + private int[] pen_dx; + private int[] pen_dy; - int[] pen_dx; - - int[] pen_dy; - - boolean[] penIncluded; - - int[] join; - - int[] offset = new int[2]; - - int[] reverse = new int[100]; - - int[] miter = new int[2]; - - long miterLimitSq; - - int prev; - - int rindex; - - boolean started; - - boolean lineToOrigin; - - boolean joinToOrigin; - - int sx0, sy0, sx1, sy1, x0, y0, x1, y1; - - int mx0, my0, mx1, my1, omx, omy; - - int lx0, ly0, lx1, ly1, lx0p, ly0p, px0, py0; - - double m00_2_m01_2; - - double m10_2_m11_2; - - double m00_m10_m01_m11; + private boolean[] penIncluded; + private int[] join; + private int[] offset = new int[2]; + private int[] reverse = new int[100]; + private int[] miter = new int[2]; + private long miterLimitSq; + private int prev; + private int rindex; + private boolean started; + private boolean lineToOrigin; + private boolean joinToOrigin; +// private int sx0, sy0, sx1, sy1, x0, y0, x1, y1; +// private int mx0, my0, mx1, my1, omx, omy; +// private int lx0, ly0, lx1, ly1, lx0p, ly0p, px0, py0; + private int sx0, sy0, sx1, sy1, x0, y0; + private int mx0, my0, omx, omy; + private int px0, py0; + private double m00_2_m01_2; + private double m10_2_m11_2; + private double m00_m10_m01_m11; /** * Empty constructor. setOutput and setParameters @@ -127,7 +105,8 @@ public class LineStroker extends LineSink { * required in order to produce consistently shaped end caps and * joins. */ - public LineStroker(LineSink output, int lineWidth, int capStyle, int joinStyle, +// public LineStroker(LineSink output, int lineWidth, int capStyle, int joinStyle, + public LineStroker(LineStroker output, int lineWidth, int capStyle, int joinStyle, int miterLimit, PMatrix2D transform) { setOutput(output); setParameters(lineWidth, capStyle, joinStyle, miterLimit, transform); @@ -139,7 +118,8 @@ public class LineStroker extends LineSink { * @param output * an output LineSink. */ - public void setOutput(LineSink output) { +// public void setOutput(LineSink output) { + public void setOutput(LineStroker output) { this.output = output; } @@ -169,12 +149,12 @@ public class LineStroker extends LineSink { this.m10 = LinePath.FloatToS15_16(transform.m10); this.m11 = LinePath.FloatToS15_16(transform.m11); - this.lineWidth = lineWidth; +// this.lineWidth = lineWidth; this.lineWidth2 = lineWidth >> 1; this.scaledLineWidth2 = ((long) m00 * lineWidth2) >> 16; this.capStyle = capStyle; this.joinStyle = joinStyle; - this.miterLimit = miterLimit; +// this.miterLimit = miterLimit; this.m00_2_m01_2 = (double) m00 * m00 + (double) m01 * m01; this.m10_2_m11_2 = (double) m10 * m10 + (double) m11 * m11; @@ -203,7 +183,7 @@ public class LineStroker extends LineSink { for (int i = 0; i < numPenSegments; i++) { double r = lineWidth / 2.0; - double theta = (double) i * 2.0 * Math.PI / numPenSegments; + double theta = i * 2 * Math.PI / numPenSegments; double cos = Math.cos(theta); double sin = Math.sin(theta); @@ -528,12 +508,12 @@ public class LineStroker extends LineSink { emitLineTo(x0 - mx, y0 - my, true); emitLineTo(x1 - mx, y1 - my, true); - lx0 = x1 + mx; - ly0 = y1 + my; - lx0p = x1 - mx; - ly0p = y1 - my; - lx1 = x1; - ly1 = y1; +// lx0 = x1 + mx; +// ly0 = y1 + my; +// lx0p = x1 - mx; +// ly0p = y1 - my; +// lx1 = x1; +// ly1 = y1; this.omx = mx; this.omy = my; @@ -639,8 +619,8 @@ public class LineStroker extends LineSink { long lineLength(long ldx, long ldy) { long ldet = ((long) m00 * m11 - (long) m01 * m10) >> 16; - long la = ((long) ldy * m00 - (long) ldx * m10) / ldet; - long lb = ((long) ldy * m01 - (long) ldx * m11) / ldet; + long la = (ldy * m00 - ldx * m10) / ldet; + long lb = (ldy * m01 - ldx * m11) / ldet; long llen = (int) LinePath.hypot(la, lb); return llen; } @@ -650,8 +630,8 @@ public class LineStroker extends LineSink { drawRoundJoin(x0, y0, omx, omy, -omx, -omy, 1, false, false, ROUND_JOIN_THRESHOLD); } else if (capStyle == LinePath.CAP_SQUARE) { - long ldx = (long) (px0 - x0); - long ldy = (long) (py0 - y0); + long ldx = px0 - x0; + long ldy = py0 - y0; long llen = lineLength(ldx, ldy); if (0 < llen) { long s = (long) lineWidth2 * 65536 / llen; @@ -673,8 +653,8 @@ public class LineStroker extends LineSink { drawRoundJoin(sx0, sy0, -mx0, -my0, mx0, my0, 1, false, false, ROUND_JOIN_THRESHOLD); } else if (capStyle == LinePath.CAP_SQUARE) { - long ldx = (long) (sx1 - sx0); - long ldy = (long) (sy1 - sy0); + long ldx = sx1 - sx0; + long ldy = sy1 - sy0; long llen = lineLength(ldx, ldy); if (0 < llen) { long s = (long) lineWidth2 * 65536 / llen; diff --git a/todo.txt b/todo.txt index 42f4e7c1a..0cdc6490a 100644 --- a/todo.txt +++ b/todo.txt @@ -65,6 +65,8 @@ X if no window color set, then don't apply it o also add option for FSEM or not X nope, FSEM too buggy and error-prone +_ size(640, 480, P3D ); -> doesn't pick up as a P3D sketch + recent/open X add EditorState class, device-aware placement X get rid of restore sketch feature @@ -256,6 +258,8 @@ _ throws you onto the end of the last tab... exactly the worst location _ jer: omitting a semicolon shows the error on the line after it... _ find across all tabs (jer request) _ http://code.google.com/p/processing/issues/detail?id=25 +_ serial still causing problems on OS X +_ http://code.google.com/p/processing/issues/detail?id=52 reference/examples _ import p5 reference into the javadoc @@ -305,10 +309,6 @@ _ where the active editor is not being set null _ Internationalization _ http://code.google.com/p/processing/issues/detail?id=593 -_ libraries in java tabs (separate .java files) are reported missing -_ need to scan the .java files for imports that need to be included -_ http://code.google.com/p/processing/issues/detail?id=459 - regressions _ strange window flicker when first opened _ test libraries on android @@ -383,6 +383,11 @@ _ but it won't reload the library mapping table _ make sure there aren't library jar files named the same thing _ i.e. if one library has db.jar, then that's gonna kill another db.jar _ when the files are copied over +_ libraries in java tabs (separate .java files) are reported missing +_ need to scan the .java files for imports that need to be included +_ http://code.google.com/p/processing/issues/detail?id=459 +_ library.properties and tool.properties should reflect supported modes +_ http://code.google.com/p/processing/issues/detail?id=1050 _ when are prefs saved? could instead save whenever changes are made _ and then if the file gets modified, it'll put up an error message