mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text/v2: reduce members in structs
This commit is contained in:
parent
586a4b6d6e
commit
a612b3c861
@ -40,15 +40,8 @@ func init() {
|
||||
}
|
||||
|
||||
type faceCacheKey struct {
|
||||
stdFaceID uint64
|
||||
|
||||
goTextFaceSourceID uint64
|
||||
goTextFaceDirection Direction
|
||||
id uint64
|
||||
goTextFaceSizeInPixels float64
|
||||
goTextFaceLanguage string
|
||||
goTextFaceScript string
|
||||
goTextFaceVariations string
|
||||
goTextFaceFeatures string
|
||||
}
|
||||
|
||||
type glyphImageCacheKey struct {
|
||||
|
@ -236,13 +236,8 @@ func (g *GoTextFace) ensureFeaturesString() string {
|
||||
// faceCacheKey implements Face.
|
||||
func (g *GoTextFace) faceCacheKey() faceCacheKey {
|
||||
return faceCacheKey{
|
||||
goTextFaceSourceID: g.Source.id,
|
||||
goTextFaceDirection: g.Direction,
|
||||
id: g.Source.id,
|
||||
goTextFaceSizeInPixels: g.SizeInPixels,
|
||||
goTextFaceLanguage: g.Language.String(),
|
||||
goTextFaceScript: g.Script.String(),
|
||||
goTextFaceVariations: g.ensureVariationsString(),
|
||||
goTextFaceFeatures: g.ensureFeaturesString(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ func NewGoTextFaceSourcesFromCollection(source io.ReadSeeker) ([]*GoTextFaceSour
|
||||
func finalizeGoTextFaceSource(source *GoTextFaceSource) {
|
||||
runtime.SetFinalizer(source, nil)
|
||||
theGlyphImageCache.clear(func(key faceCacheKey) bool {
|
||||
return key.goTextFaceSourceID == source.id
|
||||
return key.id == source.id
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func NewStdFace(face font.Face) *StdFace {
|
||||
func finalizeStdFace(face *StdFace) {
|
||||
runtime.SetFinalizer(face, nil)
|
||||
theGlyphImageCache.clear(func(key faceCacheKey) bool {
|
||||
return key.stdFaceID == face.id
|
||||
return key.id == face.id
|
||||
})
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ func (s *StdFace) UnsafeInternal() any {
|
||||
// faceCacheKey implements Face.
|
||||
func (s *StdFace) faceCacheKey() faceCacheKey {
|
||||
return faceCacheKey{
|
||||
stdFaceID: s.id,
|
||||
id: s.id,
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user