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 -7
View File
@@ -39,7 +39,7 @@ The StackOp saves the current state to the state stack and restores it later:
// Save the current state, in particular the transform.
stack := op.Push(ops)
// Apply a transform to subsequent operations.
op.TransformOp{}.Offset(...).Add(ops)
op.Offset(...).Add(ops)
...
// Restore the previous transform.
stack.Pop()
@@ -274,12 +274,6 @@ func Affine(a f32.Affine2D) TransformOp {
return TransformOp{t: a}
}
// Offset the transfomraiton.
func (t TransformOp) Offset(o f32.Point) TransformOp {
t.t = t.t.Offset(o)
return t
}
func (t TransformOp) Add(o *Ops) {
data := o.Write(opconst.TypeTransformLen)
data[0] = byte(opconst.TypeTransform)