all: use new rectangle and point convenience functions

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-19 10:39:20 +02:00
parent d82eb8fc66
commit 013ea395b4
11 changed files with 26 additions and 46 deletions
+1 -5
View File
@@ -35,13 +35,9 @@ func (im Image) Layout(gtx *layout.Context) {
d := cs.Constrain(image.Pt(w, h))
var s op.StackOp
s.Push(gtx.Ops)
clip.Rect{Rect: f32.Rectangle{Max: toPointF(d)}}.Op(gtx.Ops).Add(gtx.Ops)
clip.Rect{Rect: f32.Rectangle{Max: layout.FPt(d)}}.Op(gtx.Ops).Add(gtx.Ops)
im.Src.Add(gtx.Ops)
paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{X: float32(w), Y: float32(h)}}}.Add(gtx.Ops)
s.Pop()
gtx.Dimensions = layout.Dimensions{Size: d}
}
func toPointF(p image.Point) f32.Point {
return f32.Point{X: float32(p.X), Y: float32(p.Y)}
}