mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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 {
|
type faceCacheKey struct {
|
||||||
stdFaceID uint64
|
id uint64
|
||||||
|
|
||||||
goTextFaceSourceID uint64
|
|
||||||
goTextFaceDirection Direction
|
|
||||||
goTextFaceSizeInPixels float64
|
goTextFaceSizeInPixels float64
|
||||||
goTextFaceLanguage string
|
|
||||||
goTextFaceScript string
|
|
||||||
goTextFaceVariations string
|
|
||||||
goTextFaceFeatures string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type glyphImageCacheKey struct {
|
type glyphImageCacheKey struct {
|
||||||
|
@ -236,13 +236,8 @@ func (g *GoTextFace) ensureFeaturesString() string {
|
|||||||
// faceCacheKey implements Face.
|
// faceCacheKey implements Face.
|
||||||
func (g *GoTextFace) faceCacheKey() faceCacheKey {
|
func (g *GoTextFace) faceCacheKey() faceCacheKey {
|
||||||
return faceCacheKey{
|
return faceCacheKey{
|
||||||
goTextFaceSourceID: g.Source.id,
|
id: g.Source.id,
|
||||||
goTextFaceDirection: g.Direction,
|
|
||||||
goTextFaceSizeInPixels: g.SizeInPixels,
|
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) {
|
func finalizeGoTextFaceSource(source *GoTextFaceSource) {
|
||||||
runtime.SetFinalizer(source, nil)
|
runtime.SetFinalizer(source, nil)
|
||||||
theGlyphImageCache.clear(func(key faceCacheKey) bool {
|
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) {
|
func finalizeStdFace(face *StdFace) {
|
||||||
runtime.SetFinalizer(face, nil)
|
runtime.SetFinalizer(face, nil)
|
||||||
theGlyphImageCache.clear(func(key faceCacheKey) bool {
|
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.
|
// faceCacheKey implements Face.
|
||||||
func (s *StdFace) faceCacheKey() faceCacheKey {
|
func (s *StdFace) faceCacheKey() faceCacheKey {
|
||||||
return faceCacheKey{
|
return faceCacheKey{
|
||||||
stdFaceID: s.id,
|
id: s.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user