MCPcopy Index your code
hub / github.com/benfry/processing4 / setSize

Method setSize

core/src/processing/awt/PSurfaceAWT.java:802–851  ·  view source on GitHub ↗
(int wide, int high)

Source from the content-addressed store, hash-verified

800
801 // needs to resize the frame, which will resize the canvas, and so on...
802 @Override
803 public void setSize(int wide, int high) {
804 // When the surface is set to resizable via surface.setResizable(true),
805 // a crash may occur if the user sets the window to size zero.
806 // https://github.com/processing/processing/issues/5052
807 if (high <= 0) {
808 high = 1;
809 }
810 if (wide <= 0) {
811 wide = 1;
812 }
813
814// if (PApplet.DEBUG) {
815// //System.out.format("frame visible %b, setSize(%d, %d) %n", frame.isVisible(), wide, high);
816// new Exception(String.format("setSize(%d, %d)", wide, high)).printStackTrace(System.out);
817// }
818
819 //if (wide == sketchWidth && high == sketchHeight) { // doesn't work on launch
820 if (wide == sketch.width && high == sketch.height &&
821 (frame == null || currentInsets.equals(frame.getInsets()))) {
822// if (PApplet.DEBUG) {
823// new Exception("w/h unchanged " + wide + " " + high).printStackTrace(System.out);
824// }
825 return; // unchanged, don't rebuild everything
826 }
827
828 sketchWidth = wide * windowScaleFactor;
829 sketchHeight = high * windowScaleFactor;
830
831// canvas.setSize(wide, high);
832// frame.setSize(wide, high);
833 if (frame != null) { // skip if just a canvas
834 setFrameSize(); //wide, high);
835 }
836 setCanvasSize();
837// if (frame != null) {
838// frame.setLocationRelativeTo(null);
839// }
840
841 //initImage(graphics, wide, high);
842
843 //throw new RuntimeException("implement me, see readme.md");
844 sketch.setSize(wide, high);
845// sketch.width = wide;
846// sketch.height = high;
847
848 // set PGraphics variables for width/height/pixelWidth/pixelHeight
849 graphics.setSize(wide, high);
850// System.out.println("out of setSize()");
851 }
852
853
854 //public void initImage(PGraphics gr, int wide, int high) {

Callers 2

initFrameMethod · 0.95
componentResizedMethod · 0.95

Calls 4

setFrameSizeMethod · 0.95
setCanvasSizeMethod · 0.95
setSizeMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected