mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
text: Improve the comments
This commit is contained in:
parent
c5c12cbf68
commit
cdf700ed84
18
text/text.go
18
text/text.go
@ -161,9 +161,9 @@ var textM sync.Mutex
|
||||
//
|
||||
// The two functions are implemented like this:
|
||||
//
|
||||
// Draw = Create glyphs by `ReplacePixels` and put them into the cache if necessary
|
||||
// + Draw them onto the destination by `DrawImage`
|
||||
// CacheGlyphs = Create glyphs by `ReplacePixels` and put them into the cache if necessary
|
||||
// Draw = Create glyphs by `(*ebiten.Image).ReplacePixels` and put them into the cache if necessary
|
||||
// + Draw them onto the destination by `(*ebiten.Image).DrawImage`
|
||||
// CacheGlyphs = Create glyphs by `(*ebiten.Image).ReplacePixels` and put them into the cache if necessary
|
||||
//
|
||||
// Be careful that the passed font face is held by this package and is never released.
|
||||
// This is a known issue (#498).
|
||||
@ -283,15 +283,15 @@ func BoundString(face font.Face, text string) image.Rectangle {
|
||||
// Draw automatically creates and caches necessary glyphs, so usually you don't have to call CacheGlyphs
|
||||
// explicitly. However, for example, when you call Draw for each rune of one big text, Draw tries to create the glyph
|
||||
// cache and render it for each rune. This is very inefficient because creating a glyph image and rendering it are
|
||||
// different operations (ReplacePixels and DrawImage) 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 regardless of the size of the text.
|
||||
// different operations (`(*ebiten.Image).ReplacePixels` and `(*ebiten.Image).DrawImage`) 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 regardless of the size of the text.
|
||||
//
|
||||
// The two functions are implemented like this:
|
||||
//
|
||||
// Draw = Create glyphs by `ReplacePixels` and put them into the cache if necessary
|
||||
// + Draw them onto the destination by `DrawImage`
|
||||
// CacheGlyphs = Create glyphs by `ReplacePixels` and put them into the cache if necessary
|
||||
// Draw = Create glyphs by `(*ebiten.Image).ReplacePixels` and put them into the cache if necessary
|
||||
// + Draw them onto the destination by `(*ebiten.Image).DrawImage`
|
||||
// CacheGlyphs = Create glyphs by `(*ebiten.Image).ReplacePixels` and put them into the cache if necessary
|
||||
//
|
||||
// If a rune's glyph is already cached, CacheGlyphs does nothing for the rune.
|
||||
func CacheGlyphs(face font.Face, text string) {
|
||||
|
Loading…
Reference in New Issue
Block a user