gpu,op/clip: encode lines as compute line commands, not quads

The new renderer supports lines natively; encode them as such and
convert them to a quadratic beziér.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-03-11 18:15:38 +01:00
parent a369c408f9
commit f1ae923a89
2 changed files with 21 additions and 2 deletions
+15
View File
@@ -1393,6 +1393,12 @@ func decodeToOutlineQuads(qs *quadSplitter, tr f32.Affine2D, pathData []byte) {
qs.contour = bo.Uint32(pathData)
cmd := ops.DecodeCommand(pathData[4:])
switch cmd.Op() {
case scene.OpFillLine:
var q quadSegment
q.From, q.To = scene.DecodeLine(cmd)
q.Ctrl = q.From.Add(q.To).Mul(.5)
q = q.Transform(tr)
qs.splitAndEncode(q)
case scene.OpFillQuad:
var q quadSegment
q.From, q.Ctrl, q.To = scene.DecodeQuad(cmd)
@@ -1413,6 +1419,15 @@ func decodeToStrokeQuads(pathData []byte) strokeQuads {
contour := bo.Uint32(pathData)
cmd := ops.DecodeCommand(pathData[4:])
switch cmd.Op() {
case scene.OpFillLine:
var q quadSegment
q.From, q.To = scene.DecodeLine(cmd)
q.Ctrl = q.From.Add(q.To).Mul(.5)
quad := strokeQuad{
contour: contour,
quad: q,
}
quads = append(quads, quad)
case scene.OpFillQuad:
var q quadSegment
q.From, q.Ctrl, q.To = scene.DecodeQuad(cmd)