mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
op: change CallOp to be a return value from MacroOp.Stop
Converting macro := op.Record(ops) ... macro.Stop() macro.Add() to macro := op.Record(ops) ... call := macro.Stop() call.Add(ops) Which is more general (call.Add can take a different ops than the op.Record that started it), and enforced the order between Stop and the subsequent Add. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-4
@@ -35,12 +35,12 @@ type Path struct {
|
||||
// If you need to reset the clip to its previous values after
|
||||
// applying a Op, use op.StackOp.
|
||||
type Op struct {
|
||||
macro op.MacroOp
|
||||
call op.CallOp
|
||||
bounds f32.Rectangle
|
||||
}
|
||||
|
||||
func (p Op) Add(o *op.Ops) {
|
||||
p.macro.Add()
|
||||
p.call.Add(o)
|
||||
data := o.Write(opconst.TypeClipLen)
|
||||
data[0] = byte(opconst.TypeClip)
|
||||
bo := binary.LittleEndian
|
||||
@@ -281,9 +281,9 @@ func (p *Path) simpleQuadTo(ctrl, to f32.Point) {
|
||||
// End the path and return a clip operation that represents it.
|
||||
func (p *Path) End() Op {
|
||||
p.end()
|
||||
p.macro.Stop()
|
||||
c := p.macro.Stop()
|
||||
return Op{
|
||||
macro: p.macro,
|
||||
call: c,
|
||||
bounds: p.bounds,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user