mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user