mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
op/clip: replace Rect and RoundRect with Rect type
Remembering the order of the corners in the RoundRect is difficult, which suggest that RoundRect should be a struct with named fields. Do that, and make Rect the special case where corner radii are all zero. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -37,7 +37,7 @@ func (im Image) Layout(gtx *layout.Context) {
|
||||
d := image.Point{X: cs.Width.Constrain(w), Y: cs.Height.Constrain(h)}
|
||||
var s op.StackOp
|
||||
s.Push(gtx.Ops)
|
||||
clip.Rect(gtx.Ops, f32.Rectangle{Max: toPointF(d)}).Add(gtx.Ops)
|
||||
clip.Rect{Rect: f32.Rectangle{Max: toPointF(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()
|
||||
|
||||
Reference in New Issue
Block a user