~eliasnaur/gio-patches

gio: op/clip: optimize zero corner radius in RRect v1 PROPOSED

~pierrec
~pierrec: 1
 op/clip: optimize zero corner radius in RRect

 1 files changed, 7 insertions(+), 0 deletions(-)
#460842 apple.yml success
#460843 freebsd.yml success
#460844 linux.yml success
#460845 openbsd.yml success
Oops, thanks for noticing. I've dropped the patch from main.

Elias

On Tue Mar 16, 2021 at 10:19 CET, Egon Elbre wrote:
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/21203/mbox | git am -3
Learn more about email & git
View this thread in the archives

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

~pierrec
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
builds.sr.ht
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
Thanks, merged.
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: