~eliasnaur/gio

62a1d8ae6e78b8ca8970db52b931aeb013e1d83a — pierre 4 months ago d23514f
layout: avoid copying whole constraints in Stack

Signed-off-by: pierre <pierre.curto@gmail.com>
1 files changed, 5 insertions(+), 8 deletions(-)

M layout/stack.go
M layout/stack.go => layout/stack.go +5 -8
@@ 50,14 50,14 @@ func Expanded(w Widget) StackChild {
func (s Stack) Layout(gtx Context, children ...StackChild) Dimensions {
	var maxSZ image.Point
	// First lay out Stacked children.
	cgtx := gtx
	cgtx.Constraints.Min = image.Point{}
	for i, w := range children {
		if w.expanded {
			continue
		}
		macro := op.Record(gtx.Ops)
		gtx := gtx
		gtx.Constraints.Min = image.Pt(0, 0)
		dims := w.widget(gtx)
		dims := w.widget(cgtx)
		call := macro.Stop()
		if w := dims.Size.X; w > maxSZ.X {
			maxSZ.X = w


@@ 74,11 74,8 @@ func (s Stack) Layout(gtx Context, children ...StackChild) Dimensions {
			continue
		}
		macro := op.Record(gtx.Ops)
		gtx := gtx
		gtx.Constraints = Constraints{
			Min: maxSZ, Max: gtx.Constraints.Max,
		}
		dims := w.widget(gtx)
		cgtx.Constraints.Min = maxSZ
		dims := w.widget(cgtx)
		call := macro.Stop()
		if w := dims.Size.X; w > maxSZ.X {
			maxSZ.X = w