mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-05-05 15:33:00 +00:00
spelling: normalize grey -> gray
This commit is contained in:
parent
956b097786
commit
10b8ca3c69
@ -51,7 +51,7 @@ fetch(url.href)
|
||||
group_cache_free,
|
||||
group_cache_index_for_codepoint,
|
||||
group_cache_render_glyph,
|
||||
group_cache_atlas_greyscale,
|
||||
group_cache_atlas_grayscale,
|
||||
group_cache_atlas_color,
|
||||
atlas_new,
|
||||
atlas_free,
|
||||
@ -83,7 +83,7 @@ fetch(url.href)
|
||||
free(config_str.ptr);
|
||||
|
||||
// Create our atlas
|
||||
// const atlas = atlas_new(512, 0 /* greyscale */);
|
||||
// const atlas = atlas_new(512, 0 /* grayscale */);
|
||||
|
||||
// Create some memory for our string
|
||||
const font_name = makeStr("monospace");
|
||||
@ -174,7 +174,7 @@ fetch(url.href)
|
||||
|
||||
// Debug our atlas canvas
|
||||
{
|
||||
const atlas = group_cache_atlas_greyscale(group_cache);
|
||||
const atlas = group_cache_atlas_grayscale(group_cache);
|
||||
const id = atlas_debug_canvas(atlas);
|
||||
document.getElementById("atlas-canvas").append(zjs.deleteValue(id));
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<p>Open your console, we are just debugging here.</p>
|
||||
<p>The current <b>greyscale</b> font atlas is rendered below.</p>
|
||||
<p>The current <b>grayscale</b> font atlas is rendered below.</p>
|
||||
<div><div id="atlas-canvas" style="display: inline-block; border: 1px solid green;"></div></div>
|
||||
<p>The current <b>color</b> font atlas is rendered below.</p>
|
||||
<div><div id="atlas-color-canvas" style="display: inline-block; border: 1px solid blue;"></div></div>
|
||||
|
@ -36,7 +36,7 @@ nodes: std.ArrayListUnmanaged(Node) = .{},
|
||||
/// The format of the texture data being written into the Atlas. This must be
|
||||
/// uniform for all textures in the Atlas. If you have some textures with
|
||||
/// different formats, you must use multiple atlases or convert the textures.
|
||||
format: Format = .greyscale,
|
||||
format: Format = .grayscale,
|
||||
|
||||
/// This will be incremented every time the atlas is modified. This is useful
|
||||
/// for knowing if the texture data has changed since the last time it was
|
||||
@ -50,13 +50,13 @@ modified: std.atomic.Value(usize) = .{ .raw = 0 },
|
||||
resized: std.atomic.Value(usize) = .{ .raw = 0 },
|
||||
|
||||
pub const Format = enum(u8) {
|
||||
greyscale = 0,
|
||||
grayscale = 0,
|
||||
rgb = 1,
|
||||
rgba = 2,
|
||||
|
||||
pub fn depth(self: Format) u8 {
|
||||
return switch (self) {
|
||||
.greyscale => 1,
|
||||
.grayscale => 1,
|
||||
.rgb => 3,
|
||||
.rgba => 4,
|
||||
};
|
||||
@ -396,7 +396,7 @@ pub const Wasm = struct {
|
||||
// RGBA is the native ImageData format
|
||||
.rgba => self.data,
|
||||
|
||||
.greyscale => buf: {
|
||||
.grayscale => buf: {
|
||||
// Convert from A8 to RGBA so every 4th byte is set to a value.
|
||||
var buf: []u8 = try alloc.alloc(u8, self.data.len * 4);
|
||||
errdefer alloc.free(buf);
|
||||
@ -451,7 +451,7 @@ pub const Wasm = struct {
|
||||
}
|
||||
|
||||
test "happy path" {
|
||||
const atlas = atlas_new(512, @intFromEnum(Format.greyscale)).?;
|
||||
const atlas = atlas_new(512, @intFromEnum(Format.grayscale)).?;
|
||||
defer atlas_free(atlas);
|
||||
|
||||
const reg = atlas_reserve(atlas, 2, 2).?;
|
||||
@ -469,7 +469,7 @@ pub const Wasm = struct {
|
||||
|
||||
test "exact fit" {
|
||||
const alloc = testing.allocator;
|
||||
var atlas = try init(alloc, 34, .greyscale); // +2 for 1px border
|
||||
var atlas = try init(alloc, 34, .grayscale); // +2 for 1px border
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
const modified = atlas.modified.load(.monotonic);
|
||||
@ -480,7 +480,7 @@ test "exact fit" {
|
||||
|
||||
test "doesnt fit" {
|
||||
const alloc = testing.allocator;
|
||||
var atlas = try init(alloc, 32, .greyscale);
|
||||
var atlas = try init(alloc, 32, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
// doesn't fit due to border
|
||||
@ -489,7 +489,7 @@ test "doesnt fit" {
|
||||
|
||||
test "fit multiple" {
|
||||
const alloc = testing.allocator;
|
||||
var atlas = try init(alloc, 32, .greyscale);
|
||||
var atlas = try init(alloc, 32, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
_ = try atlas.reserve(alloc, 15, 30);
|
||||
@ -499,7 +499,7 @@ test "fit multiple" {
|
||||
|
||||
test "writing data" {
|
||||
const alloc = testing.allocator;
|
||||
var atlas = try init(alloc, 32, .greyscale);
|
||||
var atlas = try init(alloc, 32, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
const reg = try atlas.reserve(alloc, 2, 2);
|
||||
@ -517,7 +517,7 @@ test "writing data" {
|
||||
|
||||
test "grow" {
|
||||
const alloc = testing.allocator;
|
||||
var atlas = try init(alloc, 4, .greyscale); // +2 for 1px border
|
||||
var atlas = try init(alloc, 4, .grayscale); // +2 for 1px border
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
const reg = try atlas.reserve(alloc, 2, 2);
|
||||
|
@ -458,8 +458,8 @@ test "getIndex disabled font style" {
|
||||
const alloc = testing.allocator;
|
||||
const testFont = @import("test.zig").fontRegular;
|
||||
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
var lib = try Library.init();
|
||||
defer lib.deinit();
|
||||
|
@ -44,7 +44,7 @@ glyphs: std.AutoHashMapUnmanaged(GlyphKey, Render) = .{},
|
||||
|
||||
/// The texture atlas to store renders in. The Glyph data in the glyphs
|
||||
/// cache is dependent on the atlas matching.
|
||||
atlas_greyscale: Atlas,
|
||||
atlas_grayscale: Atlas,
|
||||
atlas_color: Atlas,
|
||||
|
||||
/// The underlying resolver for font data, fallbacks, etc. The shared
|
||||
@ -77,14 +77,14 @@ pub fn init(
|
||||
// We need to support loading options since we use the size data
|
||||
assert(resolver.collection.load_options != null);
|
||||
|
||||
var atlas_greyscale = try Atlas.init(alloc, 512, .greyscale);
|
||||
errdefer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try Atlas.init(alloc, 512, .grayscale);
|
||||
errdefer atlas_grayscale.deinit(alloc);
|
||||
var atlas_color = try Atlas.init(alloc, 512, .rgba);
|
||||
errdefer atlas_color.deinit(alloc);
|
||||
|
||||
var result: SharedGrid = .{
|
||||
.resolver = resolver,
|
||||
.atlas_greyscale = atlas_greyscale,
|
||||
.atlas_grayscale = atlas_grayscale,
|
||||
.atlas_color = atlas_color,
|
||||
.lock = .{},
|
||||
.metrics = undefined, // Loaded below
|
||||
@ -105,7 +105,7 @@ pub fn init(
|
||||
pub fn deinit(self: *SharedGrid, alloc: Allocator) void {
|
||||
self.codepoints.deinit(alloc);
|
||||
self.glyphs.deinit(alloc);
|
||||
self.atlas_greyscale.deinit(alloc);
|
||||
self.atlas_grayscale.deinit(alloc);
|
||||
self.atlas_color.deinit(alloc);
|
||||
self.resolver.deinit(alloc);
|
||||
}
|
||||
@ -272,7 +272,7 @@ pub fn renderGlyph(
|
||||
// Get the presentation to determine what atlas to use
|
||||
const p = try self.resolver.getPresentation(index, glyph_index);
|
||||
const atlas: *font.Atlas = switch (p) {
|
||||
.text => &self.atlas_greyscale,
|
||||
.text => &self.atlas_grayscale,
|
||||
.emoji => &self.atlas_color,
|
||||
};
|
||||
|
||||
|
@ -671,7 +671,7 @@ test {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
const name = try macos.foundation.String.createWithBytes("Monaco", .utf8, false);
|
||||
@ -735,7 +735,7 @@ test "in-memory" {
|
||||
const alloc = testing.allocator;
|
||||
const testFont = @import("../test.zig").fontRegular;
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
var lib = try font.Library.init();
|
||||
@ -757,7 +757,7 @@ test "variable" {
|
||||
const alloc = testing.allocator;
|
||||
const testFont = @import("../test.zig").fontVariable;
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
var lib = try font.Library.init();
|
||||
@ -779,7 +779,7 @@ test "variable set variation" {
|
||||
const alloc = testing.allocator;
|
||||
const testFont = @import("../test.zig").fontVariable;
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
var lib = try font.Library.init();
|
||||
|
@ -281,7 +281,7 @@ pub const Face = struct {
|
||||
// conversion.
|
||||
const format: ?font.Atlas.Format = switch (bitmap_ft.pixel_mode) {
|
||||
freetype.c.FT_PIXEL_MODE_MONO => null,
|
||||
freetype.c.FT_PIXEL_MODE_GRAY => .greyscale,
|
||||
freetype.c.FT_PIXEL_MODE_GRAY => .grayscale,
|
||||
freetype.c.FT_PIXEL_MODE_BGRA => .rgba,
|
||||
else => {
|
||||
log.warn("glyph={} pixel mode={}", .{ glyph_index, bitmap_ft.pixel_mode });
|
||||
@ -657,7 +657,7 @@ test {
|
||||
var lib = try Library.init();
|
||||
defer lib.deinit();
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
var ft_font = try Face.init(
|
||||
@ -734,7 +734,7 @@ test "metrics" {
|
||||
var lib = try Library.init();
|
||||
defer lib.deinit();
|
||||
|
||||
var atlas = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
var atlas = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas.deinit(alloc);
|
||||
|
||||
var ft_font = try Face.init(
|
||||
|
@ -34,12 +34,12 @@ fn genMap() Map {
|
||||
}
|
||||
|
||||
// Map our converters
|
||||
result[freetype.c.FT_PIXEL_MODE_MONO].set(.greyscale, monoToGreyscale);
|
||||
result[freetype.c.FT_PIXEL_MODE_MONO].set(.grayscale, monoToGrayscale);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn monoToGreyscale(alloc: Allocator, bm: Bitmap) Allocator.Error!Bitmap {
|
||||
pub fn monoToGrayscale(alloc: Allocator, bm: Bitmap) Allocator.Error!Bitmap {
|
||||
var buf = try alloc.alloc(u8, bm.width * bm.rows);
|
||||
errdefer alloc.free(buf);
|
||||
|
||||
@ -77,7 +77,7 @@ test {
|
||||
_ = map;
|
||||
}
|
||||
|
||||
test "mono to greyscale" {
|
||||
test "mono to grayscale" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
@ -93,7 +93,7 @@ test "mono to greyscale" {
|
||||
.palette = null,
|
||||
};
|
||||
|
||||
const result = try monoToGreyscale(alloc, source);
|
||||
const result = try monoToGrayscale(alloc, source);
|
||||
defer alloc.free(result.buffer[0..(result.width * result.rows)]);
|
||||
try testing.expect(result.pixel_mode == freetype.c.FT_PIXEL_MODE_GRAY);
|
||||
try testing.expectEqual(@as(u8, 255), result.buffer[0]);
|
||||
|
@ -203,7 +203,7 @@ pub const Face = struct {
|
||||
.rgba => render.bitmap,
|
||||
|
||||
// Convert down to A8
|
||||
.greyscale => a8: {
|
||||
.grayscale => a8: {
|
||||
assert(@mod(render.bitmap.len, 4) == 0);
|
||||
var bitmap_a8 = try alloc.alloc(u8, render.bitmap.len / 4);
|
||||
errdefer alloc.free(bitmap_a8);
|
||||
|
@ -2726,13 +2726,13 @@ test "all" {
|
||||
var cp: u32 = 0x2500;
|
||||
const end = 0x2570;
|
||||
while (cp <= end) : (cp += 1) {
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
const face: Box = .{ .width = 18, .height = 36, .thickness = 2 };
|
||||
const glyph = try face.renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
cp,
|
||||
);
|
||||
try testing.expectEqual(@as(u32, face.width), glyph.width);
|
||||
|
@ -527,13 +527,13 @@ test "all" {
|
||||
0xE0D4,
|
||||
};
|
||||
for (cps) |cp| {
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
const face: Powerline = .{ .width = 18, .height = 36, .thickness = 2 };
|
||||
const glyph = try face.renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
cp,
|
||||
);
|
||||
try testing.expectEqual(@as(u32, face.width), glyph.width);
|
||||
|
@ -220,7 +220,7 @@ const WebCanvasImpl = struct {
|
||||
}
|
||||
|
||||
pub fn writeAtlas(self: *WebCanvasImpl, alloc: Allocator, atlas: *font.Atlas) !font.Atlas.Region {
|
||||
assert(atlas.format == .greyscale);
|
||||
assert(atlas.format == .grayscale);
|
||||
|
||||
// Reload our context since we resized the canvas
|
||||
const ctx = try self.context(null);
|
||||
@ -342,7 +342,7 @@ const PixmanImpl = struct {
|
||||
|
||||
/// Write the data in this drawing to the atlas.
|
||||
pub fn writeAtlas(self: *Canvas, alloc: Allocator, atlas: *font.Atlas) !font.Atlas.Region {
|
||||
assert(atlas.format == .greyscale);
|
||||
assert(atlas.format == .grayscale);
|
||||
|
||||
const width = @as(u32, @intCast(self.image.getWidth()));
|
||||
const height = @as(u32, @intCast(self.image.getHeight()));
|
||||
|
@ -215,12 +215,12 @@ test "single" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
_ = try renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
.underline,
|
||||
36,
|
||||
18,
|
||||
@ -233,12 +233,12 @@ test "strikethrough" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
_ = try renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
.strikethrough,
|
||||
36,
|
||||
18,
|
||||
@ -251,14 +251,14 @@ test "single large thickness" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
// unrealistic thickness but used to cause a crash
|
||||
// https://github.com/mitchellh/ghostty/pull/1548
|
||||
_ = try renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
.underline,
|
||||
36,
|
||||
18,
|
||||
@ -271,12 +271,12 @@ test "curly" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
|
||||
var atlas_greyscale = try font.Atlas.init(alloc, 512, .greyscale);
|
||||
defer atlas_greyscale.deinit(alloc);
|
||||
var atlas_grayscale = try font.Atlas.init(alloc, 512, .grayscale);
|
||||
defer atlas_grayscale.deinit(alloc);
|
||||
|
||||
_ = try renderGlyph(
|
||||
alloc,
|
||||
&atlas_greyscale,
|
||||
&atlas_grayscale,
|
||||
.underline_curly,
|
||||
36,
|
||||
18,
|
||||
|
@ -238,8 +238,8 @@ pub const FrameState = struct {
|
||||
cells: CellTextBuffer,
|
||||
cells_bg: CellBgBuffer,
|
||||
|
||||
greyscale: objc.Object, // MTLTexture
|
||||
greyscale_modified: usize = 0,
|
||||
grayscale: objc.Object, // MTLTexture
|
||||
grayscale_modified: usize = 0,
|
||||
color: objc.Object, // MTLTexture
|
||||
color_modified: usize = 0,
|
||||
|
||||
@ -263,12 +263,12 @@ pub const FrameState = struct {
|
||||
errdefer cells_bg.deinit();
|
||||
|
||||
// Initialize our textures for our font atlas.
|
||||
const greyscale = try initAtlasTexture(device, &.{
|
||||
const grayscale = try initAtlasTexture(device, &.{
|
||||
.data = undefined,
|
||||
.size = 8,
|
||||
.format = .greyscale,
|
||||
.format = .grayscale,
|
||||
});
|
||||
errdefer deinitMTLResource(greyscale);
|
||||
errdefer deinitMTLResource(grayscale);
|
||||
const color = try initAtlasTexture(device, &.{
|
||||
.data = undefined,
|
||||
.size = 8,
|
||||
@ -280,7 +280,7 @@ pub const FrameState = struct {
|
||||
.uniforms = uniforms,
|
||||
.cells = cells,
|
||||
.cells_bg = cells_bg,
|
||||
.greyscale = greyscale,
|
||||
.grayscale = grayscale,
|
||||
.color = color,
|
||||
};
|
||||
}
|
||||
@ -289,7 +289,7 @@ pub const FrameState = struct {
|
||||
self.uniforms.deinit();
|
||||
self.cells.deinit();
|
||||
self.cells_bg.deinit();
|
||||
deinitMTLResource(self.greyscale);
|
||||
deinitMTLResource(self.grayscale);
|
||||
deinitMTLResource(self.color);
|
||||
}
|
||||
};
|
||||
@ -827,7 +827,7 @@ pub fn setFontGrid(self: *Metal, grid: *font.SharedGrid) void {
|
||||
// We can modify this without a lock because the GPU does not
|
||||
// touch this data.
|
||||
for (&self.gpu_state.frames) |*frame| {
|
||||
frame.greyscale_modified = 0;
|
||||
frame.grayscale_modified = 0;
|
||||
frame.color_modified = 0;
|
||||
}
|
||||
|
||||
@ -1045,10 +1045,10 @@ pub fn updateFrame(
|
||||
switch (kv.value_ptr.image) {
|
||||
.ready => {},
|
||||
|
||||
.pending_grey_alpha,
|
||||
.pending_gray_alpha,
|
||||
.pending_rgb,
|
||||
.pending_rgba,
|
||||
.replace_grey_alpha,
|
||||
.replace_gray_alpha,
|
||||
.replace_rgb,
|
||||
.replace_rgba,
|
||||
=> try kv.value_ptr.image.upload(self.alloc, self.gpu_state.device),
|
||||
@ -1114,12 +1114,12 @@ pub fn drawFrame(self: *Metal, surface: *apprt.Surface) !void {
|
||||
|
||||
// If our font atlas changed, sync the texture data
|
||||
texture: {
|
||||
const modified = self.font_grid.atlas_greyscale.modified.load(.monotonic);
|
||||
if (modified <= frame.greyscale_modified) break :texture;
|
||||
const modified = self.font_grid.atlas_grayscale.modified.load(.monotonic);
|
||||
if (modified <= frame.grayscale_modified) break :texture;
|
||||
self.font_grid.lock.lockShared();
|
||||
defer self.font_grid.lock.unlockShared();
|
||||
frame.greyscale_modified = self.font_grid.atlas_greyscale.modified.load(.monotonic);
|
||||
try syncAtlasTexture(self.gpu_state.device, &self.font_grid.atlas_greyscale, &frame.greyscale);
|
||||
frame.grayscale_modified = self.font_grid.atlas_grayscale.modified.load(.monotonic);
|
||||
try syncAtlasTexture(self.gpu_state.device, &self.font_grid.atlas_grayscale, &frame.grayscale);
|
||||
}
|
||||
texture: {
|
||||
const modified = self.font_grid.atlas_color.modified.load(.monotonic);
|
||||
@ -1571,7 +1571,7 @@ fn drawCellFgs(
|
||||
void,
|
||||
objc.sel("setFragmentTexture:atIndex:"),
|
||||
.{
|
||||
frame.greyscale.value,
|
||||
frame.grayscale.value,
|
||||
@as(c_ulong, 0),
|
||||
},
|
||||
);
|
||||
@ -1861,7 +1861,7 @@ fn prepKittyImage(
|
||||
};
|
||||
|
||||
const new_image: Image = switch (image.format) {
|
||||
.grey_alpha => .{ .pending_grey_alpha = pending },
|
||||
.gray_alpha => .{ .pending_gray_alpha = pending },
|
||||
.rgb => .{ .pending_rgb = pending },
|
||||
.rgba => .{ .pending_rgba = pending },
|
||||
.png => unreachable, // should be decoded by now
|
||||
@ -2733,7 +2733,7 @@ fn syncAtlasTexture(device: objc.Object, atlas: *const font.Atlas, texture: *obj
|
||||
fn initAtlasTexture(device: objc.Object, atlas: *const font.Atlas) !objc.Object {
|
||||
// Determine our pixel format
|
||||
const pixel_format: mtl.MTLPixelFormat = switch (atlas.format) {
|
||||
.greyscale => .r8unorm,
|
||||
.grayscale => .r8unorm,
|
||||
.rgba => .bgra8unorm,
|
||||
else => @panic("unsupported atlas format for Metal texture"),
|
||||
};
|
||||
|
@ -82,8 +82,8 @@ gl_state: ?GLState = null,
|
||||
font_grid: *font.SharedGrid,
|
||||
font_shaper: font.Shaper,
|
||||
font_shaper_cache: font.ShaperCache,
|
||||
texture_greyscale_modified: usize = 0,
|
||||
texture_greyscale_resized: usize = 0,
|
||||
texture_grayscale_modified: usize = 0,
|
||||
texture_grayscale_resized: usize = 0,
|
||||
texture_color_modified: usize = 0,
|
||||
texture_color_resized: usize = 0,
|
||||
|
||||
@ -551,9 +551,9 @@ pub fn displayRealize(self: *OpenGL) !void {
|
||||
// reflush everything
|
||||
self.gl_cells_size = 0;
|
||||
self.gl_cells_written = 0;
|
||||
self.texture_greyscale_modified = 0;
|
||||
self.texture_grayscale_modified = 0;
|
||||
self.texture_color_modified = 0;
|
||||
self.texture_greyscale_resized = 0;
|
||||
self.texture_grayscale_resized = 0;
|
||||
self.texture_color_resized = 0;
|
||||
|
||||
// We need to reset our uniforms
|
||||
@ -669,8 +669,8 @@ pub fn setFontGrid(self: *OpenGL, grid: *font.SharedGrid) void {
|
||||
// Reset our font grid
|
||||
self.font_grid = grid;
|
||||
self.grid_metrics = grid.metrics;
|
||||
self.texture_greyscale_modified = 0;
|
||||
self.texture_greyscale_resized = 0;
|
||||
self.texture_grayscale_modified = 0;
|
||||
self.texture_grayscale_resized = 0;
|
||||
self.texture_color_modified = 0;
|
||||
self.texture_color_resized = 0;
|
||||
|
||||
@ -1134,7 +1134,7 @@ fn prepKittyImage(
|
||||
};
|
||||
|
||||
const new_image: Image = switch (image.format) {
|
||||
.grey_alpha => .{ .pending_grey_alpha = pending },
|
||||
.gray_alpha => .{ .pending_gray_alpha = pending },
|
||||
.rgb => .{ .pending_rgb = pending },
|
||||
.rgba => .{ .pending_rgba = pending },
|
||||
.png => unreachable, // should be decoded by now
|
||||
@ -1912,9 +1912,9 @@ fn flushAtlas(self: *OpenGL) !void {
|
||||
try flushAtlasSingle(
|
||||
&self.font_grid.lock,
|
||||
gl_state.texture,
|
||||
&self.font_grid.atlas_greyscale,
|
||||
&self.texture_greyscale_modified,
|
||||
&self.texture_greyscale_resized,
|
||||
&self.font_grid.atlas_grayscale,
|
||||
&self.texture_grayscale_modified,
|
||||
&self.texture_grayscale_resized,
|
||||
.red,
|
||||
.red,
|
||||
);
|
||||
@ -1998,10 +1998,10 @@ pub fn drawFrame(self: *OpenGL, surface: *apprt.Surface) !void {
|
||||
switch (kv.value_ptr.image) {
|
||||
.ready => {},
|
||||
|
||||
.pending_grey_alpha,
|
||||
.pending_gray_alpha,
|
||||
.pending_rgb,
|
||||
.pending_rgba,
|
||||
.replace_grey_alpha,
|
||||
.replace_gray_alpha,
|
||||
.replace_rgb,
|
||||
.replace_rgba,
|
||||
=> try kv.value_ptr.image.upload(self.alloc),
|
||||
@ -2317,12 +2317,12 @@ const GLState = struct {
|
||||
try texbind.image2D(
|
||||
0,
|
||||
.red,
|
||||
@intCast(font_grid.atlas_greyscale.size),
|
||||
@intCast(font_grid.atlas_greyscale.size),
|
||||
@intCast(font_grid.atlas_grayscale.size),
|
||||
@intCast(font_grid.atlas_grayscale.size),
|
||||
0,
|
||||
.red,
|
||||
.UnsignedByte,
|
||||
font_grid.atlas_greyscale.data.ptr,
|
||||
font_grid.atlas_grayscale.data.ptr,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -47,13 +47,13 @@ pub const Image = union(enum) {
|
||||
///
|
||||
/// This data is owned by this union so it must be freed once the
|
||||
/// image is uploaded.
|
||||
pending_grey_alpha: Pending,
|
||||
pending_gray_alpha: Pending,
|
||||
pending_rgb: Pending,
|
||||
pending_rgba: Pending,
|
||||
|
||||
/// This is the same as the pending states but there is a texture
|
||||
/// already allocated that we want to replace.
|
||||
replace_grey_alpha: Replace,
|
||||
replace_gray_alpha: Replace,
|
||||
replace_rgb: Replace,
|
||||
replace_rgba: Replace,
|
||||
|
||||
@ -90,12 +90,12 @@ pub const Image = union(enum) {
|
||||
|
||||
pub fn deinit(self: Image, alloc: Allocator) void {
|
||||
switch (self) {
|
||||
.pending_grey_alpha => |p| alloc.free(p.dataSlice(2)),
|
||||
.pending_gray_alpha => |p| alloc.free(p.dataSlice(2)),
|
||||
.pending_rgb => |p| alloc.free(p.dataSlice(3)),
|
||||
.pending_rgba => |p| alloc.free(p.dataSlice(4)),
|
||||
.unload_pending => |data| alloc.free(data),
|
||||
|
||||
.replace_grey_alpha => |r| {
|
||||
.replace_gray_alpha => |r| {
|
||||
alloc.free(r.pending.dataSlice(2));
|
||||
r.texture.msgSend(void, objc.sel("release"), .{});
|
||||
},
|
||||
@ -130,10 +130,10 @@ pub const Image = union(enum) {
|
||||
=> return,
|
||||
|
||||
.ready => |obj| .{ .unload_ready = obj },
|
||||
.pending_grey_alpha => |p| .{ .unload_pending = p.dataSlice(2) },
|
||||
.pending_gray_alpha => |p| .{ .unload_pending = p.dataSlice(2) },
|
||||
.pending_rgb => |p| .{ .unload_pending = p.dataSlice(3) },
|
||||
.pending_rgba => |p| .{ .unload_pending = p.dataSlice(4) },
|
||||
.replace_grey_alpha => |r| .{ .unload_replace = .{
|
||||
.replace_gray_alpha => |r| .{ .unload_replace = .{
|
||||
r.pending.dataSlice(2), r.texture,
|
||||
} },
|
||||
.replace_rgb => |r| .{ .unload_replace = .{
|
||||
@ -160,7 +160,7 @@ pub const Image = union(enum) {
|
||||
const existing: objc.Object = switch (self.*) {
|
||||
// For pending, we can free the old data and become pending
|
||||
// ourselves.
|
||||
.pending_grey_alpha => |p| {
|
||||
.pending_gray_alpha => |p| {
|
||||
alloc.free(p.dataSlice(2));
|
||||
self.* = img;
|
||||
return;
|
||||
@ -194,7 +194,7 @@ pub const Image = union(enum) {
|
||||
|
||||
// If we were already pending a replacement, then we free our
|
||||
// existing pending data and use the same texture.
|
||||
.replace_grey_alpha => |r| existing: {
|
||||
.replace_gray_alpha => |r| existing: {
|
||||
alloc.free(r.pending.dataSlice(2));
|
||||
break :existing r.texture;
|
||||
},
|
||||
@ -217,7 +217,7 @@ pub const Image = union(enum) {
|
||||
|
||||
// We now have an existing texture, so set the proper replace key.
|
||||
self.* = switch (img) {
|
||||
.pending_grey_alpha => |p| .{ .replace_grey_alpha = .{
|
||||
.pending_gray_alpha => |p| .{ .replace_gray_alpha = .{
|
||||
.texture = existing,
|
||||
.pending = p,
|
||||
} },
|
||||
@ -290,7 +290,7 @@ pub const Image = union(enum) {
|
||||
},
|
||||
|
||||
// GA needs to be converted to RGBA, too.
|
||||
.pending_grey_alpha => |*p| {
|
||||
.pending_gray_alpha => |*p| {
|
||||
const data = p.dataSlice(2);
|
||||
const rgba = try gaToRgba(alloc, data);
|
||||
alloc.free(data);
|
||||
@ -298,7 +298,7 @@ pub const Image = union(enum) {
|
||||
self.* = .{ .pending_rgba = p.* };
|
||||
},
|
||||
|
||||
.replace_grey_alpha => |*r| {
|
||||
.replace_gray_alpha => |*r| {
|
||||
const data = r.pending.dataSlice(2);
|
||||
const rgba = try gaToRgba(alloc, data);
|
||||
alloc.free(data);
|
||||
|
@ -45,13 +45,13 @@ pub const Image = union(enum) {
|
||||
///
|
||||
/// This data is owned by this union so it must be freed once the
|
||||
/// image is uploaded.
|
||||
pending_grey_alpha: Pending,
|
||||
pending_gray_alpha: Pending,
|
||||
pending_rgb: Pending,
|
||||
pending_rgba: Pending,
|
||||
|
||||
/// This is the same as the pending states but there is a texture
|
||||
/// already allocated that we want to replace.
|
||||
replace_grey_alpha: Replace,
|
||||
replace_gray_alpha: Replace,
|
||||
replace_rgb: Replace,
|
||||
replace_rgba: Replace,
|
||||
|
||||
@ -88,12 +88,12 @@ pub const Image = union(enum) {
|
||||
|
||||
pub fn deinit(self: Image, alloc: Allocator) void {
|
||||
switch (self) {
|
||||
.pending_grey_alpha => |p| alloc.free(p.dataSlice(2)),
|
||||
.pending_gray_alpha => |p| alloc.free(p.dataSlice(2)),
|
||||
.pending_rgb => |p| alloc.free(p.dataSlice(3)),
|
||||
.pending_rgba => |p| alloc.free(p.dataSlice(4)),
|
||||
.unload_pending => |data| alloc.free(data),
|
||||
|
||||
.replace_grey_alpha => |r| {
|
||||
.replace_gray_alpha => |r| {
|
||||
alloc.free(r.pending.dataSlice(2));
|
||||
r.texture.destroy();
|
||||
},
|
||||
@ -128,10 +128,10 @@ pub const Image = union(enum) {
|
||||
=> return,
|
||||
|
||||
.ready => |obj| .{ .unload_ready = obj },
|
||||
.pending_grey_alpha => |p| .{ .unload_pending = p.dataSlice(2) },
|
||||
.pending_gray_alpha => |p| .{ .unload_pending = p.dataSlice(2) },
|
||||
.pending_rgb => |p| .{ .unload_pending = p.dataSlice(3) },
|
||||
.pending_rgba => |p| .{ .unload_pending = p.dataSlice(4) },
|
||||
.replace_grey_alpha => |r| .{ .unload_replace = .{
|
||||
.replace_gray_alpha => |r| .{ .unload_replace = .{
|
||||
r.pending.dataSlice(2), r.texture,
|
||||
} },
|
||||
.replace_rgb => |r| .{ .unload_replace = .{
|
||||
@ -157,7 +157,7 @@ pub const Image = union(enum) {
|
||||
// the self pointer directly.
|
||||
const existing: gl.Texture = switch (self.*) {
|
||||
// For pending, we can free the old data and become pending ourselves.
|
||||
.pending_grey_alpha => |p| {
|
||||
.pending_gray_alpha => |p| {
|
||||
alloc.free(p.dataSlice(2));
|
||||
self.* = img;
|
||||
return;
|
||||
@ -191,7 +191,7 @@ pub const Image = union(enum) {
|
||||
|
||||
// If we were already pending a replacement, then we free our
|
||||
// existing pending data and use the same texture.
|
||||
.replace_grey_alpha => |r| existing: {
|
||||
.replace_gray_alpha => |r| existing: {
|
||||
alloc.free(r.pending.dataSlice(2));
|
||||
break :existing r.texture;
|
||||
},
|
||||
@ -214,7 +214,7 @@ pub const Image = union(enum) {
|
||||
|
||||
// We now have an existing texture, so set the proper replace key.
|
||||
self.* = switch (img) {
|
||||
.pending_grey_alpha => |p| .{ .replace_grey_alpha = .{
|
||||
.pending_gray_alpha => |p| .{ .replace_gray_alpha = .{
|
||||
.texture = existing,
|
||||
.pending = p,
|
||||
} },
|
||||
@ -246,7 +246,7 @@ pub const Image = union(enum) {
|
||||
=> true,
|
||||
|
||||
.ready,
|
||||
.pending_grey_alpha,
|
||||
.pending_gray_alpha,
|
||||
.pending_rgb,
|
||||
.pending_rgba,
|
||||
=> false,
|
||||
@ -288,7 +288,7 @@ pub const Image = union(enum) {
|
||||
},
|
||||
|
||||
// GA needs to be converted to RGBA, too.
|
||||
.pending_grey_alpha => |*p| {
|
||||
.pending_gray_alpha => |*p| {
|
||||
const data = p.dataSlice(2);
|
||||
const rgba = try gaToRgba(alloc, data);
|
||||
alloc.free(data);
|
||||
@ -296,7 +296,7 @@ pub const Image = union(enum) {
|
||||
self.* = .{ .pending_rgba = p.* };
|
||||
},
|
||||
|
||||
.replace_grey_alpha => |*r| {
|
||||
.replace_gray_alpha => |*r| {
|
||||
const data = r.pending.dataSlice(2);
|
||||
const rgba = try gaToRgba(alloc, data);
|
||||
alloc.free(data);
|
||||
|
@ -304,7 +304,7 @@ vertex CellTextVertexOut cell_text_vertex(
|
||||
|
||||
fragment float4 cell_text_fragment(
|
||||
CellTextVertexOut in [[stage_in]],
|
||||
texture2d<float> textureGreyscale [[texture(0)]],
|
||||
texture2d<float> textureGrayscale [[texture(0)]],
|
||||
texture2d<float> textureColor [[texture(1)]]
|
||||
) {
|
||||
constexpr sampler textureSampler(
|
||||
@ -325,7 +325,7 @@ fragment float4 cell_text_fragment(
|
||||
float4 premult = float4(in.color.rgb * in.color.a, in.color.a);
|
||||
|
||||
// Then premult the texture color
|
||||
float a = textureGreyscale.sample(textureSampler, in.tex_coord).r;
|
||||
float a = textureGrayscale.sample(textureSampler, in.tex_coord).r;
|
||||
premult = premult * a;
|
||||
|
||||
return premult;
|
||||
|
@ -31,7 +31,7 @@ pub const default: Palette = default: {
|
||||
}
|
||||
}
|
||||
|
||||
// Grey ramp
|
||||
// Gray ramp
|
||||
assert(i == 232);
|
||||
assert(@TypeOf(i) == u8);
|
||||
while (i > 0) : (i +%= 1) {
|
||||
|
@ -367,11 +367,11 @@ pub const Transmission = struct {
|
||||
// The following are not supported directly via the protocol
|
||||
// but they are formats that a png may decode to that we
|
||||
// support.
|
||||
grey_alpha,
|
||||
gray_alpha,
|
||||
|
||||
pub fn bpp(self: Format) u8 {
|
||||
return switch (self) {
|
||||
.grey_alpha => 2,
|
||||
.gray_alpha => 2,
|
||||
.rgb => 3,
|
||||
.rgba => 4,
|
||||
.png => unreachable, // Must be validated before
|
||||
|
@ -145,7 +145,7 @@ pub const LoadingImage = struct {
|
||||
.png => stat_size,
|
||||
|
||||
// For these formats we have a size we must have.
|
||||
.grey_alpha, .rgb, .rgba => |f| size: {
|
||||
.gray_alpha, .rgb, .rgba => |f| size: {
|
||||
const bpp = f.bpp();
|
||||
break :size self.image.width * self.image.height * bpp;
|
||||
},
|
||||
@ -447,7 +447,7 @@ pub const LoadingImage = struct {
|
||||
self.image.width = @intCast(width);
|
||||
self.image.height = @intCast(height);
|
||||
self.image.format = switch (bpp) {
|
||||
2 => .grey_alpha,
|
||||
2 => .gray_alpha,
|
||||
3 => .rgb,
|
||||
4 => .rgba,
|
||||
else => unreachable, // validated above
|
||||
|
@ -4,6 +4,8 @@ extend-exclude = [
|
||||
"pkg/*",
|
||||
"src/stb/*",
|
||||
"*.xib",
|
||||
# "grey" color names are valid
|
||||
"src/terminal/res/rgb.txt",
|
||||
# Do not self-check
|
||||
"typos.toml",
|
||||
# Fonts
|
||||
@ -36,6 +38,8 @@ iterm = "iterm"
|
||||
ACCES = "ACCES"
|
||||
wdth = "wdth"
|
||||
Strat = "Strat"
|
||||
grey = "gray"
|
||||
greyscale = "grayscale"
|
||||
|
||||
[type.swift.extend-words]
|
||||
inout = "inout"
|
||||
|
Loading…
x
Reference in New Issue
Block a user