mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
cmd,example: fix uses of color.NRGBA
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module gioui.org/cmd
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
gioui.org v0.0.0-20201105153338-edaa112c40df
|
||||
gioui.org v0.0.0-20201119103011-21ef492cc9df
|
||||
github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4
|
||||
github.com/chromedp/chromedp v0.5.2
|
||||
golang.org/x/image v0.0.0-20200618115811-c13761719519
|
||||
|
||||
+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-20201105153338-edaa112c40df h1:GfuHya3d2IqsgScxQ5RHaz2n4y3KnGPv+ogcs1l7ZCY=
|
||||
gioui.org v0.0.0-20201105153338-edaa112c40df/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
|
||||
gioui.org v0.0.0-20201119103011-21ef492cc9df h1:rbPrGAuu3VRB5ip6X8v1NN+P79oWEBGWYEI+Qreqvpg=
|
||||
gioui.org v0.0.0-20201119103011-21ef492cc9df/go.mod h1:Y+uS7hHMvku1Q+ooaoq6fYD5B2LGoT8JtFgvmYmRzTw=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4 h1:QD3KxSJ59L2lxG6MXBjNHxiQO2RmxTQ3XcK+wO44WOg=
|
||||
github.com/chromedp/cdproto v0.0.0-20191114225735-6626966fbae4/go.mod h1:PfAWWKJqjlGFYJEidUM6aVIWPr0EpobeyVWEEmplX7g=
|
||||
|
||||
@@ -96,11 +96,11 @@ func runEndToEndTest(t *testing.T, driver TestDriver) {
|
||||
t.Log("starting driver and gio app")
|
||||
driver.Start("testdata/red.go")
|
||||
|
||||
beef := color.RGBA{R: 0xde, G: 0xad, B: 0xbe}
|
||||
white := color.RGBA{R: 0xff, G: 0xff, B: 0xff}
|
||||
black := color.RGBA{R: 0x00, G: 0x00, B: 0x00}
|
||||
gray := color.RGBA{R: 0xbb, G: 0xbb, B: 0xbb}
|
||||
red := color.RGBA{R: 0xff, G: 0x00, B: 0x00}
|
||||
beef := color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff}
|
||||
white := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
|
||||
black := color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff}
|
||||
gray := color.NRGBA{R: 0xbb, G: 0xbb, B: 0xbb, A: 0xff}
|
||||
red := color.NRGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
|
||||
|
||||
// These are the four colors at the beginning.
|
||||
t.Log("taking initial screenshot")
|
||||
@@ -181,7 +181,7 @@ func (m colorMismatch) String() string {
|
||||
)
|
||||
}
|
||||
|
||||
func checkImageCorners(img image.Image, topLeft, topRight, botLeft, botRight color.RGBA) error {
|
||||
func checkImageCorners(img image.Image, topLeft, topRight, botLeft, botRight color.Color) error {
|
||||
// The colors are split in four rectangular sections. Check the corners
|
||||
// of each of the sections. We check the corners left to right, top to
|
||||
// bottom, like when reading left-to-right text.
|
||||
|
||||
Vendored
+7
-7
@@ -47,16 +47,16 @@ type (
|
||||
|
||||
func loop(w *app.Window) error {
|
||||
topLeft := quarterWidget{
|
||||
color: color.RGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff},
|
||||
color: color.NRGBA{R: 0xde, G: 0xad, B: 0xbe, A: 0xff},
|
||||
}
|
||||
topRight := quarterWidget{
|
||||
color: color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff},
|
||||
color: color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff},
|
||||
}
|
||||
botLeft := quarterWidget{
|
||||
color: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff},
|
||||
color: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xff},
|
||||
}
|
||||
botRight := quarterWidget{
|
||||
color: color.RGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x80},
|
||||
color: color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0x80},
|
||||
}
|
||||
|
||||
var ops op.Ops
|
||||
@@ -103,15 +103,15 @@ func loop(w *app.Window) error {
|
||||
// quarterWidget paints a quarter of the screen with one color. When clicked, it
|
||||
// turns red, going back to its normal color when clicked again.
|
||||
type quarterWidget struct {
|
||||
color color.RGBA
|
||||
color color.NRGBA
|
||||
|
||||
clicked bool
|
||||
}
|
||||
|
||||
var red = color.RGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
|
||||
var red = color.NRGBA{R: 0xff, G: 0x00, B: 0x00, A: 0xff}
|
||||
|
||||
func (w *quarterWidget) Layout(gtx layout.Context) layout.Dimensions {
|
||||
var color color.RGBA
|
||||
var color color.NRGBA
|
||||
if w.clicked {
|
||||
color = red
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user