-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Properly calculate BPP for displayio.Bitmap #1674
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
tannewt
left a comment
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.
Looks good! Thank you for the fix!
tannewt
left a comment
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.
After thinking about this I don't think this is the right fix. Bitmap only handles 1, 2, 4 or 8 bits. It can't do number of bits that don't fit evenly into a byte.
|
Hmm, in that case, the original code was correct up to 8 bits, be just need a special case for multiples of 8. |
|
We probably should also have a check for a maximum value — what that would be? |
|
Actually we don't need to check for max value, because |
|
The implementation caps at 8 bit color: https://github.com/adafruit/circuitpython/blob/master/shared-module/displayio/Bitmap.c#L48 I think this implementation may still infinite loop for value counts > 0x80000000 because the minimum value based on bits will wrap around. Do we want to support 32 bit color in the future or is 24 enough? We can cap the number for the API here and leave the above check for the implementation. |
|
Oh, you mean the |
|
I suppose we now need to add a check that |
tannewt
left a comment
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.
Looks good! Unfortunately the translation check isn't happy because make translate wasn't run after adding it.
|
@deshipu Can you fix the translation conflicts and resubmit? (Maybe after your other PR's are cleared.) |
tannewt
left a comment
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.
Travis is happy. Thank you!
No description provided.