mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
more package movement for the separate renderers
This commit is contained in:
+7
-5
@@ -22,7 +22,7 @@
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.core;
|
||||
package processing.awt;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.font.TextAttribute;
|
||||
@@ -32,6 +32,8 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import processing.core.*;
|
||||
|
||||
|
||||
/**
|
||||
* Subclass for PGraphics that implements the graphics API using Java2D.
|
||||
@@ -1571,7 +1573,7 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
cash = new ImageCache(); //who);
|
||||
setCache(who, cash);
|
||||
who.updatePixels(); // mark the whole thing for update
|
||||
who.modified = true;
|
||||
who.setModified();
|
||||
}
|
||||
|
||||
// If image previously was tinted, or the color changed
|
||||
@@ -1583,7 +1585,7 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
who.updatePixels();
|
||||
}
|
||||
|
||||
if (who.modified) {
|
||||
if (who.isModified()) {
|
||||
if (who.pixels == null) {
|
||||
// This might be a PGraphics that hasn't been drawn to yet.
|
||||
// Can't just bail because the cache has been created above.
|
||||
@@ -1591,7 +1593,7 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
who.pixels = new int[who.width * who.height];
|
||||
}
|
||||
cash.update(who, tint, tintColor);
|
||||
who.modified = false;
|
||||
who.setModified(false);
|
||||
}
|
||||
|
||||
g2.drawImage(((ImageCache) getCache(who)).image,
|
||||
@@ -2030,7 +2032,7 @@ public class PGraphicsJava2D extends PGraphics {
|
||||
// also changes global setting for antialiasing, but this is because it's
|
||||
// not possible to enable/disable them independently in some situations.
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
textFont.smooth ?
|
||||
textFont.isSmooth() ?
|
||||
RenderingHints.VALUE_ANTIALIAS_ON :
|
||||
RenderingHints.VALUE_ANTIALIAS_OFF);
|
||||
|
||||
+14
-9
@@ -20,7 +20,7 @@
|
||||
Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.core;
|
||||
package processing.awt;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
@@ -32,6 +32,11 @@ import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PConstants;
|
||||
import processing.core.PGraphics;
|
||||
import processing.core.PImage;
|
||||
import processing.core.PSurfaceNone;
|
||||
import processing.event.KeyEvent;
|
||||
import processing.event.MouseEvent;
|
||||
|
||||
@@ -101,7 +106,7 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
canvas.addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
if (!sketch.looping) {
|
||||
if (!sketch.isLooping()) {
|
||||
// make sure this is a real resize event, not just initial setup
|
||||
// https://github.com/processing/processing/issues/3310
|
||||
Dimension canvasSize = canvas.getSize();
|
||||
@@ -792,16 +797,16 @@ public class PSurfaceAWT extends PSurfaceNone {
|
||||
// needs to resize the frame, which will resize the canvas, and so on...
|
||||
@Override
|
||||
public void setSize(int wide, int high) {
|
||||
if (PApplet.DEBUG) {
|
||||
//System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
|
||||
new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out);
|
||||
}
|
||||
// if (PApplet.DEBUG) {
|
||||
// //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
|
||||
// new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out);
|
||||
// }
|
||||
|
||||
//if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch
|
||||
if (wide == sketch.width && high == sketch.height) {
|
||||
if (PApplet.DEBUG) {
|
||||
new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out);
|
||||
}
|
||||
// if (PApplet.DEBUG) {
|
||||
// new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out);
|
||||
// }
|
||||
return; // unchanged, don't rebuild everything
|
||||
}
|
||||
|
||||
@@ -2526,6 +2526,11 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
|
||||
|
||||
public boolean isLooping() {
|
||||
return looping;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public interface PConstants {
|
||||
});
|
||||
*/
|
||||
|
||||
static final String JAVA2D = "processing.core.PGraphicsJava2D";
|
||||
static final String JAVA2D = "processing.awt.PGraphicsJava2D";
|
||||
|
||||
static final String P2D = "processing.opengl.PGraphics2D";
|
||||
static final String P3D = "processing.opengl.PGraphics3D";
|
||||
@@ -70,7 +70,7 @@ public interface PConstants {
|
||||
// static final String E2D = PGraphicsDanger2D.class.getName();
|
||||
|
||||
// Experimental JavaFX renderer; even better 2D performance
|
||||
static final String FX2D = "processing.core.PGraphicsFX2D";
|
||||
static final String FX2D = "processing.javafx.PGraphicsFX2D";
|
||||
|
||||
static final String PDF = "processing.pdf.PGraphicsPDF";
|
||||
static final String SVG = "processing.svg.PGraphicsSVG";
|
||||
|
||||
@@ -560,6 +560,11 @@ public class PFont implements PConstants {
|
||||
}
|
||||
|
||||
|
||||
public boolean isSmooth() {
|
||||
return smooth;
|
||||
}
|
||||
|
||||
|
||||
public boolean isStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.awt.font.FontRenderContext;
|
||||
import java.util.HashMap;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import processing.awt.PSurfaceAWT;
|
||||
import processing.opengl.PGL;
|
||||
import processing.opengl.PShader;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
package processing.core;
|
||||
|
||||
import processing.awt.PGraphicsJava2D;
|
||||
import processing.data.*;
|
||||
|
||||
import java.awt.Paint;
|
||||
|
||||
@@ -28,12 +28,12 @@ package processing.core;
|
||||
* class for other drawing surfaces. It includes the standard rendering loop.
|
||||
*/
|
||||
public class PSurfaceNone implements PSurface {
|
||||
PApplet sketch;
|
||||
PGraphics graphics;
|
||||
protected PApplet sketch;
|
||||
protected PGraphics graphics;
|
||||
|
||||
Thread thread;
|
||||
boolean paused;
|
||||
Object pauseObject = new Object();
|
||||
protected Thread thread;
|
||||
protected boolean paused;
|
||||
protected Object pauseObject = new Object();
|
||||
|
||||
protected float frameRateTarget = 60;
|
||||
protected long frameRatePeriod = 1000000000L / 60L;
|
||||
@@ -245,7 +245,7 @@ public class PSurfaceNone implements PSurface {
|
||||
}
|
||||
|
||||
|
||||
class AnimationThread extends Thread {
|
||||
public class AnimationThread extends Thread {
|
||||
|
||||
public AnimationThread() {
|
||||
super("Animation Thread");
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.*;
|
||||
import com.lowagie.text.*;
|
||||
import com.lowagie.text.pdf.*;
|
||||
|
||||
import processing.awt.PGraphicsJava2D;
|
||||
import processing.core.*;
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.apache.batik.dom.GenericDOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
|
||||
import processing.awt.PGraphicsJava2D;
|
||||
import processing.core.*;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user