-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Add required parameters in _flipPixels function #6726
Merged
davepagurek
merged 1 commit into
processing:main
from
mohitbalwani:undefined-height-bug
Jan 17, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 for the fix! Does this still work correctly when you've set
pixelDensity(2)
insetup
? I wonder if we need to be multiplying by the density hereThere 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 tried using pixelDensity() in setup but nothing was being rendered. Am I missing something in this code?
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.
In instance mode I think you need
p.pixelDensity(2)
.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.
Oh ya. Thanks!
The current fix works as expected when setting different densities of pixels.
I also checked the behaviour by multiplying the dimensions with density while passing in function call but I was getting another console error saying :
offset is out of bounds
. So, looks like some calculations go wrong inside flipPixels function in the case when we multiply dimensions with density.I saw a similar implementation in readPixelsWebGL() function and stackoverflow answers (https://stackoverflow.com/questions/41969562/how-can-i-flip-the-result-of-webglrenderingcontext-readpixels) so looks like we should not consider multiplying by density here? Or maybe we need to recalculate the flip pixels logic considering density (I tried that but wasn't able to figure out).
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.
Ah, wait, logically it should have it, but we just set it to 1 here while exporting:
p5.js/src/image/loading_displaying.js
Line 311 in 58821e2
So I think width/height on its own is fine!