diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-04-20 23:49:37 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-04-20 23:49:37 +0200 |
commit | 5dc100fde9e30f4424d77ced522df58ac03f82c6 (patch) | |
tree | 0c20a9c386f5f7ae42e447d9a9ef6cbf5ccf9653 | |
parent | bb296d4d79e0de7e93f3c0e729b8dc1dcf0c4bb6 (diff) | |
download | reduced_system_layer-5dc100fde9e30f4424d77ced522df58ac03f82c6.zip |
Small fixes
-rwxr-xr-x | graphics.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -258,7 +258,7 @@ void clean_graphics_requests_cache(i64 amount); #ifndef GRAPHICS_IMPL_GUARD_ #define GRAPHICS_IMPL_GUARD_ -// FIXME: Re-encode for faster rendering. +// FIXME, PERF: Re-encode for faster rendering. static u64 _bitfont[] = { 0xbc0000000000, 0xc00300000, 0x5fd5040093f24fc9, 0xa00a2c2a1a280105, 0xc000415e6f, 0x400000020be0000, 0x1c38a8400000007d, 0x40002043e1020215, 0x408102000000010, 0x9800000000020002, 0xf913e00000033, 0x53200000207c8800, 0x3654880000099, 0x54b800000f840e00, 0xe953c000001a, 0x953e000000674080, 0x1e54b800000f, 0x490000000000240, 0x88a08000000, 0x20a220050a142850, 0x6520800000, 0x912f801eab260be, 0x800034952bf0001f, 0xc850bf0000921427, 0xf00010a54afc0003, 0xd29427800002142b, 0x840007e1023f0000, 0x7d09100000217e, 0x3f000188a08fc000, 0xc30c0cfc00000810, 0x27803f101013f00f, 0xc244bf0000f214, 0x4bf0002f21427800, 0xc254a480006c24, 0x407c00102fc08100, 0xf208080f0000fa0, 0x531007d81c607c0, 0xc208288c031141, 0x83fc00046954b10, 0x180e03000000, 0x41040000000ff04, 0x8102040810000404, 0x2a54600000000101, 0x309123e0000e, 0xc912180000a22447, 0x8000062a54700007, 0xe52a4300000029f0, 0xa0000602043e0001, 0x1d48000002074, 0x1f000003610f8000, 0x13e04f800000010, 0x470000780813e00f, 0x184893e0000e224, 0x23e0001f12243000, 0x82a54100000008, 0x40780000009f0200, 0xe208080e0001f20, 0xa22007981860780, 0x82082888022282, 0x16c200004ca95320, 0x7f000004, 0x408200000086d04, 0x8204, }; @@ -462,12 +462,17 @@ void fill_triangles_to_buffer(Pixel_Buffer dst, vec4_f32 color, vec2 position, v f64 x0, y0, x1, y1; triangles_area_(&x0, &y0, &x1, &y1, position, scale, num_triangles, vertices); - i64 i0 = (i64) x0; - i64 j0 = (i64) y0; - i64 i1 = (i64) x1; - i64 j1 = (i64) y1; + i64 i0 = (i64) floor(x0); + i64 j0 = (i64) floor(y0); + i64 i1 = (i64) ceil (x1); + i64 j1 = (i64) ceil (y1); + + if (i0 < 0) i0 = 0; + if (i1 >= dst.width) i1 = dst.width - 1; + if (j0 < 0) j0 = 0; + if (j1 >= dst.height) j1 = dst.height - 1; - // FIXME, PERF + // FIXME, PERF: Use stencil buffer. for (i64 j = j0; j <= j1; ++j) for (i64 i = i0; i <= i1; ++i) @@ -610,7 +615,7 @@ void fill_line_to_buffer(Pixel_Buffer dst, vec4_f32 color, vec2 vertices[2], f64 if (!quad_from_line_(quad, vertices, width)) return; fill_quad_to_buffer(dst, color, quad); - // TODO: Also render line ends as circles. + // TODO: Also render line ends as circles, use stencil buffer. PROFILER_end(PROFILE_FILL_LINE); } |