pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/editors/xournal editors/xournal: add patch to smooth i...
details: https://anonhg.NetBSD.org/pkgsrc/rev/f70900d34a17
branches: trunk
changeset: 402010:f70900d34a17
user: yhardy <yhardy%pkgsrc.org@localhost>
date: Wed Oct 02 18:55:33 2019 +0000
description:
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:
editors/xournal/distinfo | 3 +-
editors/xournal/patches/patch-src_xo-paint.c | 46 ++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletions(-)
diffs (63 lines):
diff -r b93e6991fba2 -r f70900d34a17 editors/xournal/distinfo
--- a/editors/xournal/distinfo Wed Oct 02 18:15:13 2019 +0000
+++ b/editors/xournal/distinfo Wed Oct 02 18:55:33 2019 +0000
@@ -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 -r b93e6991fba2 -r f70900d34a17 editors/xournal/patches/patch-src_xo-paint.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/editors/xournal/patches/patch-src_xo-paint.c Wed Oct 02 18:55:33 2019 +0000
@@ -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;
+
Home |
Main Index |
Thread Index |
Old Index