mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Fix Color precision error in the documentation generated on M3/M4 macOS.
This commit is contained in:
parent
6e33e3b7af
commit
52fec34cab
2 changed files with 21 additions and 0 deletions
5
thirdparty/misc/ok_color.h
vendored
5
thirdparty/misc/ok_color.h
vendored
|
|
@ -541,6 +541,11 @@ static RGB okhsl_to_srgb(HSL hsl)
|
||||||
|
|
||||||
static HSL srgb_to_okhsl(RGB rgb)
|
static HSL srgb_to_okhsl(RGB rgb)
|
||||||
{
|
{
|
||||||
|
// Fixes some precision errors.
|
||||||
|
if (rgb.r == 0.0f && rgb.g == 0.0f && rgb.b == 0.0f) {
|
||||||
|
return { 0.0f, 0.0f, 0.0f };
|
||||||
|
}
|
||||||
|
|
||||||
Lab lab = linear_srgb_to_oklab({
|
Lab lab = linear_srgb_to_oklab({
|
||||||
srgb_transfer_function_inv(rgb.r),
|
srgb_transfer_function_inv(rgb.r),
|
||||||
srgb_transfer_function_inv(rgb.g),
|
srgb_transfer_function_inv(rgb.g),
|
||||||
|
|
|
||||||
16
thirdparty/misc/patches/ok_color-0001-srgb_to_okhsl_precision.patch
vendored
Normal file
16
thirdparty/misc/patches/ok_color-0001-srgb_to_okhsl_precision.patch
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
diff --git a/thirdparty/misc/ok_color.h b/thirdparty/misc/ok_color.h
|
||||||
|
index 4d0f0049bd..2cc7f1ceef 100644
|
||||||
|
--- a/thirdparty/misc/ok_color.h
|
||||||
|
+++ b/thirdparty/misc/ok_color.h
|
||||||
|
@@ -541,6 +541,11 @@ static RGB okhsl_to_srgb(HSL hsl)
|
||||||
|
|
||||||
|
static HSL srgb_to_okhsl(RGB rgb)
|
||||||
|
{
|
||||||
|
+ // Fixes some precision errors.
|
||||||
|
+ if (rgb.r == 0.0f && rgb.g == 0.0f && rgb.b == 0.0f) {
|
||||||
|
+ return { 0.0f, 0.0f, 0.0f };
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
Lab lab = linear_srgb_to_oklab({
|
||||||
|
srgb_transfer_function_inv(rgb.r),
|
||||||
|
srgb_transfer_function_inv(rgb.g),
|
||||||
Loading…
Add table
Add a link
Reference in a new issue