diff --git a/apps/go.mod b/apps/go.mod index b07fb7e6..f4f2ffc2 100644 --- a/apps/go.mod +++ b/apps/go.mod @@ -3,7 +3,7 @@ module gioui.org/apps go 1.12 require ( - gioui.org/ui v0.0.0-20190715191043-00b9ff603f38 + gioui.org/ui v0.0.0-20190716112151-94a913a371c4 github.com/google/go-github/v24 v24.0.1 golang.org/x/exp v0.0.0-20190627132806-fd42eb6b336f golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9 diff --git a/apps/gophers/main.go b/apps/gophers/main.go index 887f0526..d78b39b4 100644 --- a/apps/gophers/main.go +++ b/apps/gophers/main.go @@ -174,9 +174,11 @@ func init() { } func colorMaterial(ops *ui.Ops, color color.RGBA) ui.MacroOp { - ops.Record() + var mat ui.MacroOp + mat.Record(ops) gdraw.ColorOp{Color: color}.Add(ops) - return ops.Stop() + mat.Stop() + return mat } func (a *App) run() error { @@ -675,18 +677,19 @@ func baseline() layout.Flex { } type clipCircle struct { + m ui.MacroOp ops *ui.Ops } func (c *clipCircle) Begin(ops *ui.Ops, cs layout.Constraints) layout.Constraints { c.ops = ops - ops.Record() + c.m.Record(ops) return cs } func (c *clipCircle) End(dims layout.Dimens) layout.Dimens { + c.m.Stop() ops := c.ops - macro := ops.Stop() max := dims.Size.X if dy := dims.Size.Y; dy > max { max = dy @@ -695,7 +698,7 @@ func (c *clipCircle) End(dims layout.Dimens) layout.Dimens { rr := szf * .5 ui.PushOp{}.Add(ops) rrect(ops, szf, szf, rr, rr, rr, rr) - macro.Add(ops) + c.m.Add(ops) ui.PopOp{}.Add(ops) return dims } diff --git a/apps/hello/hello.go b/apps/hello/hello.go index f2a8e373..afa288e8 100644 --- a/apps/hello/hello.go +++ b/apps/hello/hello.go @@ -54,9 +54,10 @@ func loop(w *app.Window) error { cfg = e.Config cs := layout.RigidConstraints(e.Size) ops.Reset() - ops.Record() + var material ui.MacroOp + material.Record(ops) draw.ColorOp{Color: maroon}.Add(ops) - material := ops.Stop() + material.Stop() text.Label{Material: material, Face: face, Alignment: text.Center, Text: message}.Layout(ops, cs) w.Draw(ops) faces.Frame()