Fix regression in master that broke text_fg_override_threshold
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run

This commit is contained in:
Kovid Goyal 2026-09-06 06:51:31 +05:30
parent cb1b153526
commit f90c26f1d0
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 34 additions and 22 deletions

View file

@ -313,6 +313,7 @@ opt(
'text_fg_override_threshold',
'0',
option_type='text_fg_override_threshold',
ctype='text_fg_override_threshold',
long_text="""
A setting to prevent low contrast between foreground and background colors.
Useful when working with applications that use colors that do not contrast

View file

@ -121,6 +121,19 @@ convert_from_opts_text_composition_strategy(PyObject *py_opts, Options *opts) {
Py_DECREF(ret);
}
static void
convert_from_python_text_fg_override_threshold(PyObject *val, Options *opts) {
opts->text_fg_override_threshold = text_fg_override_threshold(val);
}
static void
convert_from_opts_text_fg_override_threshold(PyObject *py_opts, Options *opts) {
PyObject *ret = PyObject_GetAttrString(py_opts, "text_fg_override_threshold");
if (ret == NULL) return;
convert_from_python_text_fg_override_threshold(ret, opts);
Py_DECREF(ret);
}
static void
convert_from_python_cursor_shape(PyObject *val, Options *opts) {
opts->cursor_shape = PyLong_AsLong(val);
@ -1571,6 +1584,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
if (PyErr_Occurred()) return false;
convert_from_opts_text_composition_strategy(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_text_fg_override_threshold(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_cursor_shape(py_opts, opts);
if (PyErr_Occurred()) return false;
convert_from_opts_cursor_shape_unfocused(py_opts, opts);

View file

@ -34,16 +34,15 @@ hsluv_lengthOfRayUntilIntersect(float theta, float3 x, float3 y) {
float
hsluv_maxSafeChromaForL(float L) {
// Transposed from GLSL column-major constructor to Slang row-major layout
float3x3 m2 = float3x3(
3.2409699419045214,
-1.5373831775700935,
-0.49861076029300328,
-0.96924363628087983,
1.8759675015077207,
0.041555057407175613,
0.055630079696993609,
-1.5373831775700935,
1.8759675015077207,
-0.20397695888897657,
-0.49861076029300328,
0.041555057407175613,
1.0569715142428786);
float sub0 = L + 16.0;
@ -73,16 +72,15 @@ float
hsluv_maxChromaForLH(float L, float H) {
float hrad = radians(H);
// Transposed from GLSL column-major constructor to Slang row-major layout
float3x3 m2 = float3x3(
3.2409699419045214,
-1.5373831775700935,
-0.49861076029300328,
-0.96924363628087983,
1.8759675015077207,
0.041555057407175613,
0.055630079696993609,
-1.5373831775700935,
1.8759675015077207,
-0.20397695888897657,
-0.49861076029300328,
0.041555057407175613,
1.0569715142428786);
float sub1 = pow(L + 16.0, 3.0) / 1560896.0;
@ -126,35 +124,33 @@ hsluv_lToY(float L) {
float3
xyzToRgb(float3 tuple) {
// Transposed layout from GLSL column-major matrix construction
// GLSL `mat3(args)` and Slang `float3x3(args)` agree: `v * m` in GLSL is
// `mul(m, v)` in Slang with the arguments in the same order.
const float3x3 m = float3x3(
3.2409699419045214,
-0.96924363628087983,
0.055630079696993609,
-1.5373831775700935,
1.8759675015077207,
-0.20397695888897657,
-0.49861076029300328,
-0.96924363628087983,
1.8759675015077207,
0.041555057407175613,
0.055630079696993609,
-0.20397695888897657,
1.0569715142428786);
// GLSL `tuple * m` is transformed to Slang/HLSL `mul(m, tuple)`
return hsluv_fromLinear(mul(m, tuple));
}
float3
rgbToXyz(float3 tuple) {
// Transposed layout from GLSL column-major matrix construction
const float3x3 m = float3x3(
0.41239079926595948,
0.21263900587151036,
0.019330818715591851,
0.35758433938387796,
0.71516867876775593,
0.11919477979462599,
0.18048078840183429,
0.21263900587151036,
0.71516867876775593,
0.072192315360733715,
0.019330818715591851,
0.11919477979462599,
0.95053215224966058);
// GLSL `tuple * m` is transformed to Slang/HLSL `mul(m, tuple)`
return mul(m, hsluv_toLinear(tuple));
}