summaryrefslogtreecommitdiff
path: root/runtime.c
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2025-04-25 09:06:27 +0200
committerMitya Selivanov <automainint@guattari.tech>2025-04-25 09:06:27 +0200
commit3f37db0647cb31955c8ad271f747c8e1ee5d2124 (patch)
treeafcf171fc145f9cfe0f13c3e8f22348015c522da /runtime.c
parent27291f388b02c6ba88efb79b9728b65f158589ef (diff)
downloadreduced_system_layer-3f37db0647cb31955c8ad271f747c8e1ee5d2124.zip
Global gamma is disabled by default
Diffstat (limited to 'runtime.c')
-rw-r--r--runtime.c48
1 files changed, 46 insertions, 2 deletions
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);