mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
all: use new rectangle and point convenience functions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-5
@@ -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)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user