mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +00:00
internal/stroke,gpu: create internal package for stroke to path conversion
Complex strokes are not yet supported in either of the current renderers, so they are converted to filled outlines in package gpu. We're about to move that complexity up to the op/clip package, so we're going to need the converter available from outside package gpu. This change extracts the conversion code and related types to the separate, internal package stroke. No functional changes; a follow-up moves the stroke conversion. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-3
@@ -18,6 +18,7 @@ import (
|
||||
"gioui.org/internal/f32color"
|
||||
"gioui.org/internal/ops"
|
||||
"gioui.org/internal/scene"
|
||||
"gioui.org/internal/stroke"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/clip"
|
||||
@@ -695,7 +696,7 @@ func (g *compute) encodeClipStack(clip, bounds f32.Rectangle, p *pathOp, begin b
|
||||
}
|
||||
|
||||
func supportsStroke(p *pathOp) bool {
|
||||
return isSolidLine(p.dashes) && p.stroke.Miter == 0 && p.stroke.Join == clip.RoundJoin && p.stroke.Cap == clip.RoundCap
|
||||
return stroke.IsSolidLine(p.dashes) && p.stroke.Miter == 0 && p.stroke.Join == clip.RoundJoin && p.stroke.Cap == clip.RoundCap
|
||||
}
|
||||
|
||||
func isStroke(p *pathOp) bool {
|
||||
@@ -707,9 +708,9 @@ func encodePath(p *pathOp) encoder {
|
||||
verts := p.pathVerts
|
||||
if p.stroke.Width > 0 && !supportsStroke(p) {
|
||||
quads := decodeToStrokeQuads(verts)
|
||||
quads = quads.stroke(p.stroke, p.dashes)
|
||||
quads = quads.Stroke(p.stroke, p.dashes)
|
||||
for _, quad := range quads {
|
||||
q := quad.quad
|
||||
q := quad.Quad
|
||||
enc.quad(q.From, q.Ctrl, q.To)
|
||||
}
|
||||
return enc
|
||||
|
||||
Reference in New Issue
Block a user