From 4601cffabafa7bfadfd0330122fdef87a7dd675c Mon Sep 17 00:00:00 2001 From: Zyko <13394516+Zyko0@users.noreply.github.com> Date: Sat, 27 Jul 2024 18:01:06 +0200 Subject: [PATCH] Cleanup --- text/v2/atlas.go | 4 ++++ text/v2/glyph.go | 2 +- text/v2/gotextseg.go | 9 --------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/text/v2/atlas.go b/text/v2/atlas.go index ad7c47fac..733c99d4a 100644 --- a/text/v2/atlas.go +++ b/text/v2/atlas.go @@ -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) +} diff --git a/text/v2/glyph.go b/text/v2/glyph.go index 9af846af6..9b08c345b 100644 --- a/text/v2/glyph.go +++ b/text/v2/glyph.go @@ -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) } } } diff --git a/text/v2/gotextseg.go b/text/v2/gotextseg.go index 3d7fa9e9d..7579e9bc0 100644 --- a/text/v2/gotextseg.go +++ b/text/v2/gotextseg.go @@ -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