diff options
author | yhardy <yhardy@pkgsrc.org> | 2019-10-02 18:55:33 +0000 |
---|---|---|
committer | yhardy <yhardy@pkgsrc.org> | 2019-10-02 18:55:33 +0000 |
commit | d70644abb54fd64ed2fbae15a533241c267e8836 (patch) | |
tree | d0252e955abb3fa0ff172209c276521b3ff8efc3 /editors | |
parent | dccd3b675b76a61c83e0a55e04ca7bb16ae6d419 (diff) | |
download | pkgsrc-d70644abb54fd64ed2fbae15a533241c267e8836.tar.gz |
editors/xournal: add patch to smooth input coordinates
On NetBSD, absolute coordinate changes are reported as an X value
followed by a Y value, which (when moving quickly) leads to a
"stepping" effect. Using a Bezier curve fitting for the points
yields a smooth curve in most cases, and does not seem to adversely
affect the user experience (even with a conventional mouse).
Diffstat (limited to 'editors')
-rw-r--r-- | editors/xournal/distinfo | 3 | ||||
-rw-r--r-- | editors/xournal/patches/patch-src_xo-paint.c | 46 |
2 files changed, 48 insertions, 1 deletions
diff --git a/editors/xournal/distinfo b/editors/xournal/distinfo index c05c564fcad..394f147fb1b 100644 --- a/editors/xournal/distinfo +++ b/editors/xournal/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.7 2019/10/01 22:59:01 yhardy Exp $ +$NetBSD: distinfo,v 1.8 2019/10/02 18:55:33 yhardy Exp $ SHA1 (xournal-0.4.8.2016.tar.gz) = a08d0fde395ea95570e560295df5f97be3c3a6e2 RMD160 (xournal-0.4.8.2016.tar.gz) = 36a0b2bb848d4801e2b00cf2cd58c8f847488c5d SHA512 (xournal-0.4.8.2016.tar.gz) = 1426d5c9ba3486fbe342d49fc19fcc162965cd6a7b7754f79665e43fe0e60e6f42f61969405ace78fdaa7b99cbb3d4b07b7fb5df246d68a329b52084b6eec76e Size (xournal-0.4.8.2016.tar.gz) = 646082 bytes +SHA1 (patch-src_xo-paint.c) = 0c708b9aa0cb65be0c9817f09f9c78eb4e29568b SHA1 (patch-src_xo-shapes.c) = ab5a56780dd6fa37a3b51f89468c6100137454f3 diff --git a/editors/xournal/patches/patch-src_xo-paint.c b/editors/xournal/patches/patch-src_xo-paint.c new file mode 100644 index 00000000000..1b8b09e8e28 --- /dev/null +++ b/editors/xournal/patches/patch-src_xo-paint.c @@ -0,0 +1,46 @@ +$NetBSD: patch-src_xo-paint.c,v 1.1 2019/10/02 18:55:34 yhardy Exp $ + +On NetBSD, absolute coordinate changes are reported as an X value +followed by a Y value, which (when moving quickly) leads to a +"stepping" effect. Using a Bezier curve fitting for the points +yields a smooth curve in most cases, and does not seem to adversely +affect the user experience (even with a conventional mouse). + +--- src/xo-paint.c.orig 2015-08-11 03:47:11.000000000 +0000 ++++ src/xo-paint.c +@@ -249,6 +249,9 @@ void continue_stroke(GdkEvent *event) + { + GnomeCanvasPoints seg; + double *pt, current_width, pressure; ++#if defined(__NetBSD__) || defined(__OpenBSD__) ++ double d, dp, t; ++#endif + + if (ui.cur_brush->ruler) { + pt = ui.cur_path.coords; +@@ -280,7 +283,25 @@ void continue_stroke(GdkEvent *event) + ui.cur_path.num_points++; + } + ++#if defined(__NetBSD__) || defined(__OpenBSD__) ++ if(ui.cur_path.num_points < 3) ++ return; ++ ++ // treat this point as an end point ++ // treat the previous point as a control point and recalculate the "actual" point ++ dp = hypot(pt[0] - pt[-2], pt[1] - pt[-1]); ++ d = dp + hypot(pt[0] - pt[2], pt[1] - pt[3]); ++ if(d != 0) { ++ t = dp/d; ++ // Bezier curve fitting ++ pt[0] = (1-t)*(1-t)*pt[-2] + 2*t*(1-t)*pt[0] + t*t*pt[2]; ++ pt[1] = (1-t)*(1-t)*pt[-1] + 2*t*(1-t)*pt[1] + t*t*pt[3]; ++ } ++ ++ seg.coords = pt-2; ++#else + seg.coords = pt; ++#endif + seg.num_points = 2; + seg.ref_count = 1; + |