Skip to content

Commit

Permalink
Cache text texture per-canvas so it matches the OpenGL context
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Oct 18, 2024
1 parent af35ba6 commit e02dad2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/cache/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ type fontSizeEntry struct {
type FontCacheEntry struct {
fontSizeEntry

Color color.Color
Canvas fyne.Canvas
Color color.Color
}

// GetFontMetrics looks up a calculated size and baseline required for the specified text parameters.
Expand Down
2 changes: 1 addition & 1 deletion internal/painter/gl/texture.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *painter) getTexture(object fyne.CanvasObject, creator func(canvasObject
if t.FontSource != nil {
custom = t.FontSource.Name()
}
ent := cache.FontCacheEntry{Color: t.Color}
ent := cache.FontCacheEntry{Color: t.Color, Canvas: p.canvas}
ent.Text = t.Text
ent.Size = t.TextSize
ent.Style = t.TextStyle
Expand Down

0 comments on commit e02dad2

Please sign in to comment.