mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
SCREEN_SPACE fonts fixed, threading fixes, bezierVertex fixes
This commit is contained in:
+3
-2
@@ -495,7 +495,7 @@ public class PApplet extends Applet
|
||||
fpsLastMillis = 0;
|
||||
|
||||
if (thread != null) {
|
||||
//thread.interrupt(); // wake from sleep
|
||||
thread.interrupt(); // wake from sleep
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,7 +576,8 @@ public class PApplet extends Applet
|
||||
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
|
||||
" 5b enter paint sync");
|
||||
|
||||
synchronized (g) {
|
||||
//synchronized (g) {
|
||||
synchronized (glock) {
|
||||
if (THREAD_DEBUG) println(Thread.currentThread().getName() +
|
||||
" 5c inside paint sync");
|
||||
//System.out.println("5b paint has sync");
|
||||
|
||||
+2
-2
@@ -530,7 +530,7 @@ public class PFont implements PConstants {
|
||||
*/
|
||||
|
||||
} else { // SCREEN_SPACE
|
||||
parent.loadPixels();
|
||||
//parent.loadPixels();
|
||||
|
||||
int xx = (int) x + leftExtent[glyph];;
|
||||
int yy = (int) y - topExtent[glyph];
|
||||
@@ -585,7 +585,7 @@ public class PFont implements PConstants {
|
||||
(( a1 * fb + a2 * ( p2 & 0xff)) >> 8));
|
||||
}
|
||||
}
|
||||
parent.updatePixels();
|
||||
//parent.updatePixels();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -1568,7 +1568,9 @@ public class PGraphics extends PImage implements PConstants {
|
||||
|
||||
public void text(char c, float x, float y) {
|
||||
if (textFont != null) {
|
||||
if (textSpace == SCREEN_SPACE) loadPixels();
|
||||
textFont.text(c, x, y, this);
|
||||
if (textSpace == SCREEN_SPACE) updatePixels();
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("use textFont() before text()");
|
||||
@@ -1585,7 +1587,9 @@ public class PGraphics extends PImage implements PConstants {
|
||||
// this just has to pass through.. if z is not zero when
|
||||
// drawing to non-depth(), the PFont will have to throw an error.
|
||||
if (textFont != null) {
|
||||
if (textSpace == SCREEN_SPACE) loadPixels();
|
||||
textFont.text(c, x, y, z, this);
|
||||
if (textSpace == SCREEN_SPACE) updatePixels();
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("use textFont() before text()");
|
||||
@@ -1597,8 +1601,9 @@ public class PGraphics extends PImage implements PConstants {
|
||||
|
||||
public void text(String s, float x, float y) {
|
||||
if (textFont != null) {
|
||||
if (textSpace == SCREEN_SPACE) loadPixels();
|
||||
textFont.text(s, x, y, this);
|
||||
|
||||
if (textSpace == SCREEN_SPACE) updatePixels();
|
||||
} else {
|
||||
throw new RuntimeException("use textFont() before text()");
|
||||
}
|
||||
@@ -1614,7 +1619,9 @@ public class PGraphics extends PImage implements PConstants {
|
||||
// this just has to pass through.. if z is not zero when
|
||||
// drawing to non-depth(), the PFont will have to throw an error.
|
||||
if (textFont != null) {
|
||||
if (textSpace == SCREEN_SPACE) loadPixels();
|
||||
textFont.text(s, x, y, z, this);
|
||||
if (textSpace == SCREEN_SPACE) updatePixels();
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("use textFont() before text()");
|
||||
@@ -1662,7 +1669,9 @@ public class PGraphics extends PImage implements PConstants {
|
||||
if (y2 < y1) {
|
||||
float temp = y1; y1 = y2; y2 = temp;
|
||||
}
|
||||
if (textSpace == SCREEN_SPACE) loadPixels();
|
||||
textFont.text(s, x1, y1, x2, y2, this);
|
||||
if (textSpace == SCREEN_SPACE) updatePixels();
|
||||
|
||||
} else {
|
||||
throw new RuntimeException("use textFont() before text()");
|
||||
|
||||
+18
-3
@@ -158,7 +158,8 @@ public class PGraphics2 extends PGraphics {
|
||||
|
||||
case LINE_STRIP:
|
||||
case LINE_LOOP:
|
||||
if (vertexCount == 1) {
|
||||
if (gpath == null) {
|
||||
//if (vertexCount == 1) {
|
||||
gpath = new GeneralPath();
|
||||
gpath.moveTo(x, y);
|
||||
} else {
|
||||
@@ -274,7 +275,8 @@ public class PGraphics2 extends PGraphics {
|
||||
case POLYGON:
|
||||
case CONCAVE_POLYGON:
|
||||
case CONVEX_POLYGON:
|
||||
if (vertexCount == 1) {
|
||||
//if (vertexCount == 1) {
|
||||
if (gpath == null) {
|
||||
//System.out.println("starting poly path " + x + " " + y);
|
||||
gpath = new GeneralPath();
|
||||
gpath.moveTo(x, y);
|
||||
@@ -311,7 +313,9 @@ public class PGraphics2 extends PGraphics {
|
||||
case POLYGON:
|
||||
case CONCAVE_POLYGON:
|
||||
case CONVEX_POLYGON:
|
||||
if (splineVertexCount == 1) {
|
||||
//if (splineVertexCount == 1) {
|
||||
if (gpath == null) {
|
||||
gpath = new GeneralPath();
|
||||
gpath.moveTo(x, y);
|
||||
|
||||
} else if (splineVertexCount >= 4) {
|
||||
@@ -332,6 +336,17 @@ public class PGraphics2 extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
public void beginShape(int kind) {
|
||||
super.beginShape(kind);
|
||||
|
||||
// set gpath to null, because when mixing curves and straight
|
||||
// lines, vertexCount will be set back to zero, so vertexCount == 1
|
||||
// is no longer a good indicator of whether the shape is new.
|
||||
// this way, just check to see if gpath is null, and if it isn't
|
||||
// then just use it to continue the shape.
|
||||
gpath = null;
|
||||
}
|
||||
|
||||
public void endShape() {
|
||||
//System.out.println("endShape");
|
||||
|
||||
|
||||
@@ -9,6 +9,22 @@ X fix noLoop() not properly running
|
||||
X also fix redraw() to include interrupt() again
|
||||
X loadPixels throwing NPEs
|
||||
X fixes to SCREEN_SPACE text not being sized properly
|
||||
X loadPixels()/updatePixels() on screen space text (ouch)
|
||||
|
||||
_ really need to take a look at the curve/vertex code
|
||||
_ make sure we don't want curveVertices(1,2,3,u,v)
|
||||
_ also make test cases so that java2d and java11 behave the same
|
||||
|
||||
_ should nf() handle commas as well?
|
||||
_ yes, and add nf(int what) so that non-padded version works
|
||||
_ but don't put commas into the zero-padded version
|
||||
_ make nf/nfs/nfp not so weird
|
||||
|
||||
_ text should maybe use built-in font if available?
|
||||
_ don't use pixels to do screen space text inside PFont
|
||||
_ add a function in PGraphics for direct pixel image impl
|
||||
_ in java2d, can quickly blit the image itself
|
||||
_ this way, can isolate it for gl too, which will use glBitmap
|
||||
|
||||
X made loadStrings() and openStream(File) static again
|
||||
_ fix other stuff that's supposed to be static
|
||||
|
||||
Reference in New Issue
Block a user