From 3f37db0647cb31955c8ad271f747c8e1ee5d2124 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 25 Apr 2025 09:06:27 +0200 Subject: Global gamma is disabled by default --- runtime.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) (limited to 'runtime.c') diff --git a/runtime.c b/runtime.c index 3f20820..01877af 100644 --- a/runtime.c +++ b/runtime.c @@ -612,7 +612,7 @@ typedef struct { i32 antialiasing_scale; b8 exact_resolution : 1; - b8 disable_gamma : 1; + b8 enable_gamma : 1; b8 graceful_shutdown : 1; b8 enable_clipboard_text : 1; b8 enable_clipboard_image : 1; @@ -781,6 +781,50 @@ static i64 max2_i64_(i64 x, i64 y) { return x > y ? x : y; } +static i64 min2_i64_(i64 x, i64 y) { + return x < y ? x : y; +} + +static f32 max2_f32_(f32 a, f32 b) { + return a < b ? b : a; +} + +static f64 min3_(f64 a, f64 b, f64 c) { + if (a < b && a < c) + return a; + if (b < c) + return b; + return c; +} + +static f64 max3_(f64 a, f64 b, f64 c) { + if (a > b && a > c) + return a; + if (b > c) + return b; + return c; +} + +static f64 min4_(f64 a, f64 b, f64 c, f64 d) { + if (a < b && a < c && a < d) + return a; + if (b < c && b < d) + return b; + if (c < d) + return c; + return d; +} + +static f64 max4_(f64 a, f64 b, f64 c, f64 d) { + if (a > b && a > c && a > d) + return a; + if (b > c && b > d) + return b; + if (c > d) + return c; + return d; +} + // ================================================================ // // Log @@ -1830,7 +1874,7 @@ static void convert_pixels_for_window_(void) { vec3_f32 *im = _internal_row; vec3_f32 *im_end = _internal_row + dst_width; - if (!g_platform.disable_gamma) + if (g_platform.enable_gamma) for (; im < im_end; ++im) { im->x = gamma_(im->x * k); im->y = gamma_(im->y * k); -- cgit v1.2.3