[gimp-gap] fixed move path acceleration handling at last controlpoint



commit b1a634cde7007c1c6f750e9bec77bbdbf567adaf
Author: Wolfgang Hofer <wolfgangh svn gnome org>
Date:   Sun Jul 4 13:33:18 2010 +0200

    fixed move path acceleration handling at last controlpoint

 ChangeLog             |   35 +++++++++++++++++++++++++++++++
 gap/gap_mov_exec.c    |    2 +-
 libgapbase/gap_base.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++-
 libgapbase/gap_base.h |   24 +++++++++++++++++++++
 4 files changed, 114 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b319e61..32ff79c 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2010-07-04 Wolfgang Hofer <hof gimp org>
+
+- fixed bug in move path rendering acceleration handling at last controlpoint.
+  when acceleration characteristic value other than 0 and 1 was used, 
+  the value(s) specified in the last controlpoint were not reached in the last frame.
+
+  example:
+  have 5 frames and use 2 controlpoints that scale an object from 25 % to 400 %
+  expected result is an object scaled to 400% in the last frame
+  
+  with (buggy version) got unexpected result:
+  frame  | scale in %
+  -------+------------
+  1      |  25.0
+  2      |  64.3979 
+  3      | 128.9717
+  4      | 208.4185
+  5      | 299.3830    // expected to reach 400% in the last rendered frame
+
+
+  with fixed version now get the expected result:
+
+  frame  | scale in %
+  -------+------------
+  1      |  25.0
+  2      |  78.8452 
+  3      | 167.0984
+  4      | 275.6785
+  5      | 400.0000
+
+- fixed bug in fetching boolean gimprc parmeter that always returned FALSE
+
+  * gap/gap_mov_exec.c
+  * libgapbase/gap_base.c [.h]
+
 2010-04-19 Wolfgang Hofer <hof gimp org>
 
 - move path fix for unwanted object jumps forth and back as reported in #607927
diff --git a/gap/gap_mov_exec.c b/gap/gap_mov_exec.c
index d3fe865..19b45ef 100755
--- a/gap/gap_mov_exec.c
+++ b/gap/gap_mov_exec.c
@@ -704,7 +704,7 @@ p_calculate_relframe_nr_at_index(GapMovValues *val_ptr, gint index, gint frames)
     }
   }
 
-  return (frames);
+  return (MAX(1, (frames -1)));
 
 }  /* end p_calculate_relframe_nr_at_index */
 
diff --git a/libgapbase/gap_base.c b/libgapbase/gap_base.c
old mode 100644
new mode 100755
index 03cf3ad..10ee720
--- a/libgapbase/gap_base.c
+++ b/libgapbase/gap_base.c
@@ -456,7 +456,7 @@ gap_base_get_gimprc_gboolean_value (const char *gimprc_option_name
      value = FALSE;
      if((*value_string == 'y') || (*value_string == 'Y'))
      {
-       value = FALSE;
+       value = TRUE;
      }
      g_free(value_string);
   }
@@ -520,3 +520,56 @@ gap_base_get_current_time(void)
   return ((gint32)time(0));
 }
 
+
+/* ------------------------------
+ * gap_base_mix_value_exp
+ * ------------------------------
+ *  result is a  for factor 0.0
+ *            b  for factor 1.0
+ *            exponential mix for factors inbetween
+ */
+gdouble 
+gap_base_mix_value_exp(gdouble factor, gdouble a, gdouble b)
+{
+  gdouble minAB;
+  gdouble offset;
+  gdouble value;
+  
+  if((a > 0) && (b > 0))
+  {
+    return ((a) * exp((factor) * log((b) / (a))));
+  }
+
+  if(a == b)
+  {
+    return (a);
+  }
+  
+  /* offset that makes both a and b positve values > 0
+   * to perform the exponential mix calculation
+   */
+  
+  minAB = (a < b ? a : b);
+  offset = 1 - minAB;
+  
+  value = ((a + offset) * exp((factor) * log((b + offset) / (a + offset))));
+
+  /* shift mixed value back to original range */
+  return (value - offset);
+}  /* end gap_base_mix_value_exp */
+
+
+/* ---------------------------------
+ * gap_base_mix_value_exp_and_round
+ * ---------------------------------
+ *  result is a  for factor 0.0
+ *            b  for factor 1.0
+ *            exponential mix for factors inbetween
+ *            and rounded
+ *            (0.5 is rounded to 1.0, -0.5 is rounded to -1.0
+ */
+gdouble 
+gap_base_mix_value_exp_and_round(gdouble factor, gdouble a, gdouble b)
+{
+  return (ROUND(gap_base_mix_value_exp(factor, a, b)));
+}
diff --git a/libgapbase/gap_base.h b/libgapbase/gap_base.h
old mode 100644
new mode 100755
index 46c33f8..9788b04
--- a/libgapbase/gap_base.h
+++ b/libgapbase/gap_base.h
@@ -178,4 +178,28 @@ gint32
 gap_base_get_current_time(void);
 
 
+
+/* ------------------------------
+ * gap_base_mix_value_exp
+ * ------------------------------
+ *  result is a  for factor 0.0
+ *            b  for factor 1.0
+ *            exponential mix for factors inbetween
+ */
+gdouble 
+gap_base_mix_value_exp(gdouble factor, gdouble a, gdouble b);
+
+/* ---------------------------------
+ * gap_base_mix_value_exp_and_round
+ * ---------------------------------
+ *  result is a  for factor 0.0
+ *            b  for factor 1.0
+ *            exponential mix for factors inbetween
+ *            and rounded
+ *            (0.5 is rounded to 1.0, -0.5 is rounded to -1.0
+ */
+gdouble 
+gap_base_mix_value_exp_and_round(gdouble factor, gdouble a, gdouble b);
+
+
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]