op/clip,gpu,internal/opconst: remove quad count from Path op

The check for path segments in gpu is redundant; clip.Op.Add doesn't add
the Path op if there were no segments.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-11 18:11:28 +01:00
parent 2328ddfeca
commit b8bdb96d35
3 changed files with 23 additions and 37 deletions
+7 -20
View File
@@ -168,18 +168,8 @@ func decodeStrokeOp(data []byte) clip.StrokeStyle {
}
type quadsOp struct {
quads uint32
key ops.Key
aux []byte
}
func decodeQuadsOp(data []byte) uint32 {
_ = data[:1+4]
if opconst.OpType(data[0]) != opconst.TypePath {
panic("invalid op")
}
bo := binary.LittleEndian
return bo.Uint32(data[1:])
key ops.Key
aux []byte
}
type material struct {
@@ -922,15 +912,12 @@ loop:
stroke = decodeStrokeOp(encOp.Data)
case opconst.TypePath:
quads.quads = decodeQuadsOp(encOp.Data)
if quads.quads > 0 {
encOp, ok = r.Decode()
if !ok {
break loop
}
quads.aux = encOp.Data[opconst.TypeAuxLen:]
quads.key = encOp.Key
encOp, ok = r.Decode()
if !ok {
break loop
}
quads.aux = encOp.Data[opconst.TypeAuxLen:]
quads.key = encOp.Key
case opconst.TypeClip:
var op clipOp