text/record.rs#
Source: lib/text/record.rs
record -- glyphs placed now and blended later from the glyph cache, by any thread (the row
bands of ui's render_par.rs)
GlyphRec::default() / rec.begin(&text) an empty record, bound to the cache as it is now
text.record_n(&mut rec, dc, sf, x, y, s, len) -> placed draw_n's glyphs appended to rec
instead of blended (dc and sf as draw_n would get them; dc's colour is recorded with
every glyph): layout, shaping, fallback fonts and rasterizing the masks into the cache
happen now. false: a glyph cannot come from the cache (too large: a filled path; a
colour bitmap above the cache's limit) -- that text must be drawn with draw_n
text.record_icon(&mut rec, dc, sf, cp, x, y, size_fx) -> placed the same for icon_draw
rec.len() glyphs so far (a text's range: len before .. after)
rec.valid(&text) the cache was not flushed since begin (the keys hold)
text.glyphs() -> GlyphView the cache read-only, Send + Sync
view.draw(&rec, from, to, dc, sf) blend glyphs from .. to in their colours inside dc's
clip (dc.row0 honoured): the bytes draw_n gives there
A glyph is its cache key, pen x and baseline (absolute target pixels), its box (cheap
culling against the clip), the colour and how it is blended (mask, colour bitmap, subpixel
mask with a copy of the colour's coverage adjustment). Masks depend only on the key, so
blending them later, clipped, gives the pixels of drawing them now.
struct GlyphRecglyphs placed by record_n / record_icon, blended later by GlyphView::draw
impl GlyphRec
fn begin(&mut self, t: &Text)empty, bound to the glyph cache as it is nowfn len(&self) -> usizeglyphs recorded so farfn is_empty(&self) -> boolfn valid(&self, t: &Text) -> boolthe glyph cache was not flushed since begin: every recorded key is still there
impl Text
fn record_n(&mut self, rec: &mut GlyphRec, dc: &mut Dc, sf: &mut Surface, x: i32, y: i32, s: &[u8], len: usize) -> booldraw_n's glyphs appended to rec instead of blended (record.rs); false: one of them cannot be blended from the cache, draw that text with draw_nfn record_icon(&mut self, rec: &mut GlyphRec, dc: &mut Dc, sf: &mut Surface, cp: u32, x: i32, y: i32, size_fx: i32) -> boolicon_draw's glyph appended to rec (record_n)fn glyphs(&self) -> GlyphView<'_>the glyph cache read-only, for blending recorded glyphs on other threadsstruct GlyphView<'a>the glyph cache read-only (Text::glyphs): blends recorded glyphs, from any thread
impl GlyphView<'_>
fn draw(&self, rec: &GlyphRec, from: usize, to: usize, dc: &mut Dc, sf: &mut Surface)blend the glyphs from .. to of rec in their colours inside dc's clip (rec.valid must hold: a missing mask is skipped)