pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/editors/xournal



Module Name:    pkgsrc
Committed By:   yhardy
Date:           Wed Oct  2 18:55:34 UTC 2019

Modified Files:
        pkgsrc/editors/xournal: distinfo
Added Files:
        pkgsrc/editors/xournal/patches: patch-src_xo-paint.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 pkgsrc/editors/xournal/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/editors/xournal/patches/patch-src_xo-paint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/editors/xournal/distinfo
diff -u pkgsrc/editors/xournal/distinfo:1.7 pkgsrc/editors/xournal/distinfo:1.8
--- pkgsrc/editors/xournal/distinfo:1.7 Tue Oct  1 22:59:01 2019
+++ pkgsrc/editors/xournal/distinfo     Wed Oct  2 18:55:33 2019
@@ -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

Added files:

Index: pkgsrc/editors/xournal/patches/patch-src_xo-paint.c
diff -u /dev/null pkgsrc/editors/xournal/patches/patch-src_xo-paint.c:1.1
--- /dev/null   Wed Oct  2 18:55:34 2019
+++ pkgsrc/editors/xournal/patches/patch-src_xo-paint.c Wed Oct  2 18:55:34 2019
@@ -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