Simplified bevy_color Srgba hex string parsing#12082
Merged
alice-i-cecile merged 4 commits intobevyengine:mainfrom Feb 25, 2024
Merged
Simplified bevy_color Srgba hex string parsing#12082alice-i-cecile merged 4 commits intobevyengine:mainfrom
bevy_color Srgba hex string parsing#12082alice-i-cecile merged 4 commits intobevyengine:mainfrom
Conversation
bushrat011899
approved these changes
Feb 24, 2024
Contributor
bushrat011899
left a comment
There was a problem hiding this comment.
Nice change, might as well tidy these kinds of functions while we're making a new crate!
rparrett
reviewed
Feb 24, 2024
Contributor
There was a problem hiding this comment.
Would be nice to add some test cases for RGBA and RRGGBBAA variants where the colors have different values.
assert_eq!(Srgba::hex("11223344"), Ok(Srgba::rgba_u8(17, 34, 51, 68)));
assert_eq!(Srgba::hex("1234"), Ok(Srgba::rgba_u8(17, 34, 51, 68)));Co-authored-by: Rob Parrett <robparrett@gmail.com>
Contributor
Author
Added more tests to make sure RGBA is right. |
rparrett
approved these changes
Feb 25, 2024
alice-i-cecile
approved these changes
Feb 25, 2024
msvbg
pushed a commit
to msvbg/bevy
that referenced
this pull request
Feb 26, 2024
# Objective - Simplify `Srgba` hex string parsing using std hex parsing functions and removing loops in favor of bitwise ops. This is a follow-up of the `bevy_color` upstream PR review: bevyengine#12013 (comment) ## Solution - Reworked `Srgba::hex` to use `from_str_radix` and some bitwise ops; --------- Co-authored-by: Rob Parrett <robparrett@gmail.com>
msvbg
pushed a commit
to msvbg/bevy
that referenced
this pull request
Feb 26, 2024
# Objective - Simplify `Srgba` hex string parsing using std hex parsing functions and removing loops in favor of bitwise ops. This is a follow-up of the `bevy_color` upstream PR review: bevyengine#12013 (comment) ## Solution - Reworked `Srgba::hex` to use `from_str_radix` and some bitwise ops; --------- Co-authored-by: Rob Parrett <robparrett@gmail.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
Srgbahex string parsing using std hex parsing functions and removing loops in favor of bitwise ops.This is a follow-up of the
bevy_colorupstream PR review: #12013 (comment)Solution
Srgba::hexto usefrom_str_radixand some bitwise ops;