mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
op/clip: handle zero Cube
Currently this comes up with RRect/Border that has zero corners. It improves them from ~250ns to ~170ns. While it's possible to check this in RRect implementation, however it'll slow down calls with non-zero corners. Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
@@ -251,6 +251,9 @@ func (p *Path) arc(alpha float64, c f32.Point, rx, ry, beg, delta float64) {
|
|||||||
// Cube records a cubic Bézier from the pen through
|
// Cube records a cubic Bézier from the pen through
|
||||||
// two control points ending in to.
|
// two control points ending in to.
|
||||||
func (p *Path) Cube(ctrl0, ctrl1, to f32.Point) {
|
func (p *Path) Cube(ctrl0, ctrl1, to f32.Point) {
|
||||||
|
if ctrl0 == (f32.Point{}) && ctrl1 == (f32.Point{}) && to == (f32.Point{}) {
|
||||||
|
return
|
||||||
|
}
|
||||||
ctrl0 = ctrl0.Add(p.pen)
|
ctrl0 = ctrl0.Add(p.pen)
|
||||||
ctrl1 = ctrl1.Add(p.pen)
|
ctrl1 = ctrl1.Add(p.pen)
|
||||||
to = to.Add(p.pen)
|
to = to.Add(p.pen)
|
||||||
|
|||||||
Reference in New Issue
Block a user