diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-16 21:52:50 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-16 21:52:50 -0400 |
| commit | 7c3647712b38e08a8f0daa970ab1a2b0857df8b0 (patch) | |
| tree | 570bec783c588d9a899c87289339a1eb30a9017b /test | |
| parent | ae554f10c3b652a3dfe765fd63107237e9aafa28 (diff) | |
Updated the test program to the new AreaHandler interface. The deadlock still happens... just not so easily... so it's elsewhere...
Diffstat (limited to 'test')
| -rw-r--r-- | test/main.go | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/test/main.go b/test/main.go index d8b69c7..e032aca 100644 --- a/test/main.go +++ b/test/main.go @@ -116,6 +116,24 @@ func invalidTest(c *Combobox, l *Listbox, s *Stack, g *Grid) { var invalidBefore = flag.Bool("invalid", false, "run invalid test before opening window") +type areaHandler struct { + img *image.NRGBA +} +func (a *areaHandler) Paint(rect image.Rectangle) *image.NRGBA { +fmt.Println(rect) +/* + req.Out <- img[i].SubImage(req.Rect).(*image.NRGBA) + if lastrect != req.Rect { + lastrect = req.Rect + i = 1 - i + } +*/ + return a.img.SubImage(rect).(*image.NRGBA) +} +func (a *areaHandler) Mouse(e MouseEvent) { + fmt.Printf("%#v\n", e) +} + var doArea = flag.Bool("area", false, "run area test instead") func areaTest() { /* @@ -136,7 +154,9 @@ func areaTest() { img := image.NewNRGBA(ximg.Bounds()) draw.Draw(img, img.Rect, ximg, image.ZP, draw.Over) w := NewWindow("Area Test", 100, 100) - a := NewArea() + a := NewArea(&areaHandler{ + img: img, + }) timedisp := NewLabel("") timechan := time.Tick(time.Second) layout := NewVerticalStack(a, @@ -152,18 +172,6 @@ func areaTest() { return case t := <-timechan: timedisp.SetText(t.String()) - case req := <-a.Paint: -fmt.Println(req) -/* - req.Out <- img[i].SubImage(req.Rect).(*image.NRGBA) - if lastrect != req.Rect { - lastrect = req.Rect - i = 1 - i - } -*/ - req.Out <- img.SubImage(req.Rect).(*image.NRGBA) - case e := <-a.Mouse: - fmt.Printf("%#v\n", e) } } } |
