Skip to content

Fix two RGBGFX bugs #1671

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

Merged
merged 3 commits into from
Apr 24, 2025
Merged

Fix two RGBGFX bugs #1671

merged 3 commits into from
Apr 24, 2025

Conversation

Rangi42
Copy link
Contributor

@Rangi42 Rangi42 commented Apr 23, 2025

Fixes #1651 : This is fixed by updating process.cpp. The check for whether a color spec is opaque was prematurely ending the for loop, a bug which does not exist in the Rust port.

Fixes #1656 : This is fixed by updating rgba.cpp. The Rgba::grayIndex method returns a grayscale index for a color where red=green=blue, and was always in the half-open range [0, nbColorsPerPal). However, this was a mistake, since images with transparency would be using index 0 for the transparent color, and would have one fewer grayscale index available. The indexes are now in [1, nbColorsPerPal) when transparent pixels exist. (Note that maxOpaqueColors() is just nbColorsPerPal - options.hasTransparentPixels, so this logic now matches that.)

Test cases now verify that neither of these bugs occurs any more.

@Rangi42 Rangi42 added bug Unexpected behavior / crashes; to be fixed ASAP! rgbgfx This affects RGBGFX labels Apr 23, 2025
@Rangi42 Rangi42 added this to the 0.9.2 milestone Apr 23, 2025
@Rangi42 Rangi42 requested a review from ISSOtm April 23, 2025 14:28
ISSOtm
ISSOtm previously requested changes Apr 24, 2025
Copy link
Member

@ISSOtm ISSOtm left a comment

Choose a reason for hiding this comment

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

LGTM! Just would like a certain non-obvious interaction to be pointed out.

Co-authored-by: Eldred Habert <[email protected]>
Copy link
Member

@ISSOtm ISSOtm left a comment

Choose a reason for hiding this comment

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

Thank you!

@ISSOtm ISSOtm merged commit 2a5b9b5 into gbdev:master Apr 24, 2025
23 checks passed
@Rangi42 Rangi42 deleted the fix-rgbgfx-bugs branch April 24, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / crashes; to be fixed ASAP! rgbgfx This affects RGBGFX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RGBGFX bug RGBGFX segfault
2 participants