Index: app/paint/gimpink.c
===================================================================
RCS file: /cvs/gnome/gimp/app/paint/gimpink.c,v
retrieving revision 1.144.2.1
diff -u -p -r1.144.2.1 gimpink.c
--- app/paint/gimpink.c	14 Jan 2005 20:22:46 -0000	1.144.2.1
+++ app/paint/gimpink.c	21 Mar 2005 22:01:31 -0000
@@ -76,9 +76,10 @@ static Blob    * ink_pen_ellipse        
 
 static void      time_smoother_add       (GimpInk          *ink,
                                           guint32           value);
-static gdouble   time_smoother_result    (GimpInk          *ink);
+static guint32   time_smoother_result    (GimpInk          *ink);
 static void      time_smoother_init      (GimpInk          *ink,
                                           guint32           initval);
+
 static void      dist_smoother_add       (GimpInk          *ink,
                                           gdouble           value);
 static gdouble   dist_smoother_result    (GimpInk          *ink);
@@ -298,7 +299,7 @@ gimp_ink_motion (GimpPaintCore    *paint
   else
     {
       Blob    *blob;
-      gdouble  lasttime, thistime;
+      guint32  lasttime, thistime;
       gdouble  dist;
       gdouble  velocity;
 
@@ -519,84 +520,82 @@ ink_pen_ellipse (GimpInkOptions *options
                             radmin * tcos);
 }
 
+
 static void
-dist_smoother_init (GimpInk *ink,
-                    gdouble  initval)
+time_smoother_init (GimpInk *ink,
+                    guint32  initval)
 {
   gint i;
 
-  ink->dt_index = 0;
+  ink->ts_index = 0;
 
-  for (i = 0; i < DIST_SMOOTHER_BUFFER; i++)
-    {
-      ink->dt_buffer[i] = initval;
-    }
+  for (i = 0; i < TIME_SMOOTHER_BUFFER; i++)
+    ink->ts_buffer[i] = initval;
 }
 
-static gdouble
-dist_smoother_result (GimpInk *ink)
+static guint32
+time_smoother_result (GimpInk *ink)
 {
   gint    i;
-  gdouble result = 0.0;
+  guint64 result = 0;
 
-  for (i = 0; i < DIST_SMOOTHER_BUFFER; i++)
-    {
-      result += ink->dt_buffer[i];
-    }
+  for (i = 0; i < TIME_SMOOTHER_BUFFER; i++)
+    result += ink->ts_buffer[i];
 
-  return (result / (gdouble) DIST_SMOOTHER_BUFFER);
+  return (result / (guint64) TIME_SMOOTHER_BUFFER);
 }
 
 static void
-dist_smoother_add (GimpInk *ink,
-                   gdouble  value)
+time_smoother_add (GimpInk *ink,
+                   guint32  value)
 {
-  ink->dt_buffer[ink->dt_index] = value;
+  guint64 long_value = (guint64) value;
 
-  if ((++ink->dt_index) == DIST_SMOOTHER_BUFFER)
-    ink->dt_index = 0;
+  /*  handle wrap-around of time values  */
+  if (long_value < ink->ts_buffer[ink->ts_index])
+    long_value += (guint64) + G_MAXUINT32;
+
+  ink->ts_buffer[ink->ts_index++] = long_value;
+
+  ink->ts_buffer[ink->ts_index++] = value;
+
+  if (ink->ts_index == TIME_SMOOTHER_BUFFER)
+    ink->ts_index = 0;
 }
 
+
 static void
-time_smoother_init (GimpInk *ink,
-                    guint32  initval)
+dist_smoother_init (GimpInk *ink,
+                    gdouble  initval)
 {
   gint i;
 
-  ink->ts_index = 0;
+  ink->dt_index = 0;
 
-  for (i = 0; i < TIME_SMOOTHER_BUFFER; i++)
-    {
-      ink->ts_buffer[i] = initval;
-    }
+  for (i = 0; i < DIST_SMOOTHER_BUFFER; i++)
+    ink->dt_buffer[i] = initval;
 }
 
 static gdouble
-time_smoother_result (GimpInk *ink)
+dist_smoother_result (GimpInk *ink)
 {
   gint    i;
-  guint64 result = 0;
+  gdouble result = 0.0;
 
-  for (i = 0; i < TIME_SMOOTHER_BUFFER; i++)
-    {
-      result += ink->ts_buffer[i];
-    }
+  for (i = 0; i < DIST_SMOOTHER_BUFFER; i++)
+    result += ink->dt_buffer[i];
 
-#ifdef _MSC_VER
-  return (gdouble) (gint64) (result / TIME_SMOOTHER_BUFFER);
-#else
-  return (result / TIME_SMOOTHER_BUFFER);
-#endif
+  return (result / (gdouble) DIST_SMOOTHER_BUFFER);
 }
 
 static void
-time_smoother_add (GimpInk *ink,
-                   guint32  value)
+dist_smoother_add (GimpInk *ink,
+                   gdouble  value)
 {
-  ink->ts_buffer[ink->ts_index] = value;
+  ink->dt_buffer[ink->dt_index++] = value;
 
-  if ((++ink->ts_index) == TIME_SMOOTHER_BUFFER)
-    ink->ts_index = 0;
+  if (ink->dt_index == DIST_SMOOTHER_BUFFER)
+    ink->dt_index = 0;
 }
 
 
