0c81af84923edf6e6aa89758f9ec19c45d5243d1 — Elias Naur a month ago 2b923d5
cmd/scatter: update gio version

Signed-off-by: Elias Naur <mail@eliasnaur.com>
3 files changed, 14 insertions(+), 17 deletions(-)

M cmd/scatter/ui.go
M go.mod
M go.sum
M cmd/scatter/ui.go => cmd/scatter/ui.go +11 -14
@@ 143,7 143,7 @@ type icon struct {
 	size unit.Value
 
 	// Cached values.
-	img     image.Image
+	op      paint.ImageOp
 	imgSize int
 }
 


@@ 1154,12 1154,12 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
 							in := layout.Inset{Left: unit.Dp(12)}
 							in.Layout(gtx, func() {
 								checkmark := p.checkmark.image(gtx, timecol)
-								r := checkmark.Bounds()
+								sz := checkmark.Size()
 								if msg.Sent {
-									paint.ImageOp{Src: checkmark, Rect: r}.Add(gtx.Ops)
-									paint.PaintOp{Rect: toRectF(r)}.Add(gtx.Ops)
+									checkmark.Add(gtx.Ops)
+									paint.PaintOp{Rect: f32.Rectangle{Max: toPointF(sz)}}.Add(gtx.Ops)
 								}
-								gtx.Dimensions = layout.Dimensions{Size: r.Size()}
+								gtx.Dimensions = layout.Dimensions{Size: sz}
 							})
 						})
 						children = append(children, child)


@@ 1270,17 1270,14 @@ func (cc *clipCircle) Layout(gtx *layout.Context, w layout.Widget) {
 	stack.Pop()
 }
 
-func toRectF(r image.Rectangle) f32.Rectangle {
-	return f32.Rectangle{
-		Min: f32.Point{X: float32(r.Min.X), Y: float32(r.Min.Y)},
-		Max: f32.Point{X: float32(r.Max.X), Y: float32(r.Max.Y)},
-	}
+func toPointF(p image.Point) f32.Point {
+	return f32.Point{X: float32(p.X), Y: float32(p.Y)}
 }
 
-func (ic *icon) image(c unit.Converter, col color.RGBA) image.Image {
+func (ic *icon) image(c unit.Converter, col color.RGBA) paint.ImageOp {
 	sz := c.Px(ic.size)
 	if sz == ic.imgSize {
-		return ic.img
+		return ic.op
 	}
 	m, _ := iconvg.DecodeMetadata(ic.src)
 	dx, dy := m.ViewBox.AspectRatio()


@@ 1291,9 1288,9 @@ func (ic *icon) image(c unit.Converter, col color.RGBA) image.Image {
 	iconvg.Decode(&ico, ic.src, &iconvg.DecodeOptions{
 		Palette: &m.Palette,
 	})
-	ic.img = img
+	ic.op = paint.NewImageOp(img)
 	ic.imgSize = sz
-	return img
+	return ic.op
 }
 
 // https://pomax.github.io/bezierinfo/#circles_cubic.

M go.mod => go.mod +1 -1
@@ 3,7 3,7 @@ module scatter.im
 go 1.13
 
 require (
-	gioui.org v0.0.0-20191014144402-3a27bcea2e78
+	gioui.org v0.0.0-20191014162007-f5e93206f602
 	github.com/eliasnaur/libsignal-protocol-go v0.0.0-20190626062856-3295f72b181e
 	github.com/emersion/go-imap v1.0.0-rc.1
 	github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e

M go.sum => go.sum +2 -2
@@ 1,6 1,6 @@
 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
-gioui.org v0.0.0-20191014144402-3a27bcea2e78 h1:qb1ajYPzqnOuA4QaVee/0u1fpyH07Z5lxuykyr7mwYM=
-gioui.org v0.0.0-20191014144402-3a27bcea2e78/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
+gioui.org v0.0.0-20191014162007-f5e93206f602 h1:TSMbKy1gf9Z+ieKhUj3YnrZvngVLL40Z8dCSon6jhko=
+gioui.org v0.0.0-20191014162007-f5e93206f602/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b h1:cAULFohNVfNzco0flF4okSPg3s7/tCj+hMIldtYZo4c=
 github.com/RadicalApp/complete v0.0.0-20170329192659-17e6c0ee499b/go.mod h1:zZ3+l0EkpT2ZPnoamPBG50PBUtQrXwwyJ6elQZMmqgk=