summaryrefslogtreecommitdiff
path: root/graphics.c
diff options
context:
space:
mode:
Diffstat (limited to 'graphics.c')
-rwxr-xr-xgraphics.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/graphics.c b/graphics.c
index ced6963..bb800ad 100755
--- a/graphics.c
+++ b/graphics.c
@@ -253,6 +253,7 @@ void perform_graphics_request(Graphics_Context context, Graphics_Request req);
#ifndef GRAPHICS_IMPL_GUARD_
#define GRAPHICS_IMPL_GUARD_
+// FIXME: 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,
};
@@ -1985,7 +1986,10 @@ static void copy_pixels_quick_(Pixel_Buffer dst, i64 x, i64 y, Pixel_Buffer src)
static void perform_graphics_request_cached_(Pixel_Buffer dst, Graphics_Request req) {
Graphics_Request_Norm_ norm = normalize_graphics_request_(req);
- Graphics_Request_Id_ id = graphics_request_id_(norm.req);
+ if (norm.width <= 0 || norm.height <= 0)
+ return;
+
+ Graphics_Request_Id_ id = graphics_request_id_(norm.req);
b8 reset_slot = 1;
i64 slot = -1;
@@ -2012,7 +2016,7 @@ static void perform_graphics_request_cached_(Pixel_Buffer dst, Graphics_Request
}
if (slot == -1) {
- LOG_ERROR("Graphics cache overflow.");
+ // Cache overflow.
slot = n;
}
@@ -2033,13 +2037,15 @@ static void perform_graphics_request_cached_(Pixel_Buffer dst, Graphics_Request
if (s->buffer_len < num_pixels)
// Out of memory
s->occupied = 0;
- else
+ else {
+ mem_set_(s->buffer, 0, s->buffer_len * sizeof *s->buffer);
perform_graphics_request_to_buffer_((Pixel_Buffer) {
.width = s->width,
.height = s->height,
.stride = s->width,
.pixels = s->buffer,
}, s->req);
+ }
}
if (s->occupied)