introduce MACOS constant, deprecate MACOSX

This commit is contained in:
Ben Fry
2019-10-07 18:23:34 -04:00
parent ad27795c0e
commit 8f994389c4
3 changed files with 20 additions and 11 deletions
+5 -1
View File
@@ -80,9 +80,13 @@ public interface PConstants {
static final int OTHER = 0;
static final int WINDOWS = 1;
static final int MACOSX = 2;
static final int MACOS = 2;
static final int LINUX = 3;
/** @deprecated Marketers gonna market, use {@link #MACOS} */
@Deprecated
static final int MACOSX = 2;
static final String[] platformNames = {
"other", "windows", "macosx", "linux"
};
+6 -4
View File
@@ -852,10 +852,12 @@ public abstract class PGL {
saveFirstFrame();
}
if (!clearColor && 0 < sketch.frameCount || !sketch.isLooping()) {
enableFBOLayer();
if (SINGLE_BUFFERED) {
createFBOLayer();
if (fboAllowed) {
if (!clearColor && 0 < sketch.frameCount || !sketch.isLooping()) {
enableFBOLayer();
if (SINGLE_BUFFERED) {
createFBOLayer();
}
}
}
}
+9 -6
View File
@@ -25,6 +25,7 @@
package processing.opengl;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
@@ -109,6 +110,7 @@ public class PSurfaceJOGL implements PSurface {
protected boolean external = false;
public PSurfaceJOGL(PGraphics graphics) {
this.graphics = graphics;
this.pgl = (PJOGL) ((PGraphicsOpenGL)graphics).pgl;
@@ -174,7 +176,8 @@ public class PSurfaceJOGL implements PSurface {
awtDisplayDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
}
displayRect = awtDisplayDevice.getDefaultConfiguration().getBounds();
GraphicsConfiguration config = awtDisplayDevice.getDefaultConfiguration();
displayRect = config.getBounds();
}
@@ -257,7 +260,7 @@ public class PSurfaceJOGL implements PSurface {
// window = GLWindow.create(displayDevice.getScreen(), pgl.getCaps());
// }
windowScaleFactor = PApplet.platform == PConstants.MACOSX ?
windowScaleFactor = PApplet.platform == PConstants.MACOS ?
1 : sketch.pixelDensity;
boolean spanDisplays = sketch.sketchDisplay() == PConstants.SPAN;
@@ -321,7 +324,7 @@ public class PSurfaceJOGL implements PSurface {
sketch.setSize(sketchWidth, sketchHeight);
float[] reqSurfacePixelScale;
if (graphics.is2X() && PApplet.platform == PConstants.MACOSX) {
if (graphics.is2X() && PApplet.platform == PConstants.MACOS) {
// Retina
reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE,
ScalableSurface.AUTOMAX_PIXELSCALE };
@@ -777,7 +780,7 @@ public class PSurfaceJOGL implements PSurface {
return 1;
}
if (PApplet.platform == PConstants.MACOSX) {
if (PApplet.platform == PConstants.MACOS) {
return getCurrentPixelScale();
}
@@ -900,7 +903,7 @@ public class PSurfaceJOGL implements PSurface {
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
pgl.resetFBOLayer();
pgl.getGL(drawable);
float scale = PApplet.platform == PConstants.MACOSX ?
float scale = PApplet.platform == PConstants.MACOS ?
getCurrentPixelScale() : getPixelScale();
setSize((int) (w / scale), (int) (h / scale));
}
@@ -1044,7 +1047,7 @@ public class PSurfaceJOGL implements PSurface {
}
int scale;
if (PApplet.platform == PConstants.MACOSX) {
if (PApplet.platform == PConstants.MACOS) {
scale = (int) getCurrentPixelScale();
} else {
scale = (int) getPixelScale();