(int wide, int high)
| 944 | |
| 945 | // needs to resize the frame, which will resize the canvas, and so on... |
| 946 | @Override |
| 947 | public void setSize(int wide, int high) { |
| 948 | // When the surface is set to resizable via surface.setResizable(true), |
| 949 | // a crash may occur if the user sets the window to size zero. |
| 950 | // https://github.com/processing/processing/issues/5052 |
| 951 | if (high <= 0) { |
| 952 | high = 1; |
| 953 | } |
| 954 | if (wide <= 0) { |
| 955 | wide = 1; |
| 956 | } |
| 957 | |
| 958 | // if (PApplet.DEBUG) { |
| 959 | // //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high); |
| 960 | // new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out); |
| 961 | // } |
| 962 | |
| 963 | //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch |
| 964 | if (wide == sketch.width && high == sketch.height && |
| 965 | (frame == null || currentInsets.equals(frame.getInsets()))) { |
| 966 | // if (PApplet.DEBUG) { |
| 967 | // new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out); |
| 968 | // } |
| 969 | return; // unchanged, don't rebuild everything |
| 970 | } |
| 971 | |
| 972 | sketchWidth = wide * windowScaleFactor; |
| 973 | sketchHeight = high * windowScaleFactor; |
| 974 | |
| 975 | // canvas.setSize(wide, high); |
| 976 | // frame.setSize(wide, high); |
| 977 | if (frame != null) { // skip if just a canvas |
| 978 | setFrameSize(); //wide, high); |
| 979 | } |
| 980 | setCanvasSize(); |
| 981 | // if (frame != null) { |
| 982 | // frame.setLocationRelativeTo(null); |
| 983 | // } |
| 984 | |
| 985 | //initImage(graphics, wide, high); |
| 986 | |
| 987 | //throw new RuntimeException("implement me, see readme.md"); |
| 988 | sketch.setSize(wide, high); |
| 989 | // sketch.width = wide; |
| 990 | // sketch.height = high; |
| 991 | |
| 992 | // set PGraphics variables for width/height/pixelWidth/pixelHeight |
| 993 | graphics.setSize(wide, high); |
| 994 | // System.out.println("out of setSize()"); |
| 995 | } |
| 996 | |
| 997 | |
| 998 | //public void initImage(PGraphics gr, int wide, int high) { |
no test coverage detected