mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
moving blit() around a bit, change basic surface name
This commit is contained in:
@@ -1884,8 +1884,6 @@ public class PApplet implements PConstants {
|
||||
}
|
||||
insideDraw = false;
|
||||
|
||||
surface.blit();
|
||||
|
||||
if (frameCount != 0) {
|
||||
handleMethods("post");
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ public interface PSurface {
|
||||
// receive key and mouse events
|
||||
public void requestFocus();
|
||||
|
||||
// finish rendering to the screen (called by PApplet)
|
||||
public void blit();
|
||||
// // finish rendering to the screen (called by PApplet)
|
||||
// public void blit();
|
||||
|
||||
//
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import processing.event.KeyEvent;
|
||||
import processing.event.MouseEvent;
|
||||
|
||||
|
||||
public class PSurfaceAWT extends PSurfaceBasic {
|
||||
public class PSurfaceAWT extends PSurfaceNone {
|
||||
GraphicsDevice displayDevice;
|
||||
|
||||
// used for canvas to determine whether resizable or not
|
||||
@@ -316,7 +316,7 @@ public class PSurfaceAWT extends PSurfaceBasic {
|
||||
BufferedImage onscreen;
|
||||
// Graphics off;
|
||||
|
||||
@Override
|
||||
|
||||
public void blit() {
|
||||
// Other folks that call render() (i.e. paint()) are already on the EDT.
|
||||
// We need to be using the EDT since we're messing with the Canvas
|
||||
@@ -1380,6 +1380,18 @@ public class PSurfaceAWT extends PSurfaceBasic {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Thread createThread() {
|
||||
return new AnimationThread() {
|
||||
@Override
|
||||
public void render() {
|
||||
super.render();
|
||||
blit();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void debug(String format, Object ... args) {
|
||||
System.out.format(format + "%n", args);
|
||||
}
|
||||
|
||||
+21
-7
@@ -27,7 +27,11 @@ import java.awt.Component;
|
||||
import java.awt.Frame;
|
||||
|
||||
|
||||
public class PSurfaceBasic implements PSurface {
|
||||
/**
|
||||
* Surface that's not really visible. Used for PDF and friends, or as a base
|
||||
* class for other drawing surfaces. It includes the standard rendering loop.
|
||||
*/
|
||||
public class PSurfaceNone implements PSurface {
|
||||
PApplet sketch;
|
||||
|
||||
Thread thread;
|
||||
@@ -38,7 +42,7 @@ public class PSurfaceBasic implements PSurface {
|
||||
protected long frameRatePeriod = 1000000000L / 60L;
|
||||
|
||||
|
||||
public PSurfaceBasic() { }
|
||||
public PSurfaceNone() { }
|
||||
|
||||
|
||||
public void initOffscreen(PApplet sketch) {
|
||||
@@ -94,9 +98,9 @@ public class PSurfaceBasic implements PSurface {
|
||||
|
||||
}
|
||||
|
||||
public void blit() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
// public void blit() {
|
||||
// // TODO Auto-generated method stub
|
||||
// }
|
||||
|
||||
public void setCursor(int kind) { }
|
||||
|
||||
@@ -110,9 +114,14 @@ public class PSurfaceBasic implements PSurface {
|
||||
//
|
||||
|
||||
|
||||
public Thread createThread() {
|
||||
return new AnimationThread();
|
||||
}
|
||||
|
||||
|
||||
public void startThread() {
|
||||
if (thread == null) {
|
||||
thread = new AnimationThread();
|
||||
thread = createThread();
|
||||
thread.start();
|
||||
} else {
|
||||
throw new IllegalStateException("Thread already started in " +
|
||||
@@ -172,12 +181,17 @@ public class PSurfaceBasic implements PSurface {
|
||||
//g.setFrameRate(fps);
|
||||
}
|
||||
|
||||
|
||||
class AnimationThread extends Thread {
|
||||
|
||||
public AnimationThread() {
|
||||
super("Animation Thread");
|
||||
}
|
||||
|
||||
public void render() {
|
||||
sketch.handleDraw();
|
||||
}
|
||||
|
||||
/**
|
||||
* Main method for the primary animation thread.
|
||||
* <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A>
|
||||
@@ -229,7 +243,7 @@ public class PSurfaceBasic implements PSurface {
|
||||
// try {
|
||||
// EventQueue.invokeAndWait(new Runnable() {
|
||||
// public void run() {
|
||||
sketch.handleDraw();
|
||||
render();
|
||||
|
||||
// EventQueue.invokeLater(new Runnable() {
|
||||
// public void run() {
|
||||
@@ -453,10 +453,10 @@ public class PSurfaceLWJGL implements PSurface {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void blit() {
|
||||
// Nothing to do here
|
||||
}
|
||||
// @Override
|
||||
// public void blit() {
|
||||
// // Nothing to do here
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
+19
-3
@@ -20,12 +20,19 @@ o downside: breaks compatibility big time
|
||||
X would have to use ALIGN_CENTER eta al, so no
|
||||
X noSmooth() not sticking, has to be called again inside draw()
|
||||
X https://github.com/processing/processing/issues/3113
|
||||
X performance issues on OS X (might be threading due to Applet)
|
||||
X https://github.com/processing/processing/issues/2423
|
||||
X can't fix, it's all Oracle stuff
|
||||
|
||||
showstoppers
|
||||
_ static mode - no setup() / draw() - broken in OpenGL
|
||||
_ https://github.com/processing/processing/issues/3163
|
||||
|
||||
high priority
|
||||
_ sketch window is not placed at correct location when running a second time
|
||||
_ https://github.com/processing/processing/issues/3125
|
||||
_ present mode is 30-40% slower than windowed
|
||||
_ w/ this example: https://github.com/processing/processing/issues/2423
|
||||
|
||||
head
|
||||
X Sketch window dimensions off in Java2D
|
||||
@@ -120,9 +127,11 @@ X https://github.com/processing/processing/wiki/Window-Size-and-Full-Screen
|
||||
X Linux throwing IllegalStateException: Buffers have not been created
|
||||
X in render() (called from blit) PSurfaceAWT:301
|
||||
|
||||
|
||||
_ remove setTitle() etc methods from PSurface, just use the ones from Frame?
|
||||
_ and with that, encourage the use of the dummy frame object in renderers
|
||||
_ destroy() removed, but bring back? is that better than dispose()?
|
||||
o destroy() removed, but bring back? is that better than dispose()?
|
||||
_ destroy() only called dispose(), so no difference
|
||||
_ Python Mode has a hook for when it's called
|
||||
_ move checkRetina()/highResDisplay() to PApplet
|
||||
_ and out of Toolkit and PSurfaceAWT
|
||||
@@ -135,6 +144,15 @@ _ or split them when sketchWidth/Height are implemented?
|
||||
_ check on performance of the new EDT setup
|
||||
|
||||
|
||||
rendering performance
|
||||
_ can't do version that draws to BufferStrategy directly
|
||||
_ pixel operations (get/set/loadPixels/saveFrame) might be fixable
|
||||
_ but can't re-run draw() to re-blit the screen
|
||||
_ because we don't split calc() and draw()
|
||||
_ even with the split, handleDraw() might need to live in PSurface
|
||||
_ add calc() option? this could ease transition
|
||||
|
||||
|
||||
opengl misc
|
||||
_ sketchQuality() vs sketchSmooth()?
|
||||
_ move glsl entries to their own subdirectory?
|
||||
@@ -145,8 +163,6 @@ _ right now it has a bunch of JOGL-specific code
|
||||
|
||||
|
||||
applet/sketch
|
||||
_ performance issues on OS X (might be threading due to Applet)
|
||||
_ https://github.com/processing/processing/issues/2423
|
||||
_ clean up requestFocus() stuff
|
||||
_ make sure it works with retina/canvas/strategy as well
|
||||
_ requestFocus() method probably needs to be added to PApplet
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PGraphicsPDF extends PGraphicsJava2D {
|
||||
|
||||
@Override
|
||||
public PSurface createSurface() {
|
||||
return surface = new PSurfaceBasic();
|
||||
return surface = new PSurfaceNone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user