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 output colorspace non-initialization fix #7611

Merged
merged 1 commit into from
Feb 20, 2023

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

Copy link
Collaborator

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this change with the reproducer code from the issue on a Feather ESP32-S2 TFT, can confirm I no longer see the different returned values with this build. 0x00ff00 in always results in 0x7e0 out with this version.

@dhalbert dhalbert changed the base branch from main to 8.0.x February 20, 2023 01:32
@dhalbert
Copy link
Collaborator

I am going to do an 8.0.3 soon. I changed the base to 8.0.x and there are no conflicts. @FoamyGuy Thanks for the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants