text: Add comments

This commit is contained in:
Hajime Hoshi 2020-11-03 20:35:55 +09:00
parent c70ebdc697
commit cd779b678a

View File

@ -291,6 +291,8 @@ func BoundString(face font.Face, text string) image.Rectangle {
// cache and render it for each rune. This is very inefficient because creating a glyph image and rendering it are // cache and render it for each rune. This is very inefficient because creating a glyph image and rendering it are
// different operations and can never be merged as one draw call. CacheGlyphs creates necessary glyphs without // different operations and can never be merged as one draw call. CacheGlyphs creates necessary glyphs without
// rendering them so that these operations are likely merged into one draw call. // rendering them so that these operations are likely merged into one draw call.
//
// If a rune's glyph is already cached, CacheGlyphs does nothing for the rune.
func CacheGlyphs(face font.Face, text string) { func CacheGlyphs(face font.Face, text string) {
textM.Lock() textM.Lock()
defer textM.Unlock() defer textM.Unlock()