mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 08:25:34 +00:00
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:
@@ -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 |
Reference in New Issue
Block a user