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 <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-04-15 19:22:33 +02:00
parent f655027110
commit 23a839a29d
+1 -1
View File
@@ -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()
}