Skip to content

Commit 3802cd9

Browse files
committed
pixelDensity (all): allow 2x if windowed or SPAN, and any screen is 2x
1 parent 247e8e9 commit 3802cd9

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

core/src/processing/core/PApplet.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ public PSurface getSurface() {
910910
public int pixelDensity = 1;
911911
int suggestedDensity = -1;
912912

913+
boolean present;
914+
913915
String outputPath;
914916
OutputStream outputStream;
915917

@@ -1127,17 +1129,17 @@ final public int sketchPixelDensity() {
11271129
* @see PApplet#size(int,int)
11281130
*/
11291131
public int displayDensity() {
1130-
if (display == SPAN) {
1131-
// walk through all displays, use lowest common denominator
1132-
for (int i = 0; i < displayDevices.length; i++) {
1133-
if (displayDensity(i) != 2) {
1134-
return 1;
1135-
}
1132+
if (display != SPAN && (fullScreen || present)) {
1133+
return displayDensity(display);
1134+
}
1135+
// walk through all displays, use 2 if any display is 2
1136+
for (int i = 0; i < displayDevices.length; i++) {
1137+
if (displayDensity(i+1) == 2) {
1138+
return 2;
11361139
}
1137-
// If nobody's density is 1 (or != 2, to be exact) then everyone is 2
1138-
return 2;
11391140
}
1140-
return displayDensity(display);
1141+
// If nobody's density is 2 then everyone is 1
1142+
return 1;
11411143
}
11421144

11431145
/**
@@ -10505,6 +10507,8 @@ public void uncaughtException(Thread t, Throwable e) {
1050510507
// (most likely set from the PDE based on a system DPI scaling)
1050610508
sketch.suggestedDensity = density;
1050710509

10510+
sketch.present = present;
10511+
1050810512
// For 3.0.1, moved this above handleSettings() so that loadImage() can be
1050910513
// used inside settings(). Sets a terrible precedent, but the alternative
1051010514
// of not being able to size a sketch to an image is driving people loopy.

0 commit comments

Comments
 (0)