Skip to content

Commit

Permalink
remove: redundant cache flag
Browse files Browse the repository at this point in the history
  • Loading branch information
freref committed Feb 23, 2025
1 parent e43693b commit 5c606ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Cache.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Config = @import("config/Config.zig");
const vaxis = @import("vaxis");

pub const Key = struct { colorize: bool, page: u16 };
pub const CachedImage = struct { image: vaxis.Image, cached: bool };
pub const CachedImage = struct { image: vaxis.Image };

const Node = struct {
key: Key,
Expand Down
9 changes: 2 additions & 7 deletions src/Context.zig
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub const Context = struct {
}
}

var image = try self.pdf_handler.renderPage(
const image = try self.pdf_handler.renderPage(
self.pdf_handler.current_page_number,
window_width,
window_height,
Expand All @@ -239,15 +239,10 @@ pub const Context = struct {
if (!self.config.cache.enabled) return;

if (self.current_page) |img| {
image.cached = true;

_ = try self.cache.put(.{
.colorize = self.config.general.colorize,
.page = self.pdf_handler.current_page_number,
}, .{
.image = img,
.cached = true,
});
}, .{ .image = img });
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/PdfHandler.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const c = @cImport({
@cInclude("mupdf/pdf.h");
});

pub const EncodedImage = struct { base64: []const u8, width: u16, height: u16, cached: bool };
pub const EncodedImage = struct { base64: []const u8, width: u16, height: u16 };
pub const PdfError = error{ FailedToCreateContext, FailedToOpenDocument, InvalidPageNumber };
pub const ScrollDirection = enum { Up, Down, Left, Right };

Expand Down Expand Up @@ -172,7 +172,6 @@ pub fn renderPage(
.base64 = encoded,
.width = @intCast(width),
.height = @intCast(height),
.cached = false,
};
}

Expand Down

0 comments on commit 5c606ac

Please sign in to comment.