Skip to content

Commit

Permalink
Add more profiling info
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Jan 9, 2025
1 parent 8f2534f commit 5c0d094
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions vello_encoding/src/glyph_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,26 @@ fn resolve_single_glyph(
let font_id = font.data.id();
let font_index = font.index;
let font = skrifa::FontRef::from_index(font.data.as_ref(), font.index).ok()?;
let outlines = font.outline_glyphs();

let outlines = {
let _span = tracing::trace_span!("Getting font outline builder").entered();
font.outline_glyphs()
};
let size = Size::new(f32::from_bits(glyph.font_size_bits));
let outline = outlines.get(GlyphId::new(glyph.glyph_id))?;
let outline = {
let _span = tracing::trace_span!("Getting Glyph Outline").entered();
outlines.get(GlyphId::new(glyph.glyph_id))?
};
let mut encoding = Encoding::default();
encoding.reset();
let style: crate::Style = bytemuck::cast(glyph.style_bits);
encoding.encode_style(style);
let is_fill = style.is_fill();
use skrifa::outline::DrawSettings;
let mut path = encoding.encode_path(is_fill);
let mut path = {
let _span = tracing::trace_span!("Encoding path").entered();
encoding.encode_path(is_fill)
};
let hinter = if glyph.hint {
let key = HintKey {
font_id,
Expand All @@ -186,7 +196,10 @@ fn resolve_single_glyph(
} else {
DrawSettings::unhinted(size, &**coords)
};
outline.draw(draw_settings, &mut path).ok()?;
{
let _span = tracing::trace_span!("Drawing span").entered();
outline.draw(draw_settings, &mut path).ok()?;
}
if path.finish(false) == 0 {
encoding.reset();
}
Expand Down

0 comments on commit 5c0d094

Please sign in to comment.