mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
pixelDensity (OpenGL): fix running 1x on 2x screen on Mac
This commit is contained in:
@@ -779,15 +779,19 @@ public class PSurfaceJOGL implements PSurface {
|
||||
}
|
||||
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
// Even if the graphics are retina, the user might have moved the window
|
||||
// into a non-retina monitor, so we need to check
|
||||
window.getCurrentSurfaceScale(currentPixelScale);
|
||||
return currentPixelScale[0];
|
||||
return getCurrentPixelScale();
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
private float getCurrentPixelScale() {
|
||||
// Even if the graphics are retina, the user might have moved the window
|
||||
// into a non-retina monitor, so we need to check
|
||||
window.getCurrentSurfaceScale(currentPixelScale);
|
||||
return currentPixelScale[0];
|
||||
}
|
||||
|
||||
|
||||
public Component getComponent() {
|
||||
return canvas;
|
||||
@@ -890,7 +894,8 @@ 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 = getPixelScale();
|
||||
float scale = PApplet.platform == PConstants.MACOSX ?
|
||||
getCurrentPixelScale() : getPixelScale();
|
||||
setSize((int) (w / scale), (int) (h / scale));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user