Skip to content

Commit

Permalink
Don't draw transparent rectangles or spaces either
Browse files Browse the repository at this point in the history
A big performance improvement for TextGrid especially
  • Loading branch information
andydotxyz committed Jul 26, 2021
1 parent 2bcc426 commit 4a92872
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/painter/gl/draw.go
@@ -1,6 +1,7 @@
package gl

import (
"image/color"
"math"

"fyne.io/fyne/v2"
Expand Down Expand Up @@ -53,12 +54,15 @@ func (p *glPainter) drawGradient(o fyne.CanvasObject, texCreator func(fyne.Canva
}

func (p *glPainter) drawRectangle(rect *canvas.Rectangle, pos fyne.Position, frame fyne.Size) {
if (rect.FillColor == color.Transparent || rect.FillColor == nil) && (rect.StrokeColor == color.Transparent || rect.FillColor == nil || rect.StrokeWidth == 0) {
return
}
p.drawTextureWithDetails(rect, p.newGlRectTexture, pos, rect.Size(), frame, canvas.ImageFillStretch,
1.0, painter.VectorPad(rect))
}

func (p *glPainter) drawText(text *canvas.Text, pos fyne.Position, frame fyne.Size) {
if text.Text == "" {
if text.Text == "" || text.Text == " " {
return
}

Expand Down

0 comments on commit 4a92872

Please sign in to comment.