From 8a44b6837df815fb03425f6e5f2c49fd8f5134cd Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Fri, 17 Jan 2025 02:03:22 +0100 Subject: Graphics fixes --- graphics.c | 8 ++++---- reduced_system_layer.c | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/graphics.c b/graphics.c index 3b3f539..ea7edee 100644 --- a/graphics.c +++ b/graphics.c @@ -1211,7 +1211,7 @@ void fill_triangle(Brush brush, f64 x0, f64 y0, f64 x1, f64 y1, f64 x2, f64 y2) f64 height = max3_(y0, y1, y2) - y; Brush clear = aa; - clear.color = (vec4_f32) {0}; + clear.color = vec4_from_vec3_f32(vec3_from_vec4_f32(brush.color), 0.f); fill_rectangle_(clear, 0, 0, width, height); fill_triangle_(aa, x0 - x, y0 - y, x1 - x, y1 - y, x2 - x, y2 - y); @@ -1245,7 +1245,7 @@ void fill_quad(Brush brush, f64 x0, f64 y0, f64 x1, f64 y1, f64 x2, f64 y2, f64 f64 height = max4_(y0, y1, y2, y3) - y; Brush clear = aa; - clear.color = (vec4_f32) {0}; + clear.color = vec4_from_vec3_f32(vec3_from_vec4_f32(brush.color), 0.f); fill_rectangle_(clear, 0, 0, width, height); fill_quad_(aa, x0 - x, y0 - y, x1 - x, y1 - y, x2 - x, y2 - y, x3 - x, y3 - y); @@ -1280,7 +1280,7 @@ void fill_ellipse(Brush brush, f64 x, f64 y, f64 width, f64 height) { Brush aa = antialiasing_brush_(brush); Brush clear = aa; - clear.color = (vec4_f32) {0}; + clear.color = vec4_from_vec3_f32(vec3_from_vec4_f32(brush.color), 0.f); fill_rectangle_(clear, 0, 0, width, height); fill_ellipse_(aa, 0, 0, width, height); @@ -1348,7 +1348,7 @@ void draw_text_area(Brush brush, f64 x, f64 y, f64 width, f64 height, f64 max_sc Brush aa = antialiasing_brush_(brush); Brush clear = aa; - clear.color = (vec4_f32) {0}; + clear.color = vec4_from_vec3_f32(vec3_from_vec4_f32(brush.color), 0.f); fill_rectangle_(clear, 0, 0, width, height); draw_text_(aa, 0, 0, kx, ky, num_chars, text); diff --git a/reduced_system_layer.c b/reduced_system_layer.c index 219d360..b7f5954 100644 --- a/reduced_system_layer.c +++ b/reduced_system_layer.c @@ -212,7 +212,7 @@ i32 main(i32 argc, c8 **argv); #endif #ifndef MIN_FRAME_DURATION -#define MIN_FRAME_DURATION 8 +#define MIN_FRAME_DURATION 17 #endif #ifndef MAX_FRAME_DURATION @@ -224,7 +224,11 @@ i32 main(i32 argc, c8 **argv); #endif #ifndef AVERAGE_FRAME_BIAS +#if defined(__wasm__) #define AVERAGE_FRAME_BIAS (0.00) +#else +#define AVERAGE_FRAME_BIAS (0.02) +#endif #endif #ifndef NUM_SOUND_CHANNELS -- cgit v1.2.3