-
-
Notifications
You must be signed in to change notification settings - Fork 86
Change the default display density #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In processing/processing4#1038, Processing modified the default display density, which changes how sketches allocate pixels and breaks many PEmbroider examples. The temporary fix is to use `pixelDensity(1)`.
Fixes breaking change caused by processing/processing4#1038.
@@ -10105,6 +10105,8 @@ static public void runSketch(final String[] args, | |||
sketch.present = present; | |||
sketch.fullScreen = fullScreen; | |||
|
|||
sketch.pixelDensity = sketch.displayDensity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I stumbled across this just now while helping a new CS teacher come up to speed on one of my former class projects. The project uses a nested loop and the width and height system variables to change the color of each pixel in the pixels array (as described in chapter 15 of Shiffman's "Learning Processing"). As of this change, that same loop only modifies the pixels in a small portion of the display window on my high DPI laptop. It's a nasty little bug if you haven't faithfully kept up with the Processing release notes. Perhaps you could display a warning message to ease folks into it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @agreyson Thanks for your comment! We made this change because sketches looked blurry on high-DPI displays, but as you found out, it can break older code that works with pixels directly. This happens because different pixelDensity values introduce inconsistencies in per-pixel operations. @catilac and @tychedelia are exploring solutions here: #1145, and suggestions are welcome on the issue thread: #1131. Since the fix is more complex than expected, adding a warning message could be a helpful interim step to prevent the headaches you ran into. Thanks for your suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @SableRaf. I appreciate the speedy response! Given that this breaks a substantial chunk of @shiffman instructional materials, my recommendation would be to revert #1038 for now, and leave it to knowledgable developers to call pixelDensity explicitly until you've found a solution (easier said than done, judging by the commentary). Thank you for your work on Processing, and best of luck!
Fixes #950
Changes the default sketch density to reflect the current display in use.