add optimization notes

This commit is contained in:
Emil Lerch 2023-04-03 10:40:53 -07:00
parent 7b30811ead
commit 175899a539
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 10 additions and 0 deletions

View File

@ -46,6 +46,10 @@ pub fn build(b: *std.build.Builder) !void {
exe.addIncludePath("lib/i2cdriver");
exe.install();
// TODO: I believe we can use runArtifact on a second
// exe with a different source file for font generation
// taking us to a series of 5 byte arrays for each
// character in a font.
exe.step.dependOn(&AsciiPrintableStep.create(b, .{ .path = "src/images" }).step);
// exe.step.dependOn((try fontGeneration(b, target)));
const run_cmd = exe.run();

View File

@ -277,6 +277,12 @@ fn convertImage(alloc: std.mem.Allocator, filename: [:0]u8, pixels: *[WIDTH * HE
if (filename.len > 0) {
status = c.MagickReadImage(mw, filename);
} else {
// TODO: if there is no background image AND
// we precompute monochrome bit patterns for our font
// we can completely avoid ImageMagick here. Even with
// a background we can do the conversion, then do our
// own text overlay after monochrome conversion.
// Faster and smaller binary (maybe multi-font support?)
const blob = @embedFile("images/blank.bmp");
status = c.MagickReadImageBlob(mw, blob, blob.len);
}