| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,7 +61,8 @@ public class PSurfaceAWT extends PSurfaceNone { | |||
| 61 | 61 | ||
| 62 | 62 | ||
| 63 | 63 | public PSurfaceAWT(PGraphics graphics) { | |
| 64 | - this.graphics = graphics; | ||
| 64 | + //this.graphics = graphics; | ||
| 65 | + super(graphics); | ||
| 65 | 66 | ||
| 66 | 67 | if (checkRetina()) { | |
| 67 | 68 | // System.out.println("retina in use"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,16 +22,14 @@ | |||
| 22 | 22 | ||
| 23 | 23 | package processing.core; | |
| 24 | 24 | ||
| 25 | - //import java.awt.Color; | ||
| 26 | - //import java.awt.Component; | ||
| 27 | - | ||
| 28 | 25 | ||
| 29 | 26 | /** | |
| 30 | 27 | * Surface that's not really visible. Used for PDF and friends, or as a base | |
| 31 | 28 | * class for other drawing surfaces. It includes the standard rendering loop. | |
| 32 | 29 | */ | |
| 33 | 30 | public class PSurfaceNone implements PSurface { | |
| 34 | 31 | PApplet sketch; | |
| 32 | + PGraphics graphics; | ||
| 35 | 33 | ||
| 36 | 34 | Thread thread; | |
| 37 | 35 | boolean paused; | |
@@ -41,7 +39,9 @@ public class PSurfaceNone implements PSurface { | |||
| 41 | 39 | protected long frameRatePeriod = 1000000000L / 60L; | |
| 42 | 40 | ||
| 43 | 41 | ||
| 44 | - public PSurfaceNone() { } | ||
| 42 | + public PSurfaceNone(PGraphics graphics) { | ||
| 43 | + this.graphics = graphics; | ||
| 44 | + } | ||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | @Override | |
@@ -98,9 +98,27 @@ public void setupExternalMessages() { } | |||
| 98 | 98 | // | |
| 99 | 99 | ||
| 100 | 100 | ||
| 101 | - public void setSize(int width, int height) { | ||
| 102 | - // TODO Auto-generated method stub | ||
| 101 | + @Override | ||
| 102 | + public void setSize(int wide, int high) { | ||
| 103 | + if (PApplet.DEBUG) { | ||
| 104 | + //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high); | ||
| 105 | + new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch | ||
| 109 | + if (wide == sketch.width && high == sketch.height) { | ||
| 110 | + if (PApplet.DEBUG) { | ||
| 111 | + new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out); | ||
| 112 | + } | ||
| 113 | + return; // unchanged, don't rebuild everything | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + //throw new RuntimeException("implement me, see readme.md"); | ||
| 117 | + sketch.width = wide; | ||
| 118 | + sketch.height = high; | ||
| 103 | 119 | ||
| 120 | + // set PGraphics variables for width/height/pixelWidth/pixelHeight | ||
| 121 | + graphics.setSize(wide, high); | ||
| 104 | 122 | } | |
| 105 | 123 | ||
| 106 | 124 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,7 +104,7 @@ protected void allocate() { | |||
| 104 | 104 | ||
| 105 | 105 | @Override | |
| 106 | 106 | public PSurface createSurface() { | |
| 107 | - return surface = new PSurfaceNone(); | ||
| 107 | + return surface = new PSurfaceNone(this); | ||
| 108 | 108 | } | |
| 109 | 109 | ||
| 110 | 110 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments