mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
op/clip: prevent no-op path segments
This commit prevents the insertion of LineTo and QuadTo path segments that have no visible effect on the path (because the path's pen is already at their end state). This eliminates whisker artifacts from some stroked paths. Thanks to Morlay for the bug report leading to this fix. Fixes: https://todo.sr.ht/~eliasnaur/gio/535 Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -204,6 +204,9 @@ func (p *Path) Line(delta f32.Point) {
|
||||
|
||||
// LineTo moves the pen to the absolute point specified, recording a line.
|
||||
func (p *Path) LineTo(to f32.Point) {
|
||||
if to == p.pen {
|
||||
return
|
||||
}
|
||||
data := ops.WriteMulti(p.ops, scene.CommandSize+4)
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[0:], uint32(p.contour))
|
||||
@@ -250,6 +253,9 @@ func (p *Path) Quad(ctrl, to f32.Point) {
|
||||
// QuadTo records a quadratic Bézier from the pen to end
|
||||
// with the control point ctrl, with absolute coordinates.
|
||||
func (p *Path) QuadTo(ctrl, to f32.Point) {
|
||||
if ctrl == p.pen && to == p.pen {
|
||||
return
|
||||
}
|
||||
data := ops.WriteMulti(p.ops, scene.CommandSize+4)
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[0:], uint32(p.contour))
|
||||
|
||||
Reference in New Issue
Block a user