~eliasnaur/gio-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 3

[PATCH gio] op/clip: optimize zero corner radius in RRect

~pierrec
Details
Message ID
<161588408382.1075.9877552914558677967-0@git.sr.ht>
DKIM signature
missing
Download raw message
Patch: +7 -0
From: pierre <pierre.curto@gmail.com>

Signed-off-by: pierre <pierre.curto@gmail.com>
---
Not sure how to add a proper test.

 op/clip/shapes.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/op/clip/shapes.go b/op/clip/shapes.go
index c1a1d59..9a76dca 100644
--- a/op/clip/shapes.go
+++ b/op/clip/shapes.go
@@ -51,6 +51,13 @@ type RRect struct {

// Op returns the op for the rounded rectangle.
func (rr RRect) Op(ops *op.Ops) Op {
	if rr.SE == 0 && rr.SW == 0 && rr.NW == 0 && rr.NE == 0 {
		r := rr.Rect
		return Rect{
			Min: image.Point{X: int(r.Min.X), Y: int(r.Min.Y)},
			Max: image.Point{X: int(r.Max.X), Y: int(r.Max.Y)},
		}.Op()
	}
	return Outline{Path: rr.Path(ops)}.Op()
}

-- 
2.30.2

[gio/patches] build success

builds.sr.ht
Details
Message ID
<C9YNKPNPC0T4.OSPY60EU7ZRX@cirno>
In-Reply-To
<161588408382.1075.9877552914558677967-0@git.sr.ht> (view parent)
DKIM signature
missing
Download raw message
gio/patches: SUCCESS in 22m12s

[op/clip: optimize zero corner radius in RRect][0] from [~pierrec][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/21203
[1]: mailto:pierre.curto@gmail.com

✓ #460844 SUCCESS gio/patches/linux.yml   https://builds.sr.ht/~eliasnaur/job/460844
✓ #460845 SUCCESS gio/patches/openbsd.yml https://builds.sr.ht/~eliasnaur/job/460845
✓ #460843 SUCCESS gio/patches/freebsd.yml https://builds.sr.ht/~eliasnaur/job/460843
✓ #460842 SUCCESS gio/patches/apple.yml   https://builds.sr.ht/~eliasnaur/job/460842
Details
Message ID
<C9YNSQ6QTSXF.321YW86FXOPVI@themachine>
In-Reply-To
<161588408382.1075.9877552914558677967-0@git.sr.ht> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks, merged.
Details
Message ID
<CANtNKfoP=D8GchDuaEpnw1cNaCZqTErSQniu64wA7txr3b_Wsw@mail.gmail.com>
In-Reply-To
<161588408382.1075.9877552914558677967-0@git.sr.ht> (view parent)
DKIM signature
pass
Download raw message
This change doesn't look correct.

RRect may not be aligned to pixel boundaries whereas Rect is.
It would need an additional check to ensure that half-pixels are not lost.

On Tue, Mar 16, 2021 at 11:17 AM ~pierrec <pierrec@git.sr.ht> wrote:
>
> From: pierre <pierre.curto@gmail.com>
>
> Signed-off-by: pierre <pierre.curto@gmail.com>
> ---
> Not sure how to add a proper test.
>
>  op/clip/shapes.go | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/op/clip/shapes.go b/op/clip/shapes.go
> index c1a1d59..9a76dca 100644
> --- a/op/clip/shapes.go
> +++ b/op/clip/shapes.go
> @@ -51,6 +51,13 @@ type RRect struct {
>
>  // Op returns the op for the rounded rectangle.
>  func (rr RRect) Op(ops *op.Ops) Op {
> +       if rr.SE == 0 && rr.SW == 0 && rr.NW == 0 && rr.NE == 0 {
> +               r := rr.Rect
> +               return Rect{
> +                       Min: image.Point{X: int(r.Min.X), Y: int(r.Min.Y)},
> +                       Max: image.Point{X: int(r.Max.X), Y: int(r.Max.Y)},
> +               }.Op()
> +       }
>         return Outline{Path: rr.Path(ops)}.Op()
>  }
>
> --
> 2.30.2
Details
Message ID
<C9YON162VYZ4.367PDRCM3YWZN@testmac>
In-Reply-To
<CANtNKfoP=D8GchDuaEpnw1cNaCZqTErSQniu64wA7txr3b_Wsw@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Oops, thanks for noticing. I've dropped the patch from main.

Elias

On Tue Mar 16, 2021 at 10:19 CET, Egon Elbre wrote:
> This change doesn't look correct.
>
> RRect may not be aligned to pixel boundaries whereas Rect is.
> It would need an additional check to ensure that half-pixels are not lost.
>
> On Tue, Mar 16, 2021 at 11:17 AM ~pierrec <pierrec@git.sr.ht> wrote:
> >
> > From: pierre <pierre.curto@gmail.com>
> >
> > Signed-off-by: pierre <pierre.curto@gmail.com>
> > ---
> > Not sure how to add a proper test.
> >
> >  op/clip/shapes.go | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/op/clip/shapes.go b/op/clip/shapes.go
> > index c1a1d59..9a76dca 100644
> > --- a/op/clip/shapes.go
> > +++ b/op/clip/shapes.go
> > @@ -51,6 +51,13 @@ type RRect struct {
> >
> >  // Op returns the op for the rounded rectangle.
> >  func (rr RRect) Op(ops *op.Ops) Op {
> > +       if rr.SE == 0 && rr.SW == 0 && rr.NW == 0 && rr.NE == 0 {
> > +               r := rr.Rect
> > +               return Rect{
> > +                       Min: image.Point{X: int(r.Min.X), Y: int(r.Min.Y)},
> > +                       Max: image.Point{X: int(r.Max.X), Y: int(r.Max.Y)},
> > +               }.Op()
> > +       }
> >         return Outline{Path: rr.Path(ops)}.Op()
> >  }
> >
> > --
> > 2.30.2
Reply to thread Export thread (mbox)