From 23a839a29d27c27c50efaa4fd3479308a0a90f97 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 15 Apr 2021 19:22:33 +0200 Subject: [PATCH] widget: clip by most complex shape last In the new compute renderer, clipping to a complex shape is slower than filling it. Swap the clip shapes for drawing text so that the text shape itself is last, and therefore used for filling. Signed-off-by: Elias Naur --- widget/label.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/label.go b/widget/label.go index 3973f28a..6be2d9f2 100644 --- a/widget/label.go +++ b/widget/label.go @@ -178,8 +178,8 @@ func (l Label) Layout(gtx layout.Context, s text.Shaper, font text.Font, size un } stack := op.Save(gtx.Ops) op.Offset(layout.FPt(off)).Add(gtx.Ops) - s.Shape(font, textSize, l).Add(gtx.Ops) clip.Rect(cl.Sub(off)).Add(gtx.Ops) + s.Shape(font, textSize, l).Add(gtx.Ops) paint.PaintOp{}.Add(gtx.Ops) stack.Load() }