gpu: [compute] skip encoding roundtrip for path data

Since clip.Path now encodes paths in the format expected by
elements.comp, use that data directly instead of a roundtrip through
drawOps.buildVerts.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-11 15:58:33 +01:00
parent eb9bf60b09
commit a369c408f9
5 changed files with 103 additions and 57 deletions
+2 -6
View File
@@ -8,8 +8,8 @@ import (
"math"
"gioui.org/f32"
"gioui.org/internal/byteslice"
"gioui.org/internal/opconst"
"gioui.org/internal/ops"
"gioui.org/internal/scene"
"gioui.org/op"
)
@@ -156,7 +156,7 @@ func (p *Path) QuadTo(ctrl, to f32.Point) {
data := p.ops.Write(scene.CommandSize + 4)
bo := binary.LittleEndian
bo.PutUint32(data[0:], uint32(p.contour))
encodeCommand(data[4:], scene.Quad(p.pen, ctrl, to, false))
ops.EncodeCommand(data[4:], scene.Quad(p.pen, ctrl, to, false))
p.pen = to
p.hasSegments = true
}
@@ -392,7 +392,3 @@ func (o Outline) Op() Op {
outline: true,
}
}
func encodeCommand(out []byte, cmd scene.Command) {
copy(out, byteslice.Uint32(cmd[:]))
}