Looks fine.

On 15.07.2020 02:01, Prasanta Sadhukhan wrote:
Hi All,

Please review a fix for a nimbus issue where it is seen that "hue" color in 
Nimbus.DerivedColor.rederiveColor is being incorrectly clamped.

rederiveColor() calls Color.HSBtoRGB() to get the RGB color from 
Hue/Saturation/Brightness color and as per HSBtoRGB spec

https://docs.oracle.com/en/java/javase/14/docs/api/java.desktop/java/awt/Color.html#HSBtoRGB(float,float,float)

it is mentioned "The |hue| component can be any floating-point number. The floor of 
this number is subtracted from it to create a fraction between 0 and 1"

whereas "The |saturation| and |brightness| components should be floating-point 
values between zero and one (numbers in the range 0.0-1.0)".

So, although it is alright to clamp saturation and brightness value within 0.0-1.0 before 
calling Color.HSBtoRGB(), it is not supposed to be done for "hue" color as it 
is getting clamped inside HSBtoRGB() method.

Proposed fix is to do away with this incorrect clamp.

Bug: https://bugs.openjdk.java.net/browse/JDK-8042055

webrev: http://cr.openjdk.java.net/~psadhukhan/8042055/webrev.0/

Regards
Prasanta


--
Best regards, Sergey.

Reply via email to