Skip to content
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

ColorConverter non-initialization memory fix #7610

Closed
wants to merge 17 commits into from

Conversation

gamblor21
Copy link
Member

Fix for #7609

The output colorspace struct was created every call to convert but the structure was not initialized leading to random values. Specifically reverse_bytes_in_word was referenced in the conversion function with never being set. This lead to unpredictable behavior.

Moved the colorspace object to the class structure so it can be reused and is properly initialized. This also allows the output colorspace to be made to be configurable in the future.

Tested on a KB2040.

import displayio
cc = displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB888)
hex(cc.convert(0x00ff00))

Should return 0x7e0
Before would randomly return 0xe007

@gamblor21
Copy link
Member Author

Messed up and included my GIF PR in this. Will resubmit, don't have time to fight with git.

@gamblor21 gamblor21 closed this Feb 18, 2023
@gamblor21 gamblor21 deleted the colorconverter_mem_fix branch February 18, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant