-
-
Notifications
You must be signed in to change notification settings - Fork 429
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
[ColorUtil] optimise constants; hue overflow check #3629
Conversation
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
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.
Otherwise LGTM
bundles/org.openhab.core/src/main/java/org/openhab/core/util/ColorUtil.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
} | ||
if (hue.compareTo(BigDecimal.ZERO) < 0) { | ||
hue = hue.add(BigDecimal.valueOf(360)); | ||
hue = hue.add(BIG_DECIMAL_360); | ||
} else if (hue.compareTo(BIG_DECIMAL_360) > 0) { |
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.
@J-N-K just re-reading this line, I think it should be >= rather than > to cover the exact edge case where hue is 360. Or??
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.
No, I think it's fine. If that is the case 360-360=0 which is the same color.
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 thoughts
* [ColorUtil] define constants; fix hue overflow Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch> GitOrigin-RevId: 4d3535a
Two improvements to ColorUtils..
Signed-off-by: Andrew Fiddian-Green software@whitebear.ch