[gimp/wip/animation: 154/197] plug-ins: save the animation playback proxy ratio.



commit f2bc2f5e6f72847a4b41825a8333e7c8e9819782
Author: Jehan <jehan girinstud io>
Date:   Tue May 30 20:46:46 2017 +0200

    plug-ins: save the animation playback proxy ratio.

 plug-ins/animation-play/core/animation-playback.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-playback.c 
b/plug-ins/animation-play/core/animation-playback.c
index f92d4ec..ac53b2e 100644
--- a/plug-ins/animation-play/core/animation-playback.c
+++ b/plug-ins/animation-play/core/animation-playback.c
@@ -271,12 +271,19 @@ gchar *
 animation_playback_serialize (AnimationPlayback *playback)
 {
   gchar *xml;
+  gchar  proxy[6];
 
+  /* Make sure to have a locale-independent string. Also no need to have
+   * useless precision. This should give 3 digits after the decimal point.
+   * More than enough.
+   */
+  g_ascii_dtostr ((gchar*) &proxy, 6, playback->priv->proxy_ratio);
   xml = g_strdup_printf ("<playback position=\"%d\" "
-                         "start=\"%d\" stop=\"%d\"/>",
+                         "start=\"%d\" stop=\"%d\" proxy=\"%s\"/>",
                          playback->priv->position,
                          playback->priv->start,
-                         playback->priv->stop);
+                         playback->priv->stop,
+                         proxy);
   return xml;
 }
 
@@ -852,6 +859,11 @@ animation_playback_start_element (GMarkupParseContext  *context,
                   playback->priv->stop_at_end = (stop == duration - 1);
                 }
             }
+          else if (strcmp (*names, "proxy") == 0 && **values)
+            {
+              gdouble ratio = g_ascii_strtod (*values, NULL);
+              animation_playback_set_proxy (playback, ratio);
+            }
 
           names++;
           values++;


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