all: remove redundant op.TransformOp.Offset

Use op.Offset instead, or create and manipulate a f32.Affine2D.

API change. Update your code with a gofmt rule:

	gofmt -r 'op.TransformOp{}.Offset -> op.Offset'

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-21 22:41:56 +02:00
parent 9e3d3b6f58
commit 878131189b
11 changed files with 29 additions and 35 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ func (f Flex) Layout(gtx Context, children ...FlexChild) Dimensions {
}
}
stack := op.Push(gtx.Ops)
op.TransformOp{}.Offset(FPt(axisPoint(f.Axis, mainSize, cross))).Add(gtx.Ops)
op.Offset(FPt(axisPoint(f.Axis, mainSize, cross))).Add(gtx.Ops)
child.call.Add(gtx.Ops)
stack.Pop()
mainSize += axisMain(f.Axis, dims.Size)
+2 -2
View File
@@ -136,7 +136,7 @@ func (in Inset) Layout(gtx Context, w Widget) Dimensions {
mcs.Min.Y = mcs.Max.Y
}
stack := op.Push(gtx.Ops)
op.TransformOp{}.Offset(FPt(image.Point{X: left, Y: top})).Add(gtx.Ops)
op.Offset(FPt(image.Point{X: left, Y: top})).Add(gtx.Ops)
gtx.Constraints = mcs
dims := w(gtx)
stack.Pop()
@@ -180,7 +180,7 @@ func (a Direction) Layout(gtx Context, w Widget) Dimensions {
p.Y = sz.Y - dims.Size.Y
}
stack := op.Push(gtx.Ops)
op.TransformOp{}.Offset(FPt(p)).Add(gtx.Ops)
op.Offset(FPt(p)).Add(gtx.Ops)
call.Add(gtx.Ops)
stack.Pop()
return Dimensions{
+1 -1
View File
@@ -259,7 +259,7 @@ func (l *List) layout() Dimensions {
}
stack := op.Push(ops)
clip.Rect{Rect: FRect(r)}.Op(ops).Add(ops)
op.TransformOp{}.Offset(FPt(axisPoint(l.Axis, pos, cross))).Add(ops)
op.Offset(FPt(axisPoint(l.Axis, pos, cross))).Add(ops)
child.call.Add(ops)
stack.Pop()
pos += childSize
+1 -1
View File
@@ -108,7 +108,7 @@ func (s Stack) Layout(gtx Context, children ...StackChild) Dimensions {
p.Y = maxSZ.Y - sz.Y
}
stack := op.Push(gtx.Ops)
op.TransformOp{}.Offset(FPt(p)).Add(gtx.Ops)
op.Offset(FPt(p)).Add(gtx.Ops)
ch.call.Add(gtx.Ops)
stack.Pop()
if baseline == 0 {