mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
coretext: validate atlas depth matches color depth
This commit is contained in:
@ -5,6 +5,8 @@ const macos = @import("macos");
|
|||||||
const harfbuzz = @import("harfbuzz");
|
const harfbuzz = @import("harfbuzz");
|
||||||
const font = @import("../main.zig");
|
const font = @import("../main.zig");
|
||||||
|
|
||||||
|
const log = std.log.scoped(.font_face);
|
||||||
|
|
||||||
pub const Face = struct {
|
pub const Face = struct {
|
||||||
/// Our font face
|
/// Our font face
|
||||||
font: *macos.text.Font,
|
font: *macos.text.Font,
|
||||||
@ -172,6 +174,15 @@ pub const Face = struct {
|
|||||||
};
|
};
|
||||||
defer color.space.release();
|
defer color.space.release();
|
||||||
|
|
||||||
|
// This is just a safety check.
|
||||||
|
if (atlas.format.depth() != color.depth) {
|
||||||
|
log.warn("font atlas color depth doesn't equal font color depth atlas={} font={}", .{
|
||||||
|
atlas.format.depth(),
|
||||||
|
color.depth,
|
||||||
|
});
|
||||||
|
return error.InvalidAtlasFormat;
|
||||||
|
}
|
||||||
|
|
||||||
// Our buffer for rendering
|
// Our buffer for rendering
|
||||||
// TODO(perf): cache this buffer
|
// TODO(perf): cache this buffer
|
||||||
var buf = try alloc.alloc(u8, width * height * color.depth);
|
var buf = try alloc.alloc(u8, width * height * color.depth);
|
||||||
|
Reference in New Issue
Block a user