~whereswaldon/gio-x

fabadb41b212bd8905fb4aa948e7641fa12bda8f — Lothar May 5 months ago e2d994f
stroke: Update andybalholm/stroke and add triangular caps

This commit updates andybalholm/stroke to fix a panic with zero lenght paths https://github.com/andybalholm/stroke/issues/3 and to add triangular caps https://github.com/andybalholm/stroke/pull/5
The update is backwards compatible, I'm using it without modifying existing stroke code. The commit also adds triangular cap support to the stroke wrapper. This is also compatible with existing code.

Signed-off-by: Lothar May <business@lotharmay.de>
3 files changed, 10 insertions(+), 3 deletions(-)

M go.mod
M go.sum
M stroke/stroke.go
M go.mod => go.mod +1 -1
@@ 5,7 5,7 @@ go 1.18
require (
	gioui.org v0.0.0-20221219171716-c455f0f342ef
	git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0
	github.com/andybalholm/stroke v0.0.0-20220316233208-2609e58d58a5
	github.com/andybalholm/stroke v0.0.0-20221221101821-bd29b49d73f0
	github.com/esiqveland/notify v0.11.0
	github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4
	github.com/godbus/dbus/v5 v5.0.6

M go.sum => go.sum +2 -2
@@ 8,8 8,8 @@ gioui.org/shader v1.0.6 h1:cvZmU+eODFR2545X+/8XucgZdTtEjR3QWW6W65b0q5Y=
gioui.org/shader v1.0.6/go.mod h1:mWdiME581d/kV7/iEhLmUgUK5iZ09XR5XpduXzbePVM=
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0 h1:bGG/g4ypjrCJoSvFrP5hafr9PPB5aw8SjcOWWila7ZI=
git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0/go.mod h1:+axXBRUTIDlCeE73IKeD/os7LoEnTKdkp8/gQOFjqyo=
github.com/andybalholm/stroke v0.0.0-20220316233208-2609e58d58a5 h1:xxGjYr3zFgmxumkDiXyxiDD1Pdv1kmO0hewvTEOMlzQ=
github.com/andybalholm/stroke v0.0.0-20220316233208-2609e58d58a5/go.mod h1:ccdDYaY5+gO+cbnQdFxEXqfy0RkoV25H3jLXUDNM3wg=
github.com/andybalholm/stroke v0.0.0-20221221101821-bd29b49d73f0 h1:uF5Q/hWnDU1XZeT6CsrRSxHLroUSEYYO3kgES+yd+So=
github.com/andybalholm/stroke v0.0.0-20221221101821-bd29b49d73f0/go.mod h1:ccdDYaY5+gO+cbnQdFxEXqfy0RkoV25H3jLXUDNM3wg=
github.com/benoitkugler/pstokenizer v1.0.0/go.mod h1:l1G2Voirz0q/jj0TQfabNxVsa8HZXh/VMxFSRALWTiE=
github.com/benoitkugler/textlayout v0.3.0 h1:2ehWXEkgb6RUokTjXh1LzdGwG4dRP6X3dqhYYDYhUVk=
github.com/benoitkugler/textlayout v0.3.0/go.mod h1:o+1hFV+JSHBC9qNLIuwVoLedERU7sBPgEFcuSgfvi/w=

M stroke/stroke.go => stroke/stroke.go +7 -0
@@ 67,6 67,11 @@ const (
	// and left-hand sides of a stroked path with a half square of length
	// the stroked path's width.
	SquareCap

	// TriangularCap caps stroked paths with a triangular cap, joining the
	// right-hand and left-hand sides of a stroked path with a triangle
	// with height half of the stroked path's width.
	TriangularCap
)

// StrokeJoin describes how stroked paths are collated.


@@ 167,6 172,8 @@ func (s Stroke) Op(ops *op.Ops) clip.Op {
		opt.Cap = stroke.SquareCap
	case FlatCap:
		opt.Cap = stroke.FlatCap
	case TriangularCap:
		opt.Cap = stroke.TriangularCap
	}
	switch s.Join {
	case RoundJoin: