mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
op: remove operation list argument from MacroOp.Add
The ability to invoke other operation lists belongs in the new CallOp. While we're here, make MacroOp.Add use a pointer receiver to match the other methods. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ type Op struct {
|
||||
}
|
||||
|
||||
func (p Op) Add(o *op.Ops) {
|
||||
p.macro.Add(o)
|
||||
p.macro.Add()
|
||||
data := o.Write(opconst.TypeClipLen)
|
||||
data[0] = byte(opconst.TypeClip)
|
||||
bo := binary.LittleEndian
|
||||
|
||||
@@ -63,7 +63,7 @@ The MacroOp records a list of operations to be executed later:
|
||||
macro.Stop()
|
||||
|
||||
// replay the recorded operations by calling Add:
|
||||
macro.Add(ops)
|
||||
macro.Add()
|
||||
|
||||
*/
|
||||
package op
|
||||
@@ -106,7 +106,6 @@ type StackOp struct {
|
||||
type MacroOp struct {
|
||||
recording bool
|
||||
ops *Ops
|
||||
version int
|
||||
id stackID
|
||||
pc pc
|
||||
}
|
||||
@@ -255,25 +254,21 @@ func (m *MacroOp) fill() {
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[1:], uint32(pc.data))
|
||||
bo.PutUint32(data[5:], uint32(pc.refs))
|
||||
m.version = m.ops.version
|
||||
}
|
||||
|
||||
// Add the recorded list of operations. The Ops
|
||||
// argument may be different than the Ops argument
|
||||
// passed to Record.
|
||||
func (m MacroOp) Add(o *Ops) {
|
||||
// Add the recorded list of operations.
|
||||
func (m *MacroOp) Add() {
|
||||
if m.recording {
|
||||
panic("a recording is in progress")
|
||||
}
|
||||
if m.ops == nil {
|
||||
return
|
||||
}
|
||||
data := o.Write(opconst.TypeMacroLen, m.ops)
|
||||
data := m.ops.Write(opconst.TypeMacroLen)
|
||||
data[0] = byte(opconst.TypeMacro)
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[1:], uint32(m.pc.data))
|
||||
bo.PutUint32(data[5:], uint32(m.pc.refs))
|
||||
bo.PutUint32(data[9:], uint32(m.version))
|
||||
}
|
||||
|
||||
func (r InvalidateOp) Add(o *Ops) {
|
||||
|
||||
Reference in New Issue
Block a user