Fix errors in hsv calculation from recent optimization patch.
Code was different from original here, result was apparent in color picker wedge position.
This commit is contained in:
parent
256706ce7e
commit
25fab54e09
Notes:
blender-bot
2023-02-14 10:18:57 +01:00
Referenced by issue #41160, Rendering duplifaces crashed blender (cycles) Referenced by issue #41140, texture paint artefact Referenced by issue #41141, Can't paint texture in cycles Referenced by issue #41135, Extra frame
|
@ -212,17 +212,20 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
|
|||
{
|
||||
float k = 0.0f;
|
||||
float chroma;
|
||||
float min_gb;
|
||||
|
||||
if (g < b) {
|
||||
SWAP(float, g, b);
|
||||
k = -1.0f;
|
||||
}
|
||||
min_gb = b;
|
||||
if (r < g) {
|
||||
SWAP(float, r, g);
|
||||
k = -2.0f * 6e-1f - k;
|
||||
k = -2.0f / 6.0f - k;
|
||||
min_gb = min_ff(g, b);
|
||||
}
|
||||
|
||||
chroma = r - min_ff(g, b);
|
||||
chroma = r - min_gb;
|
||||
|
||||
*lh = fabsf(k + (g - b) / (6.0f * chroma + 1e-20f));
|
||||
*ls = chroma / (r + 1e-20f);
|
||||
|
|
Loading…
Reference in New Issue