mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
Remove unnecessary allocation.
This commit is contained in:

committed by
Mitchell Hashimoto

parent
abd782a7aa
commit
b76f5976ee
@ -396,7 +396,6 @@ pub const Face = struct {
|
||||
const offset_y: i32 = offset_y: {
|
||||
// Our Y coordinate in 3D is (0, 0) bottom left, +y is UP.
|
||||
// We need to calculate our baseline from the bottom of a cell.
|
||||
//const baseline_from_bottom: f64 = @floatFromInt(self.metrics.cell_baseline);
|
||||
const baseline_from_bottom: f64 = @floatFromInt(metrics.cell_baseline);
|
||||
|
||||
// Next we offset our baseline by the bearing in the font. We
|
||||
@ -425,18 +424,6 @@ pub const Face = struct {
|
||||
var advances: [glyphs.len]macos.graphics.Size = undefined;
|
||||
_ = self.font.getAdvancesForGlyphs(.horizontal, &glyphs, &advances);
|
||||
|
||||
// std.log.warn("renderGlyph rect={} width={} height={} render_x={} render_y={} offset_y={} ascent={} cell_height={} cell_baseline={}", .{
|
||||
// rect,
|
||||
// width,
|
||||
// height,
|
||||
// render_x,
|
||||
// render_y,
|
||||
// offset_y,
|
||||
// glyph_ascent,
|
||||
// self.metrics.cell_height,
|
||||
// self.metrics.cell_baseline,
|
||||
// });
|
||||
|
||||
return .{
|
||||
.width = width,
|
||||
.height = height,
|
||||
@ -538,9 +525,6 @@ pub const Face = struct {
|
||||
.strikethrough_thickness = @intFromFloat(strikethrough_thickness),
|
||||
};
|
||||
|
||||
// std.log.warn("font size size={d}", .{ct_font.getSize()});
|
||||
// std.log.warn("font metrics={}", .{result});
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
@ -304,19 +304,16 @@ pub const Shaper = struct {
|
||||
|
||||
// Get our glyphs and positions
|
||||
const glyphs = try ctrun.getGlyphs(alloc);
|
||||
const positions = try ctrun.getPositions(alloc);
|
||||
const advances = try ctrun.getAdvances(alloc);
|
||||
const indices = try ctrun.getStringIndices(alloc);
|
||||
assert(glyphs.len == positions.len);
|
||||
assert(glyphs.len == advances.len);
|
||||
assert(glyphs.len == indices.len);
|
||||
|
||||
for (
|
||||
glyphs,
|
||||
positions,
|
||||
advances,
|
||||
indices,
|
||||
) |glyph, pos, advance, index| {
|
||||
) |glyph, advance, index| {
|
||||
try self.cell_buf.ensureUnusedCapacity(
|
||||
self.alloc,
|
||||
glyphs.len,
|
||||
@ -351,15 +348,7 @@ pub const Shaper = struct {
|
||||
// Advances apply to the NEXT cell.
|
||||
cell_offset.x += advance.width;
|
||||
cell_offset.y += advance.height;
|
||||
|
||||
_ = pos;
|
||||
// const i = self.cell_buf.items.len - 1;
|
||||
// log.warn(
|
||||
// "i={} codepoint={} glyph={} pos={} advance={} index={} cluster={}",
|
||||
// .{ i, self.codepoints.items[index].codepoint, glyph, pos, advance, index, cluster },
|
||||
// );
|
||||
}
|
||||
//log.warn("-------------------------------", .{});
|
||||
}
|
||||
|
||||
// If our last cell doesn't match our last cluster then we have
|
||||
|
Reference in New Issue
Block a user