This commit is contained in:
Zyko 2024-07-27 18:01:06 +02:00
parent 5e8d969034
commit 4601cffaba
3 changed files with 5 additions and 10 deletions

View File

@ -30,3 +30,7 @@ func (g *glyphAtlas) NewImage(w, h int) *atlas.Image {
return g.NewImage(w, h)
}
func (g *glyphAtlas) Free(img *atlas.Image) {
g.atlas.Free(img)
}

View File

@ -93,7 +93,7 @@ func (g *glyphImageCache[Key]) getOrCreate(face Face, key Key, create func(a *gl
continue
}
delete(g.cache, key)
g.atlas.atlas.Free(e.image)
g.atlas.Free(e.image)
}
}
}

View File

@ -16,7 +16,6 @@ package text
import (
"image"
"image/color"
"image/draw"
"math"
@ -26,7 +25,6 @@ import (
"github.com/go-text/typesetting/opentype/api"
"golang.org/x/image/math/fixed"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/vector"
)
@ -78,13 +76,6 @@ func segmentsToBounds(segs []api.Segment) fixed.Rectangle26_6 {
}
}
var whiteImage = ebiten.NewImage(3, 3)
func init() {
whiteImage.Fill(color.White)
//whiteImage.Set(1, 1, color.White)
}
func segmentsToImage(a *glyphAtlas, segs []api.Segment, subpixelOffset fixed.Point26_6, glyphBounds fixed.Rectangle26_6) *atlas.Image {
if len(segs) == 0 {
return nil