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:
Elias Naur
2021-03-23 12:35:41 +01:00
parent 8750828c69
commit 8c8d1dc16f
5 changed files with 185 additions and 179 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ package gpu
import (
"gioui.org/f32"
"gioui.org/internal/stroke"
)
type quadSplitter struct {
@@ -46,7 +47,7 @@ func (qs *quadSplitter) encodeQuadTo(from, ctrl, to f32.Point) {
encodeQuadTo(data, qs.contour, from, ctrl, to)
}
func (qs *quadSplitter) splitAndEncode(quad quadSegment) {
func (qs *quadSplitter) splitAndEncode(quad stroke.QuadSegment) {
cbnd := f32.Rectangle{
Min: quad.From,
Max: quad.To,