widget: make glyphIndex reusable

This commit allows the glyph index type to be reset and reused, preventing the
reallocation of numerous buffers when indexing glyphs.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-03-16 12:13:41 -04:00
committed by Elias Naur
parent 25171df66a
commit 36e768e716
3 changed files with 39 additions and 13 deletions
+1 -1
View File
@@ -413,7 +413,7 @@ func (e *textView) layoutText(lt *text.Shaper) {
e.maskReader.Reset(e, e.Mask)
r = &e.maskReader
}
e.index = glyphIndex{}
e.index.reset()
it := textIterator{viewport: image.Rectangle{Max: image.Point{X: math.MaxInt, Y: math.MaxInt}}}
if lt != nil {
lt.Layout(text.Parameters{