Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions misc/ok_color.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
// Copyright(c) 2021 Bj�rn Ottosson
// Copyright(c) 2021 Björn Ottosson
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this softwareand associated documentation files(the "Software"), to deal in
Expand Down Expand Up @@ -667,10 +667,7 @@ HSV srgb_to_okhsv(RGB rgb)
RGB rgb_scale = oklab_to_linear_srgb({ L_vt, a_ * C_vt, b_ * C_vt });
float scale_L = cbrtf(1.f / fmax(fmax(rgb_scale.r, rgb_scale.g), fmax(rgb_scale.b, 0.f)));

L = L / scale_L;
C = C / scale_L;

C = C * toe(L) / L;
L = L / scale_L;
L = toe(L);

// we can now compute v and s:
Expand All @@ -681,4 +678,4 @@ HSV srgb_to_okhsv(RGB rgb)
return { h, s, v };
}

} // namespace ok_color
} // namespace ok_color