apps/gophers: update to latest gio api

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-07-02 14:58:00 +02:00
parent 33fc35f58d
commit 6fdab9dba6
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/apps
go 1.12 go 1.12
require ( require (
gioui.org/ui v0.0.0-20190701113654-d720fa62331a gioui.org/ui v0.0.0-20190702125648-33fc35f58db8
github.com/google/go-github/v24 v24.0.1 github.com/google/go-github/v24 v24.0.1
golang.org/x/exp v0.0.0-20190321205749-f0864edee7f3 golang.org/x/exp v0.0.0-20190321205749-f0864edee7f3
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f
+6 -6
View File
@@ -375,12 +375,12 @@ var (
accentColor = rgb(0x00c28c) accentColor = rgb(0x00c28c)
) )
func rgb(c uint32) color.NRGBA { func rgb(c uint32) color.RGBA {
return argb((0xff << 24) | c) return argb((0xff << 24) | c)
} }
func argb(c uint32) color.NRGBA { func argb(c uint32) color.RGBA {
return color.NRGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)} return color.RGBA{A: uint8(c >> 24), R: uint8(c >> 16), G: uint8(c >> 8), B: uint8(c)}
} }
func (a *App) face(f *sfnt.Font, size float32) text.Face { func (a *App) face(f *sfnt.Font, size float32) text.Face {
@@ -638,7 +638,7 @@ func (a *App) user(ops *ui.Ops, cs layout.Constraints, c *ui.Config, index int)
} }
type fill struct { type fill struct {
color color.NRGBA color color.RGBA
} }
func (f fill) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens { func (f fill) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
@@ -695,7 +695,7 @@ func (c *clipCircle) End(dims layout.Dimens) layout.Dimens {
return dims return dims
} }
func fab(ops *ui.Ops, cs layout.Constraints, ico image.Image, col color.NRGBA, size float32) layout.Dimens { func fab(ops *ui.Ops, cs layout.Constraints, ico image.Image, col color.RGBA, size float32) layout.Dimens {
sz := int(size + .5) sz := int(size + .5)
rr := size * .5 rr := size * .5
dp := image.Point{X: (sz - ico.Bounds().Dx()) / 2, Y: (sz - ico.Bounds().Dy()) / 2} dp := image.Point{X: (sz - ico.Bounds().Dx()) / 2, Y: (sz - ico.Bounds().Dy()) / 2}
@@ -724,7 +724,7 @@ func (ic *icon) image(cfg *ui.Config) image.Image {
} }
m, _ := iconvg.DecodeMetadata(ic.src) m, _ := iconvg.DecodeMetadata(ic.src)
dx, dy := m.ViewBox.AspectRatio() dx, dy := m.ViewBox.AspectRatio()
img := image.NewNRGBA(image.Rectangle{Max: image.Point{X: int(sz), Y: int(sz * dy / dx)}}) img := image.NewRGBA(image.Rectangle{Max: image.Point{X: int(sz), Y: int(sz * dy / dx)}})
var ico iconvg.Rasterizer var ico iconvg.Rasterizer
ico.SetDstImage(img, img.Bounds(), draw.Src) ico.SetDstImage(img, img.Bounds(), draw.Src)
// Use white for icons. // Use white for icons.