Changeset - 4b8c1db26558
[Not reviewed]
default
0 1 0
Jason Maltzen - 11 months ago 2021-09-09 23:57:46
jason@hiddenachievement.com
Check explicitly for a white shift before trying to apply the white shift clipping logic.
1 file changed with 19 insertions and 3 deletions:
0 comments (0 inline, 0 general)
Models/ReactionTest.cs
Show inline comments
...
 
@@ -216,7 +216,23 @@ namespace DesertPaintCodex.Models
 
                        // SPECIAL CASE:
 
                        // Check to see if we've got a white-shift reaction that's partially clipped, where we can
 
                        // still extrapolate the reaction, based on the available information.
 
                        if (!testing3Way && (reaction != null))
 
                        bool isWhiteShift = (reaction != null) && Clipped switch
 
                        {
 
                            ClipType.RedLow => (reaction.Blue == reaction.Green) && (reaction.Blue != 0),
 
                            ClipType.RedHigh => (reaction.Blue == reaction.Green) && (reaction.Blue != 0),
 
                            ClipType.BlueLow => (reaction.Red == reaction.Green) && (reaction.Red != 0),
 
                            ClipType.BlueHigh => (reaction.Red == reaction.Green) && (reaction.Red != 0),
 
                            ClipType.GreenLow => (reaction.Red == reaction.Blue) && (reaction.Red != 0),
 
                            ClipType.GreenHigh => (reaction.Red == reaction.Blue) && (reaction.Red != 0),
 
                            ClipType.RedLow|ClipType.BlueLow => (reaction.Green < 0),
 
                            ClipType.RedLow|ClipType.GreenLow => (reaction.Blue < 0),
 
                            ClipType.BlueLow|ClipType.GreenLow => (reaction.Red < 0),
 
                            ClipType.RedHigh | ClipType.BlueHigh => (reaction.Green > 0),
 
                            ClipType.RedHigh | ClipType.GreenHigh => (reaction.Blue > 0),
 
                            ClipType.BlueHigh | ClipType.GreenHigh => (reaction.Red > 0),
 
                            _ => false
 
                        };
 
                        if (!testing3Way && (reaction != null) && isWhiteShift)
 
                        {
 
                            PaintColor baseColor = _recipe.BaseColor;
 
                            if ((reaction.Red < 0) &&
...
 
@@ -226,7 +242,7 @@ namespace DesertPaintCodex.Models
 
                                // White-shift down clip.
 
                                extrapolated                    = ExtrapolateWhiteFromOneChannel(_observedColor.Red,   0, reaction.Red);
 
                                if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Green, 0, reaction.Green);
 
                                if (!extrapolated)                ExtrapolateWhiteFromOneChannel(_observedColor.Blue,  0, reaction.Blue);
 
                                if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Blue,  0, reaction.Blue);
 
                            }
 
                            else if ((reaction.Red > 0) &&
 
                                (reaction.Green > 0) &&
...
 
@@ -235,7 +251,7 @@ namespace DesertPaintCodex.Models
 
                                // White-shift up clip.
 
                                extrapolated                    = ExtrapolateWhiteFromOneChannel(_observedColor.Red,   255, reaction.Red);
 
                                if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Green, 255, reaction.Green);
 
                                if (!extrapolated)                ExtrapolateWhiteFromOneChannel(_observedColor.Blue,  255, reaction.Blue);
 
                                if (!extrapolated) extrapolated = ExtrapolateWhiteFromOneChannel(_observedColor.Blue,  255, reaction.Blue);
 
                            }
 
                        }
 

	
0 comments (0 inline, 0 general)