gpu,op/clip: implement dashed stroked paths

Signed-off-by: Sebastien Binet <s@sbinet.org>
This commit is contained in:
Sebastien Binet
2020-12-09 09:59:46 +00:00
committed by Elias Naur
parent ac14320bec
commit e71bf13c9a
14 changed files with 745 additions and 7 deletions
+10
View File
@@ -21,6 +21,7 @@ type Op struct {
outline bool
stroke StrokeStyle
dashes DashSpec
}
func (p Op) Add(o *op.Ops) {
@@ -42,6 +43,15 @@ func (p Op) Add(o *op.Ops) {
data[10] = uint8(p.stroke.Join)
}
if p.dashes.phase != 0 || p.dashes.size > 0 {
data := o.Write(opconst.TypeDashLen)
data[0] = byte(opconst.TypeDash)
bo := binary.LittleEndian
bo.PutUint32(data[1:], math.Float32bits(p.dashes.phase))
data[5] = p.dashes.size // FIXME(sbinet) uint16? uint32?
p.dashes.spec.Add(o)
}
data := o.Write(opconst.TypeClipLen)
data[0] = byte(opconst.TypeClip)
bo := binary.LittleEndian