mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
op/clip: don't panic when Path is used without an initial MoveTo
A Path initialized with Begin should be ready to use with its pen at (0, 0). Make it so. Updates gio#311 Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
+5
-3
@@ -124,10 +124,12 @@ func (p *Path) Pos() f32.Point { return p.pen }
|
||||
|
||||
// Begin the path, storing the path data and final Op into ops.
|
||||
func (p *Path) Begin(o *op.Ops) {
|
||||
*p = Path{
|
||||
ops: &o.Internal,
|
||||
macro: op.Record(o),
|
||||
contour: 1,
|
||||
}
|
||||
p.hash.SetSeed(pathSeed)
|
||||
p.ops = &o.Internal
|
||||
p.macro = op.Record(o)
|
||||
// Write the TypeAux opcode
|
||||
data := ops.Write(p.ops, ops.TypeAuxLen)
|
||||
data[0] = byte(ops.TypeAux)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user