From b8c7c5e7bd11efa579cbf2eb811ed6e7ff951cb5 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 8 Jun 2015 18:31:14 -0400 Subject: [PATCH] prevent attempts to do 2x on non-2x hardware --- core/src/processing/core/PApplet.java | 7 ++++++- core/todo.txt | 7 ++++--- todo.txt | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index 8cdb3c014..8c7cb2036 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -1050,7 +1050,12 @@ public class PApplet implements PConstants { if (density != 1 && density != 2) { throw new RuntimeException("pixelDensity() can only be 1 or 2"); } - this.pixelDensity = density; + if (density == 2 && displayDensity() == 1) { + // Don't throw exception because the sketch should still work + System.err.println("pixelDensity(2) is not available for this display, using pixelDensity(1) instead"); + } else { + this.pixelDensity = density; + } } } } diff --git a/core/todo.txt b/core/todo.txt index 8a26f999d..724872afa 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -83,6 +83,10 @@ X just do pixelFactor() (and pull it during compilation)? X add sketchPixelFactor() to handle the scenario? X or is it just a boolean, because pixelFactor(2) is the only option? X remove retina hint +X move checkRetina()/highResDisplay() to PApplet +X and out of Toolkit and PSurfaceAWT +X prevent running _2X renderers on non-2x hardware +X pixelDensity() needs to be called after size() or fullScreen() andres/opengl X set(0, 0, image) does not set alpha channel to opaque in P2D/P3D @@ -134,7 +138,6 @@ _ sketch sometimes doesn't show with noLoop() on Linux _ https://github.com/processing/processing/issues/3316 _ sketch not always showing with empty draw() _ https://github.com/processing/processing/issues/3363 -_ prevent running _2X renderers on non-2x hardware _ PGraphic ignores PNG transparency (regression from 3.0a5) _ https://github.com/processing/processing/issues/3317 _ strokeWeight() in setup() not working for default renderer @@ -442,8 +445,6 @@ _ add requestFocus() method to PApplet (or surface?) o destroy() removed, but bring back? is that better than dispose()? _ destroy() only called dispose(), so no difference _ Python Mode has a hook for when it's called -_ move checkRetina()/highResDisplay() to PApplet -_ and out of Toolkit and PSurfaceAWT _ probably should also check to make sure PApplet running JVM 8 _ or compile against 1.8 and force it? diff --git a/todo.txt b/todo.txt index e6c746c8d..d43d85b37 100644 --- a/todo.txt +++ b/todo.txt @@ -27,7 +27,6 @@ o Update Windows icons for multiple sizes, implement them in the PDE o http://code.google.com/p/processing/issues/detail?id=632 X closed during the 2.x cycle - contribs X several Greek translation updates X https://github.com/processing/processing/issues/3329 @@ -56,6 +55,8 @@ _ a checkbox for "show this welcome each time" (default to checked) _ a button to dismiss the welcome screen (e.g., "get started") _ 2.x vs 3.x sketchbook battle (part of the welcome screen item) _ if a v2 sketchbook already exists, show a prompt to choose either creating a new Processing 3 sketch folder or use the existing v2 one, plus a link to GitHub wiki page with details +_ send list of installed Libraries, Modes, Tools, and Examples on update +_ https://github.com/processing/processing/issues/3365 gui