| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1884,8 +1884,6 @@ public void handleDraw() { | |||
| 1884 | 1884 | } | |
| 1885 | 1885 | insideDraw = false; | |
| 1886 | 1886 | ||
| 1887 | - surface.blit(); | ||
| 1888 | - | ||
| 1889 | 1887 | if (frameCount != 0) { | |
| 1890 | 1888 | handleMethods("post"); | |
| 1891 | 1889 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -111,8 +111,8 @@ public Frame initFrame(PApplet sketch, Color backgroundColor, | |||
| 111 | 111 | // receive key and mouse events | |
| 112 | 112 | public void requestFocus(); | |
| 113 | 113 | ||
| 114 | - // finish rendering to the screen (called by PApplet) | ||
| 115 | - public void blit(); | ||
| 114 | + // // finish rendering to the screen (called by PApplet) | ||
| 115 | + // public void blit(); | ||
| 116 | 116 | ||
| 117 | 117 | // | |
| 118 | 118 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | import processing.event.MouseEvent; | |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | - public class PSurfaceAWT extends PSurfaceBasic { | ||
| 39 | + public class PSurfaceAWT extends PSurfaceNone { | ||
| 40 | 40 | GraphicsDevice displayDevice; | |
| 41 | 41 | ||
| 42 | 42 | // used for canvas to determine whether resizable or not | |
@@ -316,7 +316,7 @@ protected synchronized void render() { | |||
| 316 | 316 | BufferedImage onscreen; | |
| 317 | 317 | // Graphics off; | |
| 318 | 318 | ||
| 319 | - @Override | ||
| 319 | + | ||
| 320 | 320 | public void blit() { | |
| 321 | 321 | // Other folks that call render() (i.e. paint()) are already on the EDT. | |
| 322 | 322 | // We need to be using the EDT since we're messing with the Canvas | |
@@ -1380,6 +1380,18 @@ public void hideCursor() { | |||
| 1380 | 1380 | } | |
| 1381 | 1381 | ||
| 1382 | 1382 | ||
| 1383 | + @Override | ||
| 1384 | + public Thread createThread() { | ||
| 1385 | + return new AnimationThread() { | ||
| 1386 | + @Override | ||
| 1387 | + public void render() { | ||
| 1388 | + super.render(); | ||
| 1389 | + blit(); | ||
| 1390 | + } | ||
| 1391 | + }; | ||
| 1392 | + } | ||
| 1393 | + | ||
| 1394 | + | ||
| 1383 | 1395 | void debug(String format, Object ... args) { | |
| 1384 | 1396 | System.out.format(format + "%n", args); | |
| 1385 | 1397 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,11 @@ | |||
| 27 | 27 | import java.awt.Frame; | |
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | - public class PSurfaceBasic implements PSurface { | ||
| 30 | + /** | ||
| 31 | + * Surface that's not really visible. Used for PDF and friends, or as a base | ||
| 32 | + * class for other drawing surfaces. It includes the standard rendering loop. | ||
| 33 | + */ | ||
| 34 | + public class PSurfaceNone implements PSurface { | ||
| 31 | 35 | PApplet sketch; | |
| 32 | 36 | ||
| 33 | 37 | Thread thread; | |
@@ -38,7 +42,7 @@ public class PSurfaceBasic implements PSurface { | |||
| 38 | 42 | protected long frameRatePeriod = 1000000000L / 60L; | |
| 39 | 43 | ||
| 40 | 44 | ||
| 41 | - public PSurfaceBasic() { } | ||
| 45 | + public PSurfaceNone() { } | ||
| 42 | 46 | ||
| 43 | 47 | ||
| 44 | 48 | public void initOffscreen(PApplet sketch) { | |
@@ -94,9 +98,9 @@ public void requestFocus() { | |||
| 94 | 98 | ||
| 95 | 99 | } | |
| 96 | 100 | ||
| 97 | - public void blit() { | ||
| 98 | - // TODO Auto-generated method stub | ||
| 99 | - } | ||
| 101 | + // public void blit() { | ||
| 102 | + // // TODO Auto-generated method stub | ||
| 103 | + // } | ||
| 100 | 104 | ||
| 101 | 105 | public void setCursor(int kind) { } | |
| 102 | 106 | ||
@@ -110,9 +114,14 @@ public void hideCursor() { } | |||
| 110 | 114 | // | |
| 111 | 115 | ||
| 112 | 116 | ||
| 117 | + public Thread createThread() { | ||
| 118 | + return new AnimationThread(); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + | ||
| 113 | 122 | public void startThread() { | |
| 114 | 123 | if (thread == null) { | |
| 115 | - thread = new AnimationThread(); | ||
| 124 | + thread = createThread(); | ||
| 116 | 125 | thread.start(); | |
| 117 | 126 | } else { | |
| 118 | 127 | throw new IllegalStateException("Thread already started in " + | |
@@ -172,12 +181,17 @@ public void setFrameRate(float fps) { | |||
| 172 | 181 | //g.setFrameRate(fps); | |
| 173 | 182 | } | |
| 174 | 183 | ||
| 184 | + | ||
| 175 | 185 | class AnimationThread extends Thread { | |
| 176 | 186 | ||
| 177 | 187 | public AnimationThread() { | |
| 178 | 188 | super("Animation Thread"); | |
| 179 | 189 | } | |
| 180 | 190 | ||
| 191 | + public void render() { | ||
| 192 | + sketch.handleDraw(); | ||
| 193 | + } | ||
| 194 | + | ||
| 181 | 195 | /** | |
| 182 | 196 | * Main method for the primary animation thread. | |
| 183 | 197 | * <A HREF="http://java.sun.com/products/jfc/tsc/articles/painting/">Painting in AWT and Swing</A> | |
@@ -229,7 +243,7 @@ public void run() { | |||
| 229 | 243 | // try { | |
| 230 | 244 | // EventQueue.invokeAndWait(new Runnable() { | |
| 231 | 245 | // public void run() { | |
| 232 | - sketch.handleDraw(); | ||
| 246 | + render(); | ||
| 233 | 247 | ||
| 234 | 248 | // EventQueue.invokeLater(new Runnable() { | |
| 235 | 249 | // public void run() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -453,10 +453,10 @@ public void requestFocus() { | |||
| 453 | 453 | } | |
| 454 | 454 | ||
| 455 | 455 | ||
| 456 | - @Override | ||
| 457 | - public void blit() { | ||
| 458 | - // Nothing to do here | ||
| 459 | - } | ||
| 456 | + // @Override | ||
| 457 | + // public void blit() { | ||
| 458 | + // // Nothing to do here | ||
| 459 | + // } | ||
| 460 | 460 | ||
| 461 | 461 | ||
| 462 | 462 | @Override | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,12 +20,19 @@ o downside: breaks compatibility big time | |||
| 20 | 20 | X would have to use ALIGN_CENTER eta al, so no | |
| 21 | 21 | X noSmooth() not sticking, has to be called again inside draw() | |
| 22 | 22 | X https://github.com/processing/processing/issues/3113 | |
| 23 | + X performance issues on OS X (might be threading due to Applet) | ||
| 24 | + X https://github.com/processing/processing/issues/2423 | ||
| 25 | + X can't fix, it's all Oracle stuff | ||
| 23 | 26 | ||
| 24 | 27 | showstoppers | |
| 25 | 28 | _ static mode - no setup() / draw() - broken in OpenGL | |
| 26 | 29 | _ https://github.com/processing/processing/issues/3163 | |
| 30 | + | ||
| 31 | + high priority | ||
| 27 | 32 | _ sketch window is not placed at correct location when running a second time | |
| 28 | 33 | _ https://github.com/processing/processing/issues/3125 | |
| 34 | + _ present mode is 30-40% slower than windowed | ||
| 35 | + _ w/ this example: https://github.com/processing/processing/issues/2423 | ||
| 29 | 36 | ||
| 30 | 37 | head | |
| 31 | 38 | X Sketch window dimensions off in Java2D | |
@@ -120,9 +127,11 @@ X https://github.com/processing/processing/wiki/Window-Size-and-Full-Screen | |||
| 120 | 127 | X Linux throwing IllegalStateException: Buffers have not been created | |
| 121 | 128 | X in render() (called from blit) PSurfaceAWT:301 | |
| 122 | 129 | ||
| 130 | + | ||
| 123 | 131 | _ remove setTitle() etc methods from PSurface, just use the ones from Frame? | |
| 124 | 132 | _ and with that, encourage the use of the dummy frame object in renderers | |
| 125 | - _ destroy() removed, but bring back? is that better than dispose()? | ||
| 133 | + o destroy() removed, but bring back? is that better than dispose()? | ||
| 134 | + _ destroy() only called dispose(), so no difference | ||
| 126 | 135 | _ Python Mode has a hook for when it's called | |
| 127 | 136 | _ move checkRetina()/highResDisplay() to PApplet | |
| 128 | 137 | _ and out of Toolkit and PSurfaceAWT | |
@@ -135,6 +144,15 @@ _ or split them when sketchWidth/Height are implemented? | |||
| 135 | 144 | _ check on performance of the new EDT setup | |
| 136 | 145 | ||
| 137 | 146 | ||
| 147 | + rendering performance | ||
| 148 | + _ can't do version that draws to BufferStrategy directly | ||
| 149 | + _ pixel operations (get/set/loadPixels/saveFrame) might be fixable | ||
| 150 | + _ but can't re-run draw() to re-blit the screen | ||
| 151 | + _ because we don't split calc() and draw() | ||
| 152 | + _ even with the split, handleDraw() might need to live in PSurface | ||
| 153 | + _ add calc() option? this could ease transition | ||
| 154 | + | ||
| 155 | + | ||
| 138 | 156 | opengl misc | |
| 139 | 157 | _ sketchQuality() vs sketchSmooth()? | |
| 140 | 158 | _ move glsl entries to their own subdirectory? | |
@@ -145,8 +163,6 @@ _ right now it has a bunch of JOGL-specific code | |||
| 145 | 163 | ||
| 146 | 164 | ||
| 147 | 165 | applet/sketch | |
| 148 | - _ performance issues on OS X (might be threading due to Applet) | ||
| 149 | - _ https://github.com/processing/processing/issues/2423 | ||
| 150 | 166 | _ clean up requestFocus() stuff | |
| 151 | 167 | _ make sure it works with retina/canvas/strategy as well | |
| 152 | 168 | _ requestFocus() method probably needs to be added to PApplet | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -102,7 +102,7 @@ protected void allocate() { | |||
| 102 | 102 | ||
| 103 | 103 | @Override | |
| 104 | 104 | public PSurface createSurface() { | |
| 105 | - return surface = new PSurfaceBasic(); | ||
| 105 | + return surface = new PSurfaceNone(); | ||
| 106 | 106 | } | |
| 107 | 107 | ||
| 108 | 108 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments