gpu: don't alias stroked paths with outline paths

The default renderer caches pre-processed paths for efficient re-use,
but failed to distinguish outline paths from stroke paths.

Fixes gio#294

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-10-20 09:59:07 +02:00
parent 9c16954bef
commit aac53ad0b5
3 changed files with 30 additions and 7 deletions
+22
View File
@@ -4,6 +4,7 @@ package rendertest
import (
"image"
"image/color"
"math"
"testing"
@@ -183,3 +184,24 @@ func TestStrokedPathZeroWidth(t *testing.T) {
r.expect(65, 50, transparent)
})
}
func TestPathReuse(t *testing.T) {
run(t, func(o *op.Ops) {
var path clip.Path
path.Begin(o)
path.MoveTo(f32.Pt(60, 10))
path.LineTo(f32.Pt(110, 75))
path.LineTo(f32.Pt(10, 75))
path.Close()
spec := path.End()
outline := clip.Outline{Path: spec}.Op().Push(o)
paint.Fill(o, color.NRGBA{R: 0xFF, A: 0xFF})
outline.Pop()
stroke := clip.Stroke{Path: spec, Width: 3}.Op().Push(o)
paint.Fill(o, color.NRGBA{B: 0xFF, A: 0xFF})
stroke.Pop()
}, func(r result) {
})
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB